programme

package
v1.0.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 28, 2026 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CreateInput

type CreateInput struct {
	Name     string
	Date     time.Time
	SeasonID int
}

CreateInput is a new programme; a file is required. SeasonID 0 means none.

type Handlers

type Handlers struct {
	// contains filtered or unexported fields
}

Handlers serves /programmes and /seasons.

func NewHandlers

func NewHandlers(svc *Service) *Handlers

func (*Handlers) Register

func (h *Handlers) Register(g *echo.Group, guards web.Guards)

Register mounts the programme and season routes on the /api/v1 group.

type Programme

type Programme struct {
	ID              int       `db:"id" json:"id"`
	Name            string    `db:"name" json:"name"`
	FileName        string    `db:"file_name" json:"file_name"`
	DateOfProgramme time.Time `db:"date_of_programme" json:"date_of_programme"`
	SeasonID        int       `db:"programme_season_id" json:"season_id"`
}

type Public

type Public struct {
	ID      int           `json:"id"`
	Name    string        `json:"name"`
	Date    time.Time     `json:"date"`
	FileURL string        `json:"fileUrl"`
	Season  *PublicSeason `json:"season,omitempty"`
}

Public is a match programme as the API returns it.

type PublicSeason

type PublicSeason struct {
	ID   int    `json:"id"`
	Name string `json:"name"`
}

PublicSeason is a programme season.

type Season

type Season struct {
	ID     int    `db:"id" json:"id"`
	Season string `db:"season" json:"season"`
}

type SeasonInput

type SeasonInput struct {
	Season string `json:"season"`
}

SeasonInput is the JSON body for creating or renaming a season.

type Service

type Service struct {
	// contains filtered or unexported fields
}

Service is the programme and season logic.

func NewService

func NewService(store store, files *upload.Files) *Service

func (*Service) Create

func (s *Service) Create(ctx context.Context, in CreateInput, file *upload.File) (Public, error)

func (*Service) CreateSeason

func (s *Service) CreateSeason(ctx context.Context, name string) (PublicSeason, error)

func (*Service) Delete

func (s *Service) Delete(ctx context.Context, id int) (Public, error)

Delete removes the programme and its file, returning what was deleted.

func (*Service) DeleteSeason

func (s *Service) DeleteSeason(ctx context.Context, id int) (PublicSeason, error)

DeleteSeason unlinks the season's programmes (they are kept) and deletes it.

func (*Service) List

func (s *Service) List(ctx context.Context, seasonID int) ([]Public, error)

List returns programmes, newest first; seasonID 0 lists every season.

func (*Service) RenameSeason

func (s *Service) RenameSeason(ctx context.Context, id int, name string) (PublicSeason, error)

func (*Service) Seasons

func (s *Service) Seasons(ctx context.Context) ([]PublicSeason, error)

type Store

type Store struct {
	// contains filtered or unexported fields
}

Store stores the dependencies

func NewProgrammeRepo

func NewProgrammeRepo(db *sqlx.DB) *Store

NewProgrammeRepo stores our dependency

func (*Store) AddProgramme

func (s *Store) AddProgramme(ctx context.Context, programmeParam Programme) (Programme, error)

func (*Store) AddSeason

func (s *Store) AddSeason(ctx context.Context, seasonParam Season) (Season, error)

func (*Store) DeleteProgramme

func (s *Store) DeleteProgramme(ctx context.Context, programmeParam Programme) error

func (*Store) DeleteSeason

func (s *Store) DeleteSeason(ctx context.Context, seasonParam Season) error

func (*Store) EditProgramme

func (s *Store) EditProgramme(ctx context.Context, programmeParam Programme) (Programme, error)

func (*Store) EditSeason

func (s *Store) EditSeason(ctx context.Context, seasonParam Season) (Season, error)

func (*Store) GetProgramme

func (s *Store) GetProgramme(ctx context.Context, programmeParam Programme) (Programme, error)

func (*Store) GetProgrammes

func (s *Store) GetProgrammes(ctx context.Context) ([]Programme, error)

func (*Store) GetProgrammesSeason

func (s *Store) GetProgrammesSeason(ctx context.Context, seasonParam Season) ([]Programme, error)

func (*Store) GetSeason

func (s *Store) GetSeason(ctx context.Context, seasonParam Season) (Season, error)

func (*Store) GetSeasons

func (s *Store) GetSeasons(ctx context.Context) ([]Season, error)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL