commit f17f943bc149fef1a0ef3f884cf8653e70469ac5
Author: Nik Afiq <nik.afiq98@ymail.com>
Date: Fri Dec 5 22:33:01 2025 +0900
Fix JSON tags for Episode struct fields in model.go
41 lines
1.2 KiB
Go
41 lines
1.2 KiB
Go
package episode
|
|
|
|
import (
|
|
"context"
|
|
"errors"
|
|
"time"
|
|
)
|
|
|
|
var (
|
|
ErrNotFound = errors.New("episode not found")
|
|
ErrInvalidStartTime = errors.New("invalid start_time (expected HH:MM:SS)")
|
|
ErrEmptyIDs = errors.New("ids must not be empty")
|
|
)
|
|
|
|
// Episode represents a single show/episode in the system.
|
|
type Episode struct {
|
|
Id int `json:"id"`
|
|
EpNum int `json:"ep_num"`
|
|
EpTitle string `json:"ep_title"`
|
|
SeasonName string `json:"season_name"`
|
|
StartTime string `json:"start_time"`
|
|
PlaybackLength string `json:"playback_length"`
|
|
DateCreated time.Time `json:"date_created"`
|
|
}
|
|
|
|
// MoveResult describes what happened during an archive move operation.
|
|
type MoveResult struct {
|
|
MovedIDs []int64
|
|
DeletedIDs []int64
|
|
SkippedIDs []int64
|
|
}
|
|
|
|
// Repository is the storage port that the application layer depends on.
|
|
type Repository interface {
|
|
GetCurrent(ctx context.Context) (Episode, error)
|
|
SetCurrent(ctx context.Context, id int64, startHHMMSS string) error
|
|
MoveToArchive(ctx context.Context, ids []int64) (MoveResult, error)
|
|
ListAll(ctx context.Context) ([]Episode, error)
|
|
Delete(ctx context.Context, id int64) error
|
|
}
|