affiliation

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Affiliation

type Affiliation 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"`
}

type CreateInput

type CreateInput struct {
	Name    string
	Website string
}

CreateInput is a new affiliation; an image is required.

type Handlers

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

Handlers serves /affiliations.

func NewHandlers

func NewHandlers(svc *Service) *Handlers

func (*Handlers) Register

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

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

type Public

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

Public is an affiliation as the API returns it.

type Service

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

Service is the affiliation business logic.

func NewService

func NewService(store store, 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 affiliation and its logo, returning what was deleted.

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 Store

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

Store stores the dependencies

func NewAffiliationRepo

func NewAffiliationRepo(db *sqlx.DB) *Store

NewAffiliationRepo stores our dependency

func (*Store) AddAffiliation

func (s *Store) AddAffiliation(ctx context.Context, affiliationParam Affiliation) (Affiliation, error)

func (*Store) DeleteAffiliation

func (s *Store) DeleteAffiliation(ctx context.Context, affiliationParam Affiliation) error

func (*Store) GetAffiliation

func (s *Store) GetAffiliation(ctx context.Context, affiliationParam Affiliation) (Affiliation, error)

func (*Store) GetAffiliations

func (s *Store) GetAffiliations(ctx context.Context) ([]Affiliation, error)

func (*Store) GetAffiliationsMinimal

func (s *Store) GetAffiliationsMinimal(ctx context.Context) ([]Affiliation, error)

Jump to

Keyboard shortcuts

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