seasons

package
v0.0.0-...-c8194c3 Latest Latest
Warning

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

Go to latest
Published: Aug 14, 2024 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 API

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

func NewAPI

func NewAPI(logger *slog.Logger, db SeasonDB) *API

func (*API) GetSeasons

func (a *API) GetSeasons(c *gin.Context)

swagger:route GET /seasons season getSeasons Get all seasons.

responses:

200: body:GetSeasonsResp
500: Error

func (*API) PostSeason

func (a *API) PostSeason(c *gin.Context)

swagger:route POST /season season postSeason

Add a new season.

responses:

200: body:PostSeasonResp
400: body:Error
500: body:Error

func (*API) PutSeason

func (a *API) PutSeason(c *gin.Context)

swagger:route PUT /season/{ID} season putSeason

Update a season.

responses:

200: body:PutSeasonResp
400: body:Error
500: body:Error

type GetSeasonsInput

type GetSeasonsInput struct{}

swagger:parameters getSeasons

type GetSeasonsResp

type GetSeasonsResp struct {
	Data []Season `json:"data"`
}

swagger:model GetSeasonsResp

type PostSeasonInput

type PostSeasonInput struct {
	// in:body
	Body struct {
		// required: true
		Name string `json:"name" binding:"required,min=5,ascii"`
		// required: true
		StartDate handlers.Date `json:"startDate" binding:"required"`
		// required: true
		EndDate  handlers.Date   `json:"endDate" binding:"required,gtfield=StartDate"`
		ByeWeeks []handlers.Date `json:"byeWeeks" binding:"unique"`
	}
}

swagger:parameters postSeason

type PostSeasonResp

type PostSeasonResp struct {
	Data Season `json:"data"`
}

swagger:model PostSeasonResp

type PutSeasonInput

type PutSeasonInput struct {
	// in:path
	ID uuid.UUID
	// in:body
	Body struct {
		// required: true
		Name string `json:"name" binding:"required,min=5,ascii"`
		// required: true
		StartDate handlers.Date `json:"startDate" binding:"required"`
		// required: true
		EndDate  handlers.Date   `json:"endDate" binding:"required,gtfield=StartDate"`
		ByeWeeks []handlers.Date `json:"byeWeeks" binding:"unique"`
	}
}

swagger:parameters putSeason

type PutSeasonResp

type PutSeasonResp struct {
	Data Season `json:"data"`
}

swagger:model PutSeasonResp

type Season

type Season struct {
	ID        string   `json:"id"`
	Name      string   `json:"name"`
	StartDate string   `json:"startDate"`
	EndDate   string   `json:"endDate"`
	ByeWeeks  []string `json:"byeWeeks,omitempty"`
}

swagger:model Season

type SeasonDB

type SeasonDB interface {
	AddSeason(ctx context.Context, season model.Season) (*model.Season, error)
	UpdateSeason(ctx context.Context, id uuid.UUID, updates db.UpdateSeasonInput) (*model.Season, error)
	GetAllSeasons(ctx context.Context) ([]model.Season, error)
	GetSeason(ctx context.Context, id uuid.UUID) (*model.Season, error)
}

Jump to

Keyboard shortcuts

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