Files
eatme/docs/data-model/shift-signups.md
Michal Pemcak 94933cac5c Update OKF docs bundle, README, and CLAUDE.md for today's features
Documents the shift planning and closure/payroll modules (new tables,
routes, stores), the dark redesign, and the docker-compose-broken-host
workaround. Adds CLAUDE.md pointing agents at docs/. Translates README to
English and keeps host-specific infrastructure details out of the repo.
2026-08-16 18:41:11 +02:00

1.7 KiB

type, title, description, resource, tags, timestamp
type title description resource tags timestamp
SQLite Table shift_signups An employee's claim on a shift slot — approved or cancelled. backend/src/db/index.ts
data-model
sqlite
shift-planning
2026-08-16T00:00:00Z

shift_signups

Schema

Column Type Description
id INTEGER PK autoincrement
slot_id INTEGER references shift_slots
employee_id INTEGER references employees
status TEXT approved | cancelled
created_at TEXT ISO 8601 UTC
cancelled_at / cancelled_by TEXT | NULL when, and by whom (admin email or the employee's own)

Cancelling never deletes the row (status = 'cancelled'), so who was ever signed up for a slot stays visible in history.

Signup rules

Enforced in signupInternal (backend/src/services/shiftPlanning.ts), in this order, identically whether the employee signs themselves up or the admin assigns them:

  1. Slot exists and isn't closed.
  2. Not already approved for this exact slot.
  3. No time overlap with any of the employee's other approved slots, anywhere — not just the same day. Computed from real start/end Dates (slotStart/slotEnd), so a slot whose end_time <= start_time correctly counts as ending the next day.
  4. Slot isn't already at capacity.

All of this runs synchronously in a single request — better-sqlite3 is synchronous, so there's no LockService-style mutex needed the way the source Apps Script version required (signupEmployeeToSlot_ in gscript/ShiftPlanningService.js).

Related