Introduce exam_prep.practice_parents, migrate lesson links, and add create/list APIs with progress rollups, sequential gating, and RBAC permissions. Co-authored-by: Cursor <cursoragent@cursor.com>
100 lines
4.2 KiB
Go
100 lines
4.2 KiB
Go
package domain
|
|
|
|
import "time"
|
|
|
|
// AdminUserLearningActivityDetails is the full learning picture for a learner (LMS + exam prep + timeline).
|
|
type AdminUserLearningActivityDetails struct {
|
|
UserID int64 `json:"user_id"`
|
|
LMS AdminUserLMSLearningSection `json:"lms"`
|
|
ExamPrep AdminUserExamPrepLearningSection `json:"exam_prep"`
|
|
RecentActivity UserRecentActivityFeed `json:"recent_activity"`
|
|
}
|
|
|
|
type AdminUserLMSLearningSection struct {
|
|
CompletedIDs LMSUserProgress `json:"completed_ids"`
|
|
Progress LMSProgressSummary `json:"progress"`
|
|
Completions AdminLMSUserLearningActivityTree `json:"completions"`
|
|
}
|
|
|
|
type AdminUserExamPrepLearningSection struct {
|
|
Progress ExamPrepProgressSummary `json:"progress"`
|
|
Completions AdminExamPrepUserLearningActivityTree `json:"completions"`
|
|
}
|
|
|
|
// ExamPrepProgressSummary mirrors LMSProgressSummary for exam-prep catalog hierarchy.
|
|
type ExamPrepProgressSummary struct {
|
|
CatalogCourses []ExamPrepProgressSummaryCatalogCourse `json:"catalog_courses"`
|
|
}
|
|
|
|
type ExamPrepProgressSummaryCatalogCourse struct {
|
|
ID int64 `json:"id"`
|
|
Name string `json:"name"`
|
|
Access *LMSEntityAccess `json:"access,omitempty"`
|
|
Units []ExamPrepProgressSummaryUnit `json:"units"`
|
|
}
|
|
|
|
type ExamPrepProgressSummaryUnit struct {
|
|
ID int64 `json:"id"`
|
|
CatalogCourseID int64 `json:"catalog_course_id"`
|
|
Name string `json:"name"`
|
|
Access *LMSEntityAccess `json:"access,omitempty"`
|
|
Modules []ExamPrepProgressSummaryModule `json:"modules"`
|
|
}
|
|
|
|
type ExamPrepProgressSummaryModule struct {
|
|
ID int64 `json:"id"`
|
|
UnitID int64 `json:"unit_id"`
|
|
Name string `json:"name"`
|
|
Access *LMSEntityAccess `json:"access,omitempty"`
|
|
Lessons []ExamPrepProgressSummaryLesson `json:"lessons"`
|
|
}
|
|
|
|
type ExamPrepProgressSummaryLesson struct {
|
|
ID int64 `json:"id"`
|
|
ModuleID int64 `json:"module_id"`
|
|
Title string `json:"title"`
|
|
Access *LMSEntityAccess `json:"access,omitempty"`
|
|
}
|
|
|
|
// AdminExamPrepUserLearningActivityTree is nested catalog course → unit → module → lesson → practice completions.
|
|
type AdminExamPrepUserLearningActivityTree struct {
|
|
UserID int64 `json:"user_id"`
|
|
CatalogCourses []AdminExamPrepCatalogCourseLearningEntry `json:"catalog_courses"`
|
|
}
|
|
|
|
type AdminExamPrepCatalogCourseLearningEntry struct {
|
|
ID int64 `json:"id"`
|
|
Name string `json:"name"`
|
|
SortOrder int32 `json:"sort_order"`
|
|
Practices []AdminExamPrepPracticeLearningEntry `json:"practices"`
|
|
Units []AdminExamPrepUnitLearningEntry `json:"units"`
|
|
}
|
|
|
|
type AdminExamPrepUnitLearningEntry struct {
|
|
ID int64 `json:"id"`
|
|
Name string `json:"name"`
|
|
SortOrder int32 `json:"sort_order"`
|
|
Practices []AdminExamPrepPracticeLearningEntry `json:"practices"`
|
|
Modules []AdminExamPrepModuleLearningEntry `json:"modules"`
|
|
}
|
|
|
|
type AdminExamPrepModuleLearningEntry struct {
|
|
ID int64 `json:"id"`
|
|
Name string `json:"name"`
|
|
SortOrder int32 `json:"sort_order"`
|
|
Lessons []AdminExamPrepLessonLearningEntry `json:"lessons"`
|
|
}
|
|
|
|
type AdminExamPrepLessonLearningEntry struct {
|
|
ID int64 `json:"id"`
|
|
Title string `json:"title"`
|
|
SortOrder int32 `json:"sort_order"`
|
|
Practices []AdminExamPrepPracticeLearningEntry `json:"practices"`
|
|
}
|
|
|
|
type AdminExamPrepPracticeLearningEntry struct {
|
|
ExamPrepPracticeID int64 `json:"exam_prep_practice_id"`
|
|
Title string `json:"title"`
|
|
CompletedAt time.Time `json:"completed_at"`
|
|
}
|