static data for Courses
This commit is contained in:
parent
9db9c9899a
commit
6c672c4b20
3
db/migrations/000048_seed_default_courses.down.sql
Normal file
3
db/migrations/000048_seed_default_courses.down.sql
Normal file
|
|
@ -0,0 +1,3 @@
|
||||||
|
DELETE FROM courses
|
||||||
|
WHERE description = 'Default CEFR level course (system seed).'
|
||||||
|
AND name IN ('A1', 'A2', 'B1', 'B2', 'C1', 'C2');
|
||||||
18
db/migrations/000048_seed_default_courses.up.sql
Normal file
18
db/migrations/000048_seed_default_courses.up.sql
Normal file
|
|
@ -0,0 +1,18 @@
|
||||||
|
-- Default CEFR-style course names per program (custom courses can still be created via the API with any name).
|
||||||
|
-- Matches hierarchy note on courses: CEFR labels A1..C2, plus ad-hoc names allowed.
|
||||||
|
INSERT INTO courses (program_id, name, description, thumbnail)
|
||||||
|
SELECT
|
||||||
|
p.id,
|
||||||
|
v.name,
|
||||||
|
'Default CEFR level course (system seed).',
|
||||||
|
NULL
|
||||||
|
FROM programs AS p
|
||||||
|
CROSS JOIN (
|
||||||
|
VALUES
|
||||||
|
('A1'),
|
||||||
|
('A2'),
|
||||||
|
('B1'),
|
||||||
|
('B2'),
|
||||||
|
('C1'),
|
||||||
|
('C2')
|
||||||
|
) AS v (name);
|
||||||
|
|
@ -2,7 +2,11 @@ package domain
|
||||||
|
|
||||||
import "time"
|
import "time"
|
||||||
|
|
||||||
// Course belongs to a Program (e.g. A1, A2, … labels are configured separately).
|
// DefaultCEFRCourseNames are the standard course names seeded for each program (migration 000048).
|
||||||
|
// Creating a course via the API may use any of these or a custom name.
|
||||||
|
var DefaultCEFRCourseNames = []string{"A1", "A2", "B1", "B2", "C1", "C2"}
|
||||||
|
|
||||||
|
// Course belongs to a Program.
|
||||||
type Course struct {
|
type Course struct {
|
||||||
ID int64 `json:"id"`
|
ID int64 `json:"id"`
|
||||||
ProgramID int64 `json:"program_id"`
|
ProgramID int64 `json:"program_id"`
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user