45 lines
1.6 KiB
Go
45 lines
1.6 KiB
Go
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; practices with course_id set (direct course practice only).
|
|
ModuleCount int `json:"module_count"`
|
|
LessonCount int `json:"lesson_count"`
|
|
PracticeCount int `json:"practice_count"`
|
|
Access *LMSEntityAccess `json:"access,omitempty"`
|
|
}
|
|
|
|
type CreateCourseInput struct {
|
|
Name string `json:"name" validate:"required"`
|
|
Description *string `json:"description,omitempty"`
|
|
Thumbnail *string `json:"thumbnail,omitempty"`
|
|
}
|
|
|
|
type UpdateCourseInput struct {
|
|
Name *string `json:"name,omitempty"`
|
|
Description *string `json:"description,omitempty"`
|
|
Thumbnail *string `json:"thumbnail,omitempty"`
|
|
SortOrder *int `json:"sort_order,omitempty"`
|
|
}
|