Add lessons Phase 5: grading scales with nested levels
Custom grading scales with ordered levels (value, label, numeric score, color). Supports one-default-per-store constraint, deep create with nested levels, lookup endpoint for dropdowns, and search/pagination. 12 new tests (76 total lessons tests).
This commit is contained in:
@@ -106,3 +106,28 @@ export const LessonSessionUpdateSchema = z.object({
|
||||
actualEndTime: opt(z.string().regex(/^\d{2}:\d{2}$/, 'Must be HH:MM format')),
|
||||
})
|
||||
export type LessonSessionUpdateInput = z.infer<typeof LessonSessionUpdateSchema>
|
||||
|
||||
// --- Grading Scale schemas ---
|
||||
|
||||
export const GradingScaleLevelInput = z.object({
|
||||
value: z.string().min(1).max(50),
|
||||
label: z.string().min(1).max(255),
|
||||
numericValue: z.coerce.number().int().min(0).max(100),
|
||||
colorHex: opt(z.string().regex(/^#[0-9A-Fa-f]{6}$/, 'Must be #RRGGBB format')),
|
||||
sortOrder: z.coerce.number().int(),
|
||||
})
|
||||
|
||||
export const GradingScaleCreateSchema = z.object({
|
||||
name: z.string().min(1).max(255),
|
||||
description: opt(z.string()),
|
||||
isDefault: z.boolean().default(false),
|
||||
levels: z.array(GradingScaleLevelInput).min(1),
|
||||
})
|
||||
export type GradingScaleCreateInput = z.infer<typeof GradingScaleCreateSchema>
|
||||
|
||||
export const GradingScaleUpdateSchema = z.object({
|
||||
name: z.string().min(1).max(255).optional(),
|
||||
description: opt(z.string()),
|
||||
isDefault: z.boolean().optional(),
|
||||
})
|
||||
export type GradingScaleUpdateInput = z.infer<typeof GradingScaleUpdateSchema>
|
||||
|
||||
Reference in New Issue
Block a user