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:
Ryan Moon
2026-03-30 09:36:48 -05:00
parent 73360cd478
commit 31f661ff4f
8 changed files with 396 additions and 2 deletions

View File

@@ -0,0 +1,22 @@
-- Phase 5: Grading scales — custom grade definitions per store
CREATE TABLE "grading_scale" (
"id" uuid PRIMARY KEY DEFAULT gen_random_uuid(),
"name" varchar(255) NOT NULL,
"description" text,
"is_default" boolean NOT NULL DEFAULT false,
"created_by" uuid REFERENCES "user"("id"),
"is_active" boolean NOT NULL DEFAULT true,
"created_at" timestamptz NOT NULL DEFAULT now(),
"updated_at" timestamptz NOT NULL DEFAULT now()
);
CREATE TABLE "grading_scale_level" (
"id" uuid PRIMARY KEY DEFAULT gen_random_uuid(),
"grading_scale_id" uuid NOT NULL REFERENCES "grading_scale"("id"),
"value" varchar(50) NOT NULL,
"label" varchar(255) NOT NULL,
"numeric_value" integer NOT NULL,
"color_hex" varchar(7),
"sort_order" integer NOT NULL
);

View File

@@ -225,6 +225,13 @@
"when": 1774910000000,
"tag": "0031_lesson_sessions",
"breakpoints": true
},
{
"idx": 32,
"version": "7",
"when": 1774920000000,
"tag": "0032_grading_scales",
"breakpoints": true
}
]
}