setting

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Oct 26, 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 DisplayEmail

type DisplayEmail struct {
	Email string `json:"email"`
}

DisplayEmail is the body of PUT /settings/display-email.

type Handlers

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

Handlers serves /info and /settings.

func NewHandlers

func NewHandlers(svc *Service) *Handlers

func (*Handlers) Register

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

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

type InfoContent

type InfoContent struct {
	Content string `json:"content"`
}

InfoContent is the body of GET and PUT /info.

type Service

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

Service manages the editable site settings.

func NewService

func NewService(store store) *Service

func (*Service) DisplayEmail

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

DisplayEmail returns the public contact email ("" when not set).

func (*Service) Info

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

Info returns the "about the club" page HTML ("" when never set).

func (*Service) SetDisplayEmail

func (s *Service) SetDisplayEmail(ctx context.Context, email string) (string, error)

SetDisplayEmail validates and saves the public contact email; an empty email removes it.

func (*Service) SetInfo

func (s *Service) SetInfo(ctx context.Context, html string) (string, error)

SetInfo sanitises and saves the info page HTML, returning what was stored.

func (*Service) SetTeamEmailMode

func (s *Service) SetTeamEmailMode(ctx context.Context, mode TeamEmailMode) (TeamEmailMode, error)

SetTeamEmailMode saves which email team pages show.

func (*Service) TeamEmailMode

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

TeamEmailMode returns which email team pages show (ManagerEmails when never set).

type Setting

type Setting struct {
	ID          string `db:"id" json:"id"`
	SettingText string `db:"setting_text" json:"settingText"`
}

type Store

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

Store stores the dependencies

func NewSettingRepo

func NewSettingRepo(db *sqlx.DB) *Store

NewSettingRepo stores our dependency

func (*Store) AddSetting

func (s *Store) AddSetting(ctx context.Context, settingParam Setting) (Setting, error)

func (*Store) DeleteSetting

func (s *Store) DeleteSetting(ctx context.Context, settingID string) error

func (*Store) EditSetting

func (s *Store) EditSetting(ctx context.Context, settingParam Setting) (Setting, error)

func (*Store) GetSetting

func (s *Store) GetSetting(ctx context.Context, settingID string) (Setting, error)

func (*Store) GetSettings

func (s *Store) GetSettings(ctx context.Context) ([]Setting, error)

func (*Store) IncrementSetting

func (s *Store) IncrementSetting(ctx context.Context, settingID string, delta int) (Setting, error)

IncrementSetting atomically adds delta to a numeric setting, creating it with that value if it doesn't yet exist, and returns the setting's new value.

type TeamEmailMode

type TeamEmailMode string

TeamEmailMode says which email address team pages show for contacting a team. In TeamEmail and SiteEmail modes managers' personal addresses are never shown; when the chosen address isn't set, no email is shown.

const (
	// ManagerEmails shows each manager's own email (the default).
	ManagerEmails TeamEmailMode = "manager"
	// TeamEmail shows the team's own contact address.
	TeamEmail TeamEmailMode = "team"
	// SiteEmail shows the site-wide public contact email.
	SiteEmail TeamEmailMode = "site"
)

type TeamEmailModeInput

type TeamEmailModeInput struct {
	// Mode is "manager" (each manager's own email), "team" (the team's
	// contact address) or "site" (the site-wide contact email).
	Mode TeamEmailMode `json:"mode"`
}

TeamEmailModeInput is the body of PUT /settings/team-email-mode.

Jump to

Keyboard shortcuts

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