Add Phase 4b: instructor blocked dates, store closures, and substitute instructors
- New tables: instructor_blocked_date, store_closure (migration 0034) - substitute_instructor_id column added to lesson_session - Session generation skips blocked instructor dates and store closure periods - Substitute assignment validates sub is not blocked and has no conflicting slot - Routes: POST/GET/DELETE /instructors/:id/blocked-dates, POST/GET/DELETE /store-closures - 15 new integration tests covering blocked dates, store closures, and sub validation
This commit is contained in:
21
packages/backend/src/db/migrations/0034_blocked_dates.sql
Normal file
21
packages/backend/src/db/migrations/0034_blocked_dates.sql
Normal file
@@ -0,0 +1,21 @@
|
||||
-- Phase 4b: Instructor blocked dates, store closures, and substitute instructor on sessions
|
||||
|
||||
ALTER TABLE "lesson_session"
|
||||
ADD COLUMN "substitute_instructor_id" uuid REFERENCES "instructor"("id");
|
||||
|
||||
CREATE TABLE "instructor_blocked_date" (
|
||||
"id" uuid PRIMARY KEY DEFAULT gen_random_uuid(),
|
||||
"instructor_id" uuid NOT NULL REFERENCES "instructor"("id"),
|
||||
"start_date" date NOT NULL,
|
||||
"end_date" date NOT NULL,
|
||||
"reason" varchar(255),
|
||||
"created_at" timestamptz NOT NULL DEFAULT now()
|
||||
);
|
||||
|
||||
CREATE TABLE "store_closure" (
|
||||
"id" uuid PRIMARY KEY DEFAULT gen_random_uuid(),
|
||||
"name" varchar(255) NOT NULL,
|
||||
"start_date" date NOT NULL,
|
||||
"end_date" date NOT NULL,
|
||||
"created_at" timestamptz NOT NULL DEFAULT now()
|
||||
);
|
||||
@@ -239,6 +239,13 @@
|
||||
"when": 1774930000000,
|
||||
"tag": "0033_lesson_plans",
|
||||
"breakpoints": true
|
||||
},
|
||||
{
|
||||
"idx": 34,
|
||||
"version": "7",
|
||||
"when": 1774940000000,
|
||||
"tag": "0034_blocked_dates",
|
||||
"breakpoints": true
|
||||
}
|
||||
]
|
||||
}
|
||||
Reference in New Issue
Block a user