site

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: 17 Imported by: 0

Documentation

Overview

Package site serves read-only views that combine several domains: shared layout data, the home page, the contact page and the team page.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AffiliationSource

type AffiliationSource interface {
	ListMinimal(ctx context.Context) ([]affiliation.Public, error)
}

type Contact

type Contact struct {
	DisplayEmail string `json:"displayEmail,omitempty"`
	// TeamEmailMode is which email team pages show, for the settings page.
	TeamEmailMode string          `json:"teamEmailMode"`
	People        []ContactPerson `json:"people"`
}

Contact is the contact page.

type ContactPerson

type ContactPerson struct {
	ID       int    `json:"id"`
	Name     string `json:"name"`
	Email    string `json:"email"`
	Role     string `json:"role"`
	ImageURL string `json:"imageUrl,omitempty"`
}

ContactPerson is a club official listed on the contact page.

type CountSource

type CountSource interface {
	Count() int
}

type Deps

type Deps struct {
	News         NewsSource
	WhatsOn      WhatsOnSource
	Sponsors     SponsorSource
	Affiliations AffiliationSource
	Teams        TeamSource
	Players      SquadSource
	Settings     SettingSource
	Users        UserSource
	Visitors     CountSource
	Files        *upload.Files
	Version      string
}

Deps are the services site reads from.

type Handlers

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

Handlers serves /site, /home, /contact and /teams/{id}.

func NewHandlers

func NewHandlers(svc *Service) *Handlers

func (*Handlers) Register

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

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

type Home

type Home struct {
	LatestNews   *news.Article        `json:"latestNews,omitempty"`
	NextEvent    *whatson.Event       `json:"nextEvent,omitempty"`
	Sponsors     []sponsor.Public     `json:"sponsors"`
	Affiliations []affiliation.Public `json:"affiliations"`
}

Home is the home page. Panels whose data failed to load are omitted.

type Info

type Info struct {
	Year         int           `json:"year"`
	VisitorCount int           `json:"visitorCount"`
	DisplayEmail string        `json:"displayEmail,omitempty"`
	Version      string        `json:"version"`
	Teams        []team.Public `json:"teams"`
}

Info is the data every page's layout needs.

type Manager

type Manager struct {
	Name string `json:"name"`
	// Email is left out unless team pages show managers' own emails.
	Email string `json:"email,omitempty"`
}

Manager is a team manager's public contact.

type NewsSource

type NewsSource interface {
	Latest(ctx context.Context) (news.Article, bool, error)
}

type Service

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

Service builds the cross-domain page data.

func NewService

func NewService(d Deps) *Service

func (*Service) Contact

func (s *Service) Contact(ctx context.Context) (Contact, error)

Contact returns the club officials and public contact email.

func (*Service) Home

func (s *Service) Home(ctx context.Context) Home

Home returns the home page; failed panels are logged and omitted.

func (*Service) Site

func (s *Service) Site(ctx context.Context) (Info, error)

Site returns the layout data shared by every page.

func (*Service) Team

func (s *Service) Team(ctx context.Context, id int) (TeamDetail, error)

Team returns the public team page.

type SettingSource

type SettingSource interface {
	DisplayEmail(ctx context.Context) (string, error)
	TeamEmailMode(ctx context.Context) (setting.TeamEmailMode, error)
}

type SponsorSource

type SponsorSource interface {
	ListMinimal(ctx context.Context) ([]sponsor.Public, error)
	ForTeam(ctx context.Context, teamID int) ([]sponsor.Public, error)
}

type SquadSource

type SquadSource interface {
	Squad(ctx context.Context, t team.Team) ([]player.Member, error)
}

type TeamDetail

type TeamDetail struct {
	Team team.Public `json:"team"`
	// ContactEmail is the address to contact the team at when managers'
	// own emails aren't shown (setting.TeamEmailMode); "" otherwise.
	ContactEmail string           `json:"contactEmail,omitempty"`
	Managers     []Manager        `json:"managers"`
	Sponsors     []sponsor.Public `json:"sponsors"`
	Players      []player.Member  `json:"players"`
}

TeamDetail is the public team page.

type TeamSource

type TeamSource interface {
	List(ctx context.Context, includeInactive bool) ([]team.Public, error)
	Get(ctx context.Context, id int) (team.Public, error)
}

type UserSource

type UserSource interface {
	GetUsersContact(ctx context.Context) ([]user.User, error)
	GetUsersManagersTeam(ctx context.Context, teamParam team.Team) ([]user.User, error)
}

type WhatsOnSource

type WhatsOnSource interface {
	Next(ctx context.Context) (whatson.Event, bool, error)
}

Jump to

Keyboard shortcuts

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