handlers

package
v0.0.0-...-3b1adbd Latest Latest
Warning

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

Go to latest
Published: Dec 12, 2019 License: MIT Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AuthHandler

type AuthHandler struct {
	DB DatabaseAuthService
	// contains filtered or unexported fields
}

AuthHandler is an authentication API request handler

func NewAuthHandler

func NewAuthHandler(authKey string, db DatabaseAuthService) *AuthHandler

NewAuthHandler creates a new authentication API request handler

func (*AuthHandler) Authenticate

func (h *AuthHandler) Authenticate(tokenString string) (interface{}, error)

Authenticate validates a JWT

func (*AuthHandler) HandleLogin

func (h *AuthHandler) HandleLogin(params auth.PostLoginParams) middleware.Responder

HandleLogin checks user credentials and issues a JWT

func (*AuthHandler) HandleRegistration

func (h *AuthHandler) HandleRegistration(params auth.PostRegisterParams) middleware.Responder

type DatabaseAuthService

type DatabaseAuthService interface {
	AddUser(c dbModels.Credentials) error
	GetUser(login string) (*dbModels.Credentials, error)
}

DatabaseService is a abstract database layer interface

type DatabaseRosterService

type DatabaseRosterService interface {
	GetAllRosters() ([]dbModels.Roster, error)
	GetRoster(id int64) (*dbModels.Roster, error)
	PushPlayer(id int64, p dbModels.Player) error
	UpdateRoster(dbModels.Roster) error
}

DatabaseRosterService is a abstract database layer interface

type IDGeneratorFunc

type IDGeneratorFunc func() int64

func (IDGeneratorFunc) Generate

func (g IDGeneratorFunc) Generate() int64

type RosterHandler

type RosterHandler struct {
	DB    DatabaseRosterService
	IDGen IDGeneratorFunc
}

RosterHandler is a handler for roster API requests

func NewRosterHandler

func NewRosterHandler(db DatabaseRosterService) *RosterHandler

NewRosterHandler creates a new web API handler

func (*RosterHandler) AddPayer

func (h *RosterHandler) AddPayer(params player.PostRostersIDAddPlayerParams, _ interface{}) middleware.Responder

AddPayer adds a player to the roster

func (*RosterHandler) GetRosterActive

GetRosterActive returns a certain roster with active players

func (*RosterHandler) GetRosterAll

func (h *RosterHandler) GetRosterAll(params roster.GetRostersParams) middleware.Responder

GetRosterAll returns a list of all rosters

func (*RosterHandler) GetRosterBenched

GetRosterBenched returns a certain roster with benched players

func (*RosterHandler) GetRosterOne

GetRosterOne returns a certain roster

func (*RosterHandler) RearrangeRoster

func (h *RosterHandler) RearrangeRoster(params player.PostRostersIDRearrangeParams, _ interface{}) middleware.Responder

RearrangeRoster rearranges players in a certain roster

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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