sponsor

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: 16 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
	Website string
	Purpose string
	Team    string
}

CreateInput is a new sponsor; an image is required.

type Handlers

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

Handlers serves /sponsors.

func NewHandlers

func NewHandlers(svc *Service) *Handlers

func (*Handlers) Register

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

Register mounts the sponsor routes on the /api/v1 group.

type Public

type Public struct {
	ID       int    `json:"id"`
	Name     string `json:"name"`
	Website  string `json:"website,omitempty"`
	Purpose  string `json:"purpose,omitempty"`
	Team     string `json:"team,omitempty"`
	ImageURL string `json:"imageUrl,omitempty"`
}

Public is a sponsor as the API returns it. Team is "A", "O" or "Y" (legacy audience codes) or a team ID as a string; empty means unassigned.

type Service

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

Service is the sponsor business logic.

func NewService

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

func (*Service) Create

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

func (*Service) Delete

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

Delete removes the sponsor and its logo, returning what was deleted.

func (*Service) ForTeam

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

ForTeam lists the sponsors attached to one team.

func (*Service) List

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

func (*Service) ListMinimal

func (s *Service) ListMinimal(ctx context.Context) ([]Public, error)

ListMinimal is the lighter list shown on the home page.

type Sponsor struct {
	ID       int         `db:"id" json:"id"`
	Name     string      `db:"name" json:"name"`
	Website  null.String `db:"website" json:"website"`
	FileName null.String `db:"file_name" json:"file_name"`
	Purpose  null.String `db:"purpose" json:"purpose"`
	TeamID   string      `db:"team_id" json:"team_id"`
}

type Store

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

Store stores the dependencies

func NewSponsorRepo

func NewSponsorRepo(db *sqlx.DB) *Store

NewSponsorRepo stores our dependency

func (*Store) AddSponsor

func (s *Store) AddSponsor(ctx context.Context, sponsorParam Sponsor) (Sponsor, error)

func (*Store) DeleteSponsor

func (s *Store) DeleteSponsor(ctx context.Context, sponsorParam Sponsor) error

func (*Store) DetachTeam

func (s *Store) DetachTeam(ctx context.Context, teamID int) error

DetachTeam makes every sponsor of teamID club-wide ("A").

func (*Store) EditSponsor

func (s *Store) EditSponsor(ctx context.Context, sponsorParam Sponsor) (Sponsor, error)

func (*Store) GetSponsor

func (s *Store) GetSponsor(ctx context.Context, sponsorParam Sponsor) (Sponsor, error)

func (*Store) GetSponsors

func (s *Store) GetSponsors(ctx context.Context) ([]Sponsor, error)

func (*Store) GetSponsorsMinimal

func (s *Store) GetSponsorsMinimal(ctx context.Context) ([]Sponsor, error)

func (*Store) GetSponsorsTeam

func (s *Store) GetSponsorsTeam(ctx context.Context, teamParam team.Team) ([]Sponsor, error)

type TeamGetter

type TeamGetter interface {
	GetTeam(ctx context.Context, teamParam team.Team) (team.Team, error)
}

TeamGetter checks team IDs (satisfied by *team.Store).

Jump to

Keyboard shortcuts

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