Add Phase 7: grade history and session-plan item linking

- New tables: lesson_plan_item_grade_history (append-only), lesson_session_plan_item
- Grading an item updates current_grade_value and creates immutable history record
- Grading a not_started item auto-transitions it to in_progress
- Linking items to a session also auto-transitions not_started items
- Link operation is idempotent — re-linking same items produces no duplicates
- Endpoints: POST/GET /lesson-plan-items/:id/grades, GET /lesson-plan-items/:id/grade-history
- Endpoints: POST/GET /lesson-sessions/:id/plan-items
- 8 new integration tests
This commit is contained in:
Ryan Moon
2026-03-30 10:33:21 -05:00
parent 5cd2d05983
commit 2cc8f24535
8 changed files with 446 additions and 2 deletions

View File

@@ -124,6 +124,8 @@ export {
LessonPlanItemUpdateSchema,
InstructorBlockedDateCreateSchema,
StoreClosureCreateSchema,
GradeCreateSchema,
SessionPlanItemsSchema,
} from './lessons.schema.js'
export type {
InstructorCreateInput,
@@ -145,4 +147,6 @@ export type {
LessonPlanItemUpdateInput,
InstructorBlockedDateCreateInput,
StoreClosureCreateInput,
GradeCreateInput,
SessionPlanItemsInput,
} from './lessons.schema.js'

View File

@@ -199,3 +199,20 @@ export const LessonPlanItemUpdateSchema = z.object({
sortOrder: z.coerce.number().int().optional(),
})
export type LessonPlanItemUpdateInput = z.infer<typeof LessonPlanItemUpdateSchema>
// --- Grade History schemas ---
export const GradeCreateSchema = z.object({
gradingScaleId: opt(z.string().uuid()),
gradeValue: z.string().min(1).max(50),
sessionId: opt(z.string().uuid()),
notes: opt(z.string()),
})
export type GradeCreateInput = z.infer<typeof GradeCreateSchema>
// --- Session Plan Items schemas ---
export const SessionPlanItemsSchema = z.object({
lessonPlanItemIds: z.array(z.string().uuid()).min(1),
})
export type SessionPlanItemsInput = z.infer<typeof SessionPlanItemsSchema>