Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Authenticator ¶
type Authenticator interface { DecodeToken(token string) (*models.User, error) NewTokenForUser(user *models.User) (string, error) }
Authenticator is the interface to interact with the Authenticator (DB, OIDC provider, etc.)
type FranchiseModel ¶
type FranchiseModel interface { Insert(franchise *models.Franchise) (*models.Franchise, error) All(userID string) ([]*models.Franchise, error) }
FranchiseModel is the interface to interact with the Franchise provider (DB, service, etc.)
type GameModel ¶
type GameModel interface { AllForUser(userID string) ([]*models.Game, error) Get(id string) (*models.Game, error) Insert(game *models.Game) (*models.Game, error) DeleteGame(userID, gameID string) error ChangeGameStatus(userID, gameID string, status models.Status) error ChangeGameProgress(userID, gameID string, progress *models.GameProgress) error }
GameModel is the interface to interact with the Games provider (DB, service, etc.)
type GamePatchRequest ¶
type GamePatchRequest struct {
Status string `json:"status"`
}
type Options ¶
type Options struct { Log *logrus.Logger Authenticator GameModel UserModel FranchiseModel }
Options is the struct used to construct a server
type Server ¶
type Server struct { Log *logrus.Logger Authenticator GameModel UserModel FranchiseModel }
Server is the struct that holds all the dependencies needed to run the application
func New ¶
New returns a new Server, based on opts. It also validates the arguments and can return an error if it receives options that are not right.
type UserGamesModel ¶
type UserGamesModel interface { LinkGameToUser(userID, gameID string, progress *models.GameProgress) error ChangeGameStatus(userID, userGameID string, status models.Status) error ChangeGameProgress(userID, userGameID string, progress *models.GameProgress) error GetAvailableGamesFor(userID string) ([]*models.Game, error) DeleteUserGame(userGameID string) error }
UserGamesModel is the interface to interact with the Users-Games relationship provider (DB, service, etc.)
type UserModel ¶
type UserModel interface { Insert(user *models.User) (*models.User, error) Authenticate(email, password string) (*models.User, error) AssociateTokenWithUser(userID, token string) error InvalidateToken(userID, token string) error GetUserByToken(token string) (*models.User, error) }
UserModel is the interface to interact with the User provider (DB, service, etc.)