34 lines
1.1 KiB
Go
34 lines
1.1 KiB
Go
// Package service — AudioProgressService is a thin passthrough over
|
|
// AudioProgressRepo. The audio player's resume points carry no server-side
|
|
// business logic (the frontend owns the schema and the newest-wins merge
|
|
// is enforced in SQL), so this layer exists only to keep the
|
|
// handler → service → repository shape consistent with the rest of the API.
|
|
package service
|
|
|
|
import (
|
|
"context"
|
|
|
|
"github.com/prabhupadasays/spsays-bff/internal/model"
|
|
"github.com/prabhupadasays/spsays-bff/internal/repository"
|
|
)
|
|
|
|
type AudioProgressService struct {
|
|
repo *repository.AudioProgressRepo
|
|
}
|
|
|
|
func NewAudioProgressService(repo *repository.AudioProgressRepo) *AudioProgressService {
|
|
return &AudioProgressService{repo: repo}
|
|
}
|
|
|
|
func (s *AudioProgressService) List(ctx context.Context, userID string) ([]model.AudioProgress, error) {
|
|
return s.repo.ListByUser(ctx, userID)
|
|
}
|
|
|
|
func (s *AudioProgressService) Upsert(ctx context.Context, userID string, items []model.AudioProgress) error {
|
|
return s.repo.Upsert(ctx, userID, items)
|
|
}
|
|
|
|
func (s *AudioProgressService) Delete(ctx context.Context, userID, key string) error {
|
|
return s.repo.Delete(ctx, userID, key)
|
|
}
|