Yimaru-BackEnd/internal/domain/course.go
Yared Yemane bc2357374b Add practice-existence flags and refresh API contracts.
Expose has_practice booleans for LMS and pre-exam hierarchy entities, wire SQL/repository mappings, and regenerate SQLC/Swagger artifacts. Also update the Resend sender display name for outbound emails.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-05-08 11:57:11 -07:00

47 lines
1.7 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. 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"`
}
type UpdateCourseInput struct {
Name *string `json:"name,omitempty"`
Description *string `json:"description,omitempty"`
Thumbnail *string `json:"thumbnail,omitempty"`
SortOrder *int `json:"sort_order,omitempty"`
}