watch-party/backend/internal/service/episode_service.go
2025-11-04 21:22:13 +09:00

28 lines
592 B
Go

package service
import (
"context"
"time"
"watch-party-backend/internal/repo"
)
type EpisodeService interface {
GetCurrent(ctx context.Context) (repo.Episode, error)
}
type episodeService struct {
repo repo.EpisodeRepository
}
func NewEpisodeService(r repo.EpisodeRepository) EpisodeService {
return &episodeService{repo: r}
}
func (s *episodeService) GetCurrent(ctx context.Context) (repo.Episode, error) {
// Add cross-cutting concerns here (timeouts, metrics, caching, etc.)
c, cancel := context.WithTimeout(ctx, 3*time.Second)
defer cancel()
return s.repo.GetCurrent(c)
}