You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

61 lines
1.5 KiB
Go

package leaderboard
import (
"time"
domain "knowfoolery/backend/services/leaderboard-service/internal/domain/leaderboard"
sharedtypes "knowfoolery/backend/shared/domain/types"
)
// UpdateScoreInput is the internal score ingestion payload.
type UpdateScoreInput struct {
SessionID string
PlayerID string
PlayerName string
TotalScore int
QuestionsAsked int
QuestionsCorrect int
HintsUsed int
DurationSeconds int
CompletedAt time.Time
CompletionType string
}
// GetTopInput captures top leaderboard query options.
type GetTopInput struct {
CompletionType string
Window domain.Window
}
// GetPlayerRankingInput captures player ranking query.
type GetPlayerRankingInput struct {
PlayerID string
Pagination sharedtypes.Pagination
}
// GetStatsInput captures global stats query options.
type GetStatsInput struct {
CompletionType string
Window domain.Window
}
// RankedEntry is one ranked leaderboard line.
type RankedEntry struct {
Rank int `json:"rank"`
Entry domain.LeaderboardEntry `json:"entry"`
}
// Top10Result returns top entries.
type Top10Result struct {
Items []RankedEntry `json:"items"`
}
// PlayerRankingResult returns player rank and history.
type PlayerRankingResult struct {
Player domain.PlayerStats `json:"player"`
Rank int64 `json:"rank"`
History []domain.LeaderboardEntry `json:"history"`
Pagination sharedtypes.Pagination `json:"pagination"`
Total int64 `json:"total"`
}