diff options
Diffstat (limited to 'backend/models/responses.go')
| -rw-r--r-- | backend/models/responses.go | 54 |
1 files changed, 54 insertions, 0 deletions
diff --git a/backend/models/responses.go b/backend/models/responses.go new file mode 100644 index 0000000..5a88353 --- /dev/null +++ b/backend/models/responses.go | |||
| @@ -0,0 +1,54 @@ | |||
| 1 | package models | ||
| 2 | |||
| 3 | type Response struct { | ||
| 4 | Success bool `json:"success"` | ||
| 5 | Message string `json:"message"` | ||
| 6 | Data any `json:"data"` | ||
| 7 | } | ||
| 8 | |||
| 9 | type LoginResponse struct { | ||
| 10 | Token string `json:"token"` | ||
| 11 | } | ||
| 12 | |||
| 13 | type RankingsResponse struct { | ||
| 14 | RankingsSP []UserRanking `json:"rankings_sp"` | ||
| 15 | RankingsMP []UserRanking `json:"rankings_mp"` | ||
| 16 | } | ||
| 17 | |||
| 18 | type ProfileResponse struct { | ||
| 19 | Profile bool `json:"profile"` | ||
| 20 | SteamID string `json:"steam_id"` | ||
| 21 | UserName string `json:"user_name"` | ||
| 22 | AvatarLink string `json:"avatar_link"` | ||
| 23 | CountryCode string `json:"country_code"` | ||
| 24 | ScoresSP []ScoreResponse `json:"scores_sp"` | ||
| 25 | ScoresMP []ScoreResponse `json:"scores_mp"` | ||
| 26 | } | ||
| 27 | |||
| 28 | type ScoreResponse struct { | ||
| 29 | MapID int `json:"map_id"` | ||
| 30 | Records any `json:"records"` | ||
| 31 | } | ||
| 32 | |||
| 33 | type SearchResponse struct { | ||
| 34 | Players []UserShort `json:"players"` | ||
| 35 | Maps []MapShort `json:"maps"` | ||
| 36 | } | ||
| 37 | |||
| 38 | type ChaptersResponse struct { | ||
| 39 | Game Game `json:"game"` | ||
| 40 | Chapters []Chapter `json:"chapters"` | ||
| 41 | } | ||
| 42 | |||
| 43 | type ChapterMapsResponse struct { | ||
| 44 | Chapter Chapter `json:"chapter"` | ||
| 45 | Maps []MapShort `json:"maps"` | ||
| 46 | } | ||
| 47 | |||
| 48 | func ErrorResponse(message string) Response { | ||
| 49 | return Response{ | ||
| 50 | Success: false, | ||
| 51 | Message: message, | ||
| 52 | Data: nil, | ||
| 53 | } | ||
| 54 | } | ||