leaderboards

package
v0.0.0-...-fda175b Latest Latest
Warning

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

Go to latest
Published: Jan 8, 2024 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func RegisterRoutes

func RegisterRoutes(
	r *gin.RouterGroup,
	service *LeaderBoardsService,
	memoryStore *persist.MemoryStore,
)

Types

type LeaderBoardType

type LeaderBoardType = int
const (
	TotalGames LeaderBoardType = iota + 1
	TotalDeaths

	Accuracy
	HsAccuracy

	TotalDamage
	MostDamage

	TotalKills
	TotalLargeKills
	TotalHuskRages

	TotalHeals

	AverageZedtime
	TotalPlaytime
)

type LeaderBoardsRequest

type LeaderBoardsRequest struct {
	Type LeaderBoardType `json:"type" binding:"required"`
	Perk int             `json:"perk"`

	From time.Time `json:"date_from" binding:"required"`
	To   time.Time `json:"date_to" binding:"required"`
}

type LeaderBoardsResponse

type LeaderBoardsResponse struct {
	Items []*LeaderBoardsResponseItem `json:"items"`
}

type LeaderBoardsResponseItem

type LeaderBoardsResponseItem struct {
	Id   int    `json:"id"`
	Name string `json:"name"`

	ProfileUrl *string `json:"profile_url"`
	Avatar     *string `json:"avatar"`

	TotalGames  int `json:"total_games"`
	TotalDeaths int `json:"total_deaths"`

	Accuracy   float64 `json:"accuracy"`
	HSAccuracy float64 `json:"hs_accuracy"`

	TotalDamage int              `json:"total_damage"`
	MostDamage  *MostDamageMatch `json:"most_damage"`

	TotalKills      int `json:"total_kills"`
	TotalLargeKills int `json:"total_large_kills"`
	TotalHuskRages  int `json:"total_husk_rages"`

	TotalHeals     int     `json:"total_heals"`
	AverageZedtime float64 `json:"avg_zt"`

	TotalPlaytime int `json:"total_playtime"`

	AuthId string          `json:"-"`
	Type   models.AuthType `json:"-"`
}

type LeaderBoardsService

type LeaderBoardsService struct {
	// contains filtered or unexported fields
}

func NewLeaderBoardsService

func NewLeaderBoardsService(db *sql.DB) *LeaderBoardsService

func (*LeaderBoardsService) Inject

func (s *LeaderBoardsService) Inject(
	userService *users.UserService,
)

type MostDamageMatch

type MostDamageMatch struct {
	SessionId int     `json:"session_id"`
	Value     float64 `json:"value"`
}

Jump to

Keyboard shortcuts

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