Yimaru-BackEnd/internal/domain/lms_admin_learning.go
Yared Yemane 52effaa321 Add admin endpoint for nested user LMS completion activity.
Expose GET /api/v1/admin/users/:user_id/lms-learning-activity for progress.get_any_user so admins see program/course/module/lesson completions and practices from stored completion rows.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-05-18 00:58:49 -07:00

57 lines
3.0 KiB
Go

package domain
import "time"
// AdminLMSUserLearningActivityTree is a nested LMS view for admins: programs → courses → modules,
// plus lessons/practices where the learner has recorded completion (see API description for schema limits).
type AdminLMSUserLearningActivityTree struct {
UserID int64 `json:"user_id"`
Programs []AdminLMSProgramLearningEntry `json:"programs"`
}
// AdminLMSProgramLearningEntry aggregates activity under one program (sequential LMS track).
type AdminLMSProgramLearningEntry struct {
ID int64 `json:"id"`
Name string `json:"name"`
SortOrder int32 `json:"sort_order"`
RollupFullyCompletedAt *time.Time `json:"rollup_completed_at,omitempty"`
Courses []AdminLMSCourseLearningEntry `json:"courses"`
}
// AdminLMSCourseLearningEntry aggregates activity under one course inside a program.
type AdminLMSCourseLearningEntry struct {
ID int64 `json:"id"`
Name string `json:"name"`
SortOrder int32 `json:"sort_order"`
RollupFullyCompletedAt *time.Time `json:"rollup_completed_at,omitempty"`
Modules []AdminLMSModuleLearningEntry `json:"modules"`
CourseLevelPractices []AdminLMSPracticeLearningEntry `json:"course_level_practices,omitempty"`
}
// AdminLMSModuleLearningEntry aggregates activity under one module inside a course.
type AdminLMSModuleLearningEntry struct {
ID int64 `json:"id"`
Name string `json:"name"`
SortOrder int32 `json:"sort_order"`
RollupFullyCompletedAt *time.Time `json:"rollup_completed_at,omitempty"`
Lessons []AdminLMSLessonLearningEntry `json:"lessons,omitempty"`
ModuleScopedPractices []AdminLMSPracticeLearningEntry `json:"module_practices,omitempty"`
}
// AdminLMSLessonLearningEntry is lesson-scoped LMS activity (lesson marked complete and/or lesson practices completed).
type AdminLMSLessonLearningEntry struct {
ID int64 `json:"id"`
Title string `json:"title"`
SortOrder int32 `json:"sort_order"`
CompletedAt *time.Time `json:"completed_at,omitempty"`
LessonScopedPractices []AdminLMSPracticeLearningEntry `json:"lesson_practices,omitempty"`
}
// AdminLMSPracticeLearningEntry is an LMS practice completion (lesson-, module-, or course-scoped).
type AdminLMSPracticeLearningEntry struct {
LMSPracticeID int64 `json:"lms_practice_id"`
Title string `json:"title"`
Scope string `json:"scope"`
CompletedAt time.Time `json:"completed_at"`
}