Dillo example

Repair Shop

Your repair, tracked.

What this demonstrates

Two sides, one system. Customers see their jobs and status. The staff desk assigns technicians and moves jobs along. Nobody sees what they shouldn't. This is the classic service-business pattern: customer view and staff view, same backend, different permissions.

How it works

The permissions are the app. This is the whole data model — schema.ts, the first of the app's three files (its import line, not shown, brings these names in from "create-dillo/schema"):

schema.ts
// The schema the live backend serves today (span2/live-schemas filing, re-verified at deploy).
export default schema({
  Customer: table({
    email: string().email(),
    name: string().min(1).max(120),
    shopId: relation.team(),
  }).permissions({ view: members, edit: roles('owner') }),

  Estimate: table({
    cents: integer().min(0).max(10000000),
    repairId: relation('Repair'),
    shopId: relation.team(),
    state: string().min(1).max(32),
    summary: string().min(1).max(200),
  }).permissions({ view: members, edit: nobody }),

  Repair: table({
    photo: file().accept('image/jpeg', 'image/png', 'image/webp').maxBytes(5242880).optional(),
    shopId: relation.team(),
    status: string().min(1).max(32),
    summary: string().min(1).max(500),
    technicianId: relation.user().optional().nullable(),
    vehicleId: relation('Vehicle'),
  }).permissions({ view: members, edit: nobody }),

  Vehicle: table({
    customerId: relation('Customer'),
    label: string().min(1).max(120),
    shopId: relation.team(),
  }).permissions({ view: members, edit: roles('owner') }),
});

Try it

  1. Open the live demo
  2. Look up your repair as a customer
  3. Switch to the staff desk
  4. Move a repair to the next status