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>
21 lines
483 B
Go
21 lines
483 B
Go
package videoengagement
|
|
|
|
import (
|
|
"context"
|
|
|
|
"Yimaru-Backend/internal/domain"
|
|
"Yimaru-Backend/internal/repository"
|
|
)
|
|
|
|
type Service struct {
|
|
store *repository.Store
|
|
}
|
|
|
|
func NewService(store *repository.Store) *Service {
|
|
return &Service{store: store}
|
|
}
|
|
|
|
func (s *Service) RecordHeartbeat(ctx context.Context, userID int64, input domain.VideoEngagementHeartbeatInput) (domain.VideoWatchSessionResponse, error) {
|
|
return s.store.RecordVideoEngagementHeartbeat(ctx, userID, input)
|
|
}
|