models

package
v0.0.0-...-af09e16 Latest Latest
Warning

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

Go to latest
Published: May 27, 2024 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Overview

for one fixture

Index

Constants

This section is empty.

Variables

View Source
var DB *gorm.DB

Functions

func InitDB

func InitDB(cfg Config)

Types

type Claims

type Claims struct {
	Role string `json:"role"`
	jwt.StandardClaims
}

It will include the standard claims defined by the JWT specification, as well as a field for the user's role within the application.

func ParseToken

func ParseToken(tokenString string) (claims *Claims, err error)

type Config

type Config struct {
	Host     string
	Port     string
	User     string
	Password string
	DBName   string
	SSLMode  string
}

type CurrentGameweekResponse

type CurrentGameweekResponse struct {
	Fixture     Fixture1    `json:"fixture"`
	League      League      `json:"league"`
	GoalsScored GoalsScored `json:"goals"`
	Teams       Teams       `json:"teams"`
}

type Fixture1

type Fixture1 struct {
	Id        int    `json:"id"`
	Date      string `json:"date"`
	Timestamp int    `json:"timestamp"`
	Status    Status `json:"status"`
}

type FixtureResponse

type FixtureResponse struct {
	Team       Team        `json:"team"`
	Statistics []Statistic `json:"statistics"`
}

type FullFixtureResponse

type FullFixtureResponse struct {
	Get      string            `json:"get"`
	Errors   []interface{}     `json:"errors"`
	Results  int               `json:"results"`
	Paging   map[string]int    `json:"paging"`
	Response []FixtureResponse `json:"response"`
}

type FullLeagueResponse

type FullLeagueResponse struct {
	Get      string           `json:"get"`
	Results  int              `json:"results"`
	Paging   map[string]int   `json:"paging"`
	Response []LeagueResponse `json:"response"`
}

type FullResponseGameweek

type FullResponseGameweek struct {
	Get      string                    `json:"get"`
	Results  int                       `json:"results"`
	Paging   map[string]int            `json:"paging"`
	Response []CurrentGameweekResponse `json:"response"`
}

used in both current and next fixtures controller

type FullStandingsResponse

type FullStandingsResponse struct {
	Get      string              `json:"get"`
	Results  int                 `json:"results"`
	Paging   map[string]int      `json:"paging"`
	Response []StandingsResponse `json:"response"`
}

type Game

type Game struct {
	gorm.Model
	Id        int    `gorm:"primaryKey" json:"id"`
	Date      string ` json:"date"`
	Status    string `json:"status"`
	Timestamp int    `json:"timestamp"`
	HomeTeam  string `json:"homeTeam"`
	AwayTeam  string `json:"awayTeam"`
	HomeGoals int    `json:"homeGoals"`
	AwayGoals int    `json:"awayGoals"`
}

type GoalsScored

type GoalsScored struct {
	Home int `json:"home"`
	Away int `json:"away"`
}

type League

type League struct {
	ID        int           `json:"id"`
	Name      string        `json:"name"`
	Country   string        `json:"country"`
	Flag      string        `json:"flag"`
	Season    int           `json:"season"`
	Standings []StandingRow `json:"standings"` // Note: changed to a 2D slice of StandingRow
}

type LeagueResponse

type LeagueResponse struct {
	Team Team `json:"team"`
}

type Standing

type Standing struct {
	gorm.Model
	ID        int  `gorm:"primaryKey" json:"id"`
	Rank      int  `json:"rank"`
	Team      Team `json:"team" gorm:"embedded"`
	Points    int  `json:"points"`
	GoalsDiff int  `json:"goalsDiff"`
}

type StandingRow

type StandingRow []Standing

type StandingsResponse

type StandingsResponse struct {
	League League `json:"league"`
}

type Statistic

type Statistic struct {
	Type  string      `json:"type"`
	Value interface{} `json:"value"`
}

structs for singular fixture

type Status

type Status struct {
	LongVersion  string `json:"long"`
	ShortVersion string `json:"short"`
}

type Team

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

type Teams

type Teams struct {
	Home Team `json:"home"`
	Away Team `json:"away"`
}

type Ticket

type Ticket struct {
	gorm.Model
	UserId        uint
	GameId        uint
	HomeTeam      string
	AwayTeam      string
	Seat          string
	Price         float32
	BookingStatus string
}

type User

type User struct {
	gorm.Model
	Name     string `json:"name"`
	Email    string `gorm:"unique" json:"email"`
	Password string `json:"password"`
	Role     string `json:"role"`
}

Jump to

Keyboard shortcuts

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