structs

package
v0.0.0-...-a72ac3c Latest Latest
Warning

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

Go to latest
Published: Feb 27, 2022 License: AGPL-3.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ValidStaff

func ValidStaff(staff StaffPost) error

Types

type BanchoMe

type BanchoMe struct {
	Id       int    `json:"id ,omitempty"`
	Username string `json:"username ,omitempty"`
}

type BeatmapSubmittion

type BeatmapSubmittion struct {
	JsonModel
	Round        *Round `json:"round,omitempty"`
	RoundId      uint   `json:"-"`
	User         *User  `json:"user,omitempty"`
	UserId       uint   `json:"-"`
	Hash         string `json:"hash,omitempty"`
	DownloadPath string `json:"download_path,omitempty"`
	ToUse        bool   `json:"to_use"`
}

type Config

type Config struct {
	POSTGRES_USER     string
	POSTGRES_PASSWORD string
	POSTGRES_DB       string
	POSTGRES_URL      string
}

type JsonModel

type JsonModel struct {
	ID        uint           `gorm:"primarykey" json:"id"`
	CreatedAt time.Time      `json:"-"`
	UpdatedAt time.Time      `json:"-"`
	DeletedAt gorm.DeletedAt `gorm:"index" json:"-"`
}

type RequestFilter

type RequestFilter struct {
	Limit  int `json:"Limit"`
	Offset int `json:"offset"`
}

type RippleSelf

type RippleSelf struct {
	Code     int    `json:"code"`
	Message  string `json:"message"`
	UserId   int    `json:"id"`
	Username string `json:"username"`
}

type Round

type Round struct {
	JsonModel
	TournamentId int       `json:"tournament_id,omitempty"`
	Name         string    `json:"name,omitempty"`
	Description  string    `json:"description,omitempty"`
	Active       bool      `json:"active"`
	DownloadPath string    `json:"download_path,omitempty"`
	StartTime    time.Time `json:"start_time,omitempty"`
	EndTime      time.Time `json:"end_time,omitempty"`
}

func (Round) RoundExist

func (t Round) RoundExist(localDB *gorm.DB) error

func (Round) ValidRound

func (t Round) ValidRound(localDB *gorm.DB) error

type Session

type Session struct {
	JsonModel
	UserId       uint   `gorm:"not null" json:"-"`
	SessionToken string `gorm:"type:text" json:",omitempty"`
	AccessToken  string `gorm:"type:text" json:",omitempty"`
	RefreshToken string `gorm:"type:text" json:",omitempty"`
}

type Staff

type Staff struct {
	JsonModel
	TournamentId uint   `json:"tournament_id,omitempty"`
	User         *User  `json:"user,omitempty"`
	UserId       uint   `json:"-"`
	Role         string `json:"role"`
}

type StaffPost

type StaffPost struct {
	Role   string `json:"role"`
	UserId uint   `json:"user_id"`
}

type Tournament

type Tournament struct {
	JsonModel
	Name                  string    `json:"name,omitempty" gorm:"unique"`
	Description           string    `json:"description,omitempty"`
	StartTime             time.Time `json:"start_time,omitempty"`
	EndTime               time.Time `json:"end_time,omitempty"`
	RegistrationStartTime time.Time `json:"registration_start_time,omitempty"`
	RegistrationEndTime   time.Time `json:"registration_end_time,omitempty"`
	Rounds                []Round   `json:"rounds,omitempty"`
	Staffs                []Staff   `json:"staffs,omitempty" gorm:"many2many:tournament_staff"`
	Registrations         []User    `json:"registrations,omitempty" gorm:"many2many:tournament_registrations"`
	Visible               bool      `json:"-"`
}

func (*Tournament) ActivateRound

func (t *Tournament) ActivateRound(name string) error

func (Tournament) GetBeatmapsForJudge

func (t Tournament) GetBeatmapsForJudge(localDB *gorm.DB, round_name string) ([]BeatmapSubmittion, error)

func (Tournament) GetBeatmapsForUser

func (t Tournament) GetBeatmapsForUser(localDB *gorm.DB, user_id uint, round_name string) ([]BeatmapSubmittion, error)

func (Tournament) IsRegistered

func (t Tournament) IsRegistered(localDB *gorm.DB, user_id uint) error

func (Tournament) RegistrationsOpen

func (t Tournament) RegistrationsOpen() error

func (Tournament) TournamentExists

func (t Tournament) TournamentExists(localDB *gorm.DB) error

func (Tournament) ValidTournament

func (t Tournament) ValidTournament(localDB *gorm.DB) error

type User

type User struct {
	JsonModel
	RippleId int       `json:"ripple_id,omitempty" gorm:"unique"`
	Username string    `json:"username,omitempty" gorm:"unique"`
	Sessions []Session `json:"sessions,omitempty"`
}

func (User) OwnsMap

func (u User) OwnsMap(localDB *gorm.DB, to_delete uint) (BeatmapSubmittion, error)

Jump to

Keyboard shortcuts

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