Example tenant · examples/higher-ed-devices
A university's Tech Desk lends devices to students.
Lakeshore State University lends laptops, Chromebooks, hotspots, iPads, calculators and chargers. The example shows how to split a tenant: what has code is TypeScript, and what has no code is a file under platform/.
How the tenant fits together
What's in it.
Four tables, nine scripts, one flow, two apps with no code, a dashboard, and an agent for the help line.
| Part | What it is | Kept as |
|---|---|---|
| Tables | Students, devices, requests and loans, with a loan's status as coloured choices and its device shown by name | TypeScript |
| Scripts | Submit, cancel and decide a request; check out, check in and mark overdue; availability, the desk's queue, and looking up a student | TypeScript |
| Review flow | Calculators and chargers approved at once; the rest wait for the Tech Desk group | TypeScript |
| Device desk | The queue, check-out and check-in, and the shelf, for staff | YAML, editable in the console |
| Borrow a device | Ask for a device and see your requests and loans, for students | YAML, editable in the console |
| Lending | A dashboard built from menus, plus a saved query of loans by month | YAML |
| Settings | How long a loan lasts, and the schedule that marks loans overdue | YAML the desk can change |
| Access | The Tech Desk group and the help-desk agent's service account | Files under tenant/ |
Code where there's logic, files where there isn't.
This is the example to read before you lay out a repository of your own. Tables, scripts and the flow share a model and helpers, so they're TypeScript. Apps, screens, the theme, a variable and a schedule have no code, so they're files the console edits as well as you do.
- Every resource has one owner: the code that defines it, or a file. Keep to that and the console never has to take anything over.
volvel schemasmakes VS Code complete and check the files as you type.- Code names a file's resource by its path, so the two halves stay joined.
# A setting the desk changes without a developer: the console edits
# this file, and so can you. Its path is where it is kept: loans/days.
schemaVersion: 1
body:
description: How many days a loan lasts unless the desk says otherwise.
default: "14" A loan, from asking to handing back.
Every step is a script or a flow, and each one is reachable from the screen where it happens, and from the agent where that makes sense.
- Ask A student asks on Borrow a device, or the desk or the agent files it for them. A hold on their account, or the same kind already out, is refused with a reason.
- Review A calculator or a charger is approved at once. A laptop, a hotspot or an iPad waits up to three days for the Tech Desk.
- Set aside Approval sets a device aside for the student, or waitlists the request when none is free.
- Check out At the desk, a button on the request asks "Hand the device to the student?" and starts the loan.
- Overdue, or back Each weekday at seven, late loans are marked overdue. Check-in closes the loan and puts the device back on the shelf.
The tenant sets itself up.
The Tech Desk group and the agent's service account are files in the repository. Release the tenant's access, deploy, promote, and a script fills an empty workspace with a term's worth of data.
- The group's members come from the university's identity provider, never from the repository.
- Bindings and the review flow name the group by key, so it can be renamed later without touching code.
- Setup makes 40 students, two with holds, 58 devices, a term of loans with every hotspot out, and three students who can sign in.
$ volvel tenant plan --tenant higher-ed
$ volvel tenant release --tenant higher-ed
$ volvel deploy --tenant higher-ed --workspace devices-dev
$ volvel promote --tenant higher-ed --workspace devices-dev
$ node setup/setup.mjs --tenant higher-ed --workspace devices
$ node setup/agent.mjs call run_students__look_up '{"query":"S1002371"}' What it shows off.
- An approval by group
- Only the Tech Desk may decide, and nobody deciding in three days denies the request.
- Students see their own
- A
student_idon each student matches their records. Every device is visible to all. - No-code screens that act
- Check-out and check-in buttons that ask first, name the student and refresh the lists they change.
- A dashboard both ways
- Figures and a pivot built from menus, beside a table that reads a saved SQL query.
- An agent for the help line
- Bound to look-up, availability, the queue, submit and cancel, and nothing that hands a device out.
- A schedule the desk owns
- Weekday mornings in Central time, kept as a file anyone allowed can edit in the console.
Related
Lay out your repository the way this one is.
Lakeshore is in the repository, with everything it needs to run.