services

package
v0.0.0-...-60e5973 Latest Latest
Warning

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

Go to latest
Published: Jul 8, 2023 License: AGPL-3.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrInvalidRosterConfig = errors.New("services: invalid roster configuration")

RosterConfigs defines the configurations to intialize the service with.

Functions

This section is empty.

Types

type PlayerDTO

type PlayerDTO struct {
	Name  string         `json:"name"`
	Teams []entity.Group `json:"teams"`
}

func NewPlayerDTO

func NewPlayerDTO(player *model.Player) PlayerDTO

type RosterConfiguration

type RosterConfiguration func(s *RosterService) error

RosterConfiguration is a function that modifies the service.

func WithMemoryRepositories

func WithMemoryRepositories() RosterConfiguration

WithMemoryRepositories attaches in memory repostories to service.

type RosterService

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

RosterService is a implementation of the RosterService.

func NewRosterService

func NewRosterService() (*RosterService, error)

NewRosterService accepts configs and returns a new service.

func (*RosterService) AddPlayer

func (s *RosterService) AddPlayer(player entity.Person) error

AddPlayer initializes a new player to the repository if valid.

func (*RosterService) AddTeam

func (s *RosterService) AddTeam(team entity.Group) error

AddTeam initializes a new team to the repository if valid.

func (*RosterService) AssignPlayerToTeam

func (s *RosterService) AssignPlayerToTeam(team entity.Group, player entity.Person) error

AssignPlayerToTeam assigns player to team's roster.

func (*RosterService) GetPlayer

func (s *RosterService) GetPlayer(player entity.Person) (PlayerDTO, error)

GetPlayer retrieves the players based on person entity.

func (*RosterService) GetTeam

func (s *RosterService) GetTeam(team entity.Group) (TeamDTO, error)

GetTeam retrieves the team model based on group entity.

func (*RosterService) UnassignPlayerFromTeam

func (s *RosterService) UnassignPlayerFromTeam(team entity.Group, player entity.Person) error

UnassignPlayerToTeam unassigns player from team's roster.

type TeamDTO

type TeamDTO struct {
	Name    string          `json:"name"`
	Players []entity.Person `json:"players"`
}

func NewTeamDTO

func NewTeamDTO(team *model.Team) TeamDTO

Jump to

Keyboard shortcuts

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