models

package
v1.2.0 Latest Latest
Warning

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

Go to latest
Published: Nov 7, 2020 License: MIT Imports: 0 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// XAuthToken is the name of the header used to pass the authorization token
	XAuthToken = "x-auth-token"
)

Functions

This section is empty.

Types

type ChangeGameStatusRequest

type ChangeGameStatusRequest struct {
	Status   Status            `json:"status,omitempty"`
	Progress *UserGameProgress `json:"progress,omitempty"`
}

type ErrorResponse

type ErrorResponse struct {
	Error string `json:"error,omitempty"`
}

ErrorResponse is the generic error response returned from the API, when an error of any kind occurred.

type Franchise

type Franchise struct {
	ID   string `json:"id"`
	Name string `json:"name"`
}

type FranchisesResponse

type FranchisesResponse struct {
	Franchises []*Franchise `json:"franchises"`
}

type Game

type Game struct {
	ID          string `json:"id"`
	Name        string `json:"name"`
	Franchise   string `json:"franchise"`
	FranshiseID string `json:"franchiseId"`
}

Game is the representation of a game in the database.

type GamesResponse

type GamesResponse struct {
	Games []*Game `json:"games"`
}

type Status

type Status string

Status is the type that represents the status of a game

var (
	// StatusTODO is the To Do status of a game
	StatusTODO Status = "To Do"
	// StatusInProgress is the In progress status of a game
	StatusInProgress Status = "In Progress"
	// StatusDone is the Done status of the game
	StatusDone Status = "Done"

	// AllStatuses is collection of all statuses
	AllStatuses = []Status{
		StatusTODO,
		StatusInProgress,
		StatusDone,
	}
)

type User

type User struct {
	ID             string `json:"id,omitempty"`
	Username       string `json:"username,omitempty"`
	Email          string `json:"email,omitempty"`
	Password       string `json:"password,omitempty"`
	HashedPassword []byte `json:"-"`
}

User is the representation of a user in the database.

type UserGame

type UserGame struct {
	ID       string            `json:"id,omitempty"`
	User     *User             `json:"user,omitempty"`
	Game     *Game             `json:"game,omitempty"`
	Status   Status            `json:"status,omitempty"`
	Progress *UserGameProgress `json:"progress,omitempty"`
}

UserGame is the representation of a user game relation in the database.

type UserGameProgress

type UserGameProgress struct {
	Current int `json:"current,omitempty"`
	Final   int `json:"final,omitempty"`
}

type UserGameRequest

type UserGameRequest struct {
	Game     *Game             `json:"game"`
	Progress *UserGameProgress `json:"progress,omitempty"`
}

type UserGameResponse

type UserGameResponse struct {
	ID     string `json:"id"`
	Game   *Game  `json:"game"`
	Status Status `json:"status"`
}

type UserGamesResponse

type UserGamesResponse struct {
	Games []*Game `json:"games"`
}

type UserLoginResponse

type UserLoginResponse struct {
	Token string `json:"token"`
}

UserLoginResponse is the response that is returned when a user is logged in.

type UserResponse

type UserResponse struct {
	User *User `json:"user"`
}

UserResponse is the response that is returned from the GET /users API

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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