package domain import "time" // DefaultCEFRCoursesByProgramName maps seeded program names to default course names // (migrations 000048 and 000050). The API may still create courses with any name. var DefaultCEFRCoursesByProgramName = map[string][]string{ "Beginner": {"A1", "A2"}, "Intermediate": {"B1", "B2"}, "Advanced": {"C1", "C2"}, } // DefaultCEFRCourseNames is every CEFR label used in DefaultCEFRCoursesByProgramName. var DefaultCEFRCourseNames = []string{"A1", "A2", "B1", "B2", "C1", "C2"} // Course belongs to a Program. type Course struct { ID int64 `json:"id"` ProgramID int64 `json:"program_id"` Name string `json:"name"` Description *string `json:"description,omitempty"` Thumbnail *string `json:"thumbnail,omitempty"` SortOrder int `json:"sort_order"` CreatedAt time.Time `json:"created_at"` UpdatedAt *time.Time `json:"updated_at,omitempty"` // Populated on list-by-program. Practice count: lms_practices rows with course_id = course only // (not practices attached to a module or lesson under this course). ModuleCount int `json:"module_count"` LessonCount int `json:"lesson_count"` PracticeCount int `json:"practice_count"` HasPractice bool `json:"has_practice"` Access *LMSEntityAccess `json:"access,omitempty"` } type CreateCourseInput struct { Name string `json:"name" validate:"required"` Description *string `json:"description,omitempty"` Thumbnail *string `json:"thumbnail,omitempty"` // SortOrder within the program when set; omit to append after current max within program_id (uniqueness is per-program). SortOrder *int `json:"sort_order,omitempty" validate:"omitempty,min=0"` } type UpdateCourseInput struct { Name *string `json:"name,omitempty"` Description *string `json:"description,omitempty"` Thumbnail *string `json:"thumbnail,omitempty"` SortOrder *int `json:"sort_order,omitempty"` }