aboutsummaryrefslogtreecommitdiff
path: root/backend/models/responses.go
blob: dc554ff64c1395c3c616855ed1bc531de993d573 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
package models

type Response struct {
	Success bool   `json:"success"`
	Message string `json:"message"`
	Data    any    `json:"data"`
}

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

type RankingsResponse struct {
	RankingsSP []UserRanking `json:"rankings_sp"`
	RankingsMP []UserRanking `json:"rankings_mp"`
}

type ProfileResponse struct {
	Profile     bool            `json:"profile"`
	SteamID     string          `json:"steam_id"`
	UserName    string          `json:"user_name"`
	AvatarLink  string          `json:"avatar_link"`
	CountryCode string          `json:"country_code"`
	ScoresSP    []ScoreResponse `json:"scores_sp"`
	ScoresMP    []ScoreResponse `json:"scores_mp"`
}

type ScoreResponse struct {
	MapID   int `json:"map_id"`
	Records any `json:"records"`
}

type MapSummaryResponse struct {
	Map     Map        `json:"map"`
	Summary MapSummary `json:"summary"`
}

type SearchResponse struct {
	Players []UserShort `json:"players"`
	Maps    []MapShort  `json:"maps"`
}

type ChaptersResponse struct {
	Game     Game      `json:"game"`
	Chapters []Chapter `json:"chapters"`
}

type ChapterMapsResponse struct {
	Chapter Chapter    `json:"chapter"`
	Maps    []MapShort `json:"maps"`
}

func ErrorResponse(message string) Response {
	return Response{
		Success: false,
		Message: message,
		Data:    nil,
	}
}