Expose GET /api/v1/admin/users/:user_id/recent-activity (progress.get_any_user) merging account creation and LMS completion milestones, with optional practice rows. Co-authored-by: Cursor <cursoragent@cursor.com>
68 lines
2.2 KiB
Go
68 lines
2.2 KiB
Go
package domain
|
|
|
|
import "time"
|
|
|
|
// User-recent-activity feed kinds (for timeline UI: icon + copy).
|
|
const (
|
|
UserRecentActivityJoined = "joined"
|
|
UserRecentActivityLessonCompleted = "lesson_completed"
|
|
UserRecentActivityModuleCompleted = "module_completed"
|
|
UserRecentActivityCourseCompleted = "course_completed"
|
|
UserRecentActivityProgramCompleted = "program_completed"
|
|
UserRecentActivityPracticeCompleted = "practice_completed"
|
|
)
|
|
|
|
// UserRecentActivityFeed is a reverse-chronological list of notable user events (account + LMS completions).
|
|
type UserRecentActivityFeed struct {
|
|
UserID int64 `json:"user_id"`
|
|
Items []UserRecentActivityItem `json:"items"`
|
|
}
|
|
|
|
// UserRecentActivityItem is one row in a profile or admin "Recent activity" timeline.
|
|
type UserRecentActivityItem struct {
|
|
ID string `json:"id"`
|
|
|
|
// Kind drives default icon treatment on the client (e.g. joined vs completion).
|
|
Kind string `json:"kind"`
|
|
|
|
// OccurredAt is when the platform recorded the event (typically completion time).
|
|
OccurredAt time.Time `json:"occurred_at"`
|
|
|
|
// Headline is optional server-rendered primary line (client may ignore and build from refs).
|
|
Headline string `json:"headline"`
|
|
|
|
Program *RecentActivityProgramRef `json:"program,omitempty"`
|
|
Course *RecentActivityCourseRef `json:"course,omitempty"`
|
|
Module *RecentActivityModuleRef `json:"module,omitempty"`
|
|
Lesson *RecentActivityLessonRef `json:"lesson,omitempty"`
|
|
Practice *RecentActivityPracticeRef `json:"practice,omitempty"`
|
|
}
|
|
|
|
type RecentActivityProgramRef struct {
|
|
ID int64 `json:"id"`
|
|
Name string `json:"name"`
|
|
}
|
|
|
|
type RecentActivityCourseRef struct {
|
|
ID int64 `json:"id"`
|
|
Name string `json:"name"`
|
|
}
|
|
|
|
type RecentActivityModuleRef struct {
|
|
ID int64 `json:"id"`
|
|
Name string `json:"name"`
|
|
SortOrder int32 `json:"sort_order"`
|
|
}
|
|
|
|
type RecentActivityLessonRef struct {
|
|
ID int64 `json:"id"`
|
|
Title string `json:"title"`
|
|
SortOrder int32 `json:"sort_order,omitempty"`
|
|
}
|
|
|
|
type RecentActivityPracticeRef struct {
|
|
LMSPracticeID int64 `json:"lms_practice_id"`
|
|
Title string `json:"title"`
|
|
Scope string `json:"scope"` // lesson | module | course
|
|
}
|