RezinaLMS-BackEnd/internal/domain/admin_user_learning_activity.go
Yared Yemane d3b9cbf204 feat: add admin user subscriptions and learning activity endpoints
Expose GET /admin/users/:user_id/subscriptions with full plan history and payments, and GET /admin/users/:user_id/learning-activity with LMS and exam-prep progress, completions, and recent timeline.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-06-14 04:33:46 -07:00

98 lines
4.0 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"`
Units []AdminExamPrepUnitLearningEntry `json:"units"`
}
type AdminExamPrepUnitLearningEntry struct {
ID int64 `json:"id"`
Name string `json:"name"`
SortOrder int32 `json:"sort_order"`
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"`
}