Yimaru-BackEnd/internal/domain/video_engagement.go
Yared Yemane 3f73afb4bf Add video engagement tracking and analytics metrics.
Record playback heartbeats via POST /api/v1/videos/engagement/heartbeat and expose completion, replay, and drop-off rates on the analytics dashboard.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-05-24 02:59:46 -07:00

24 lines
751 B
Go

package domain
const (
VideoContentKindLMSLesson = "lms_lesson"
VideoContentKindExamPrepLesson = "exam_prep_lesson"
)
const VideoCompletionThresholdPercent = 90
type VideoEngagementHeartbeatInput struct {
ContentKind string `json:"content_kind" validate:"required,oneof=lms_lesson exam_prep_lesson"`
ContentID int64 `json:"content_id" validate:"required,gt=0"`
PositionSec int `json:"position_sec" validate:"gte=0"`
DurationSec int `json:"duration_sec" validate:"gte=0"`
Ended bool `json:"ended"`
}
type VideoWatchSessionResponse struct {
SessionID int64 `json:"session_id"`
SessionNumber int `json:"session_number"`
MaxPositionSec int `json:"max_position_sec"`
Completed bool `json:"completed"`
}