aboutsummaryrefslogtreecommitdiff
path: root/backend/models/responses.go
diff options
context:
space:
mode:
authorNidboj132 <lol2s@vp.plm>2023-07-12 17:58:23 +0200
committerNidboj132 <lol2s@vp.plm>2023-07-12 17:58:23 +0200
commit781289455037431d8adbaa0b293b755c88169747 (patch)
tree773824f97c3b21d353b9066afdbde30bee2da4c5 /backend/models/responses.go
parentsummary (diff)
parentfix: 0 score count / showcase not required (#47) (diff)
downloadlphub-781289455037431d8adbaa0b293b755c88169747.tar.gz
lphub-781289455037431d8adbaa0b293b755c88169747.tar.bz2
lphub-781289455037431d8adbaa0b293b755c88169747.zip
Merge branch 'main' of https://github.com/pektezol/LeastPortals
Former-commit-id: af8d8680aafc3d662f8b53a4f50f0ea356b26c26
Diffstat (limited to '')
-rw-r--r--backend/models/responses.go64
1 files changed, 64 insertions, 0 deletions
diff --git a/backend/models/responses.go b/backend/models/responses.go
new file mode 100644
index 0000000..459911c
--- /dev/null
+++ b/backend/models/responses.go
@@ -0,0 +1,64 @@
1package models
2
3type Response struct {
4 Success bool `json:"success"`
5 Message string `json:"message"`
6 Data any `json:"data"`
7}
8
9type LoginResponse struct {
10 Token string `json:"token"`
11}
12
13type RankingsResponse struct {
14 RankingsSP []UserRanking `json:"rankings_sp"`
15 RankingsMP []UserRanking `json:"rankings_mp"`
16}
17
18type 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
28type ScoreResponse struct {
29 MapID int `json:"map_id"`
30 Records any `json:"records"`
31}
32
33type MapSummaryResponse struct {
34 Map Map `json:"map"`
35 Summary MapSummary `json:"summary"`
36}
37
38type SearchResponse struct {
39 Players []UserShort `json:"players"`
40 Maps []MapShort `json:"maps"`
41}
42
43type ChaptersResponse struct {
44 Game Game `json:"game"`
45 Chapters []Chapter `json:"chapters"`
46}
47
48type ChapterMapsResponse struct {
49 Chapter Chapter `json:"chapter"`
50 Maps []MapShort `json:"maps"`
51}
52
53type RecordResponse struct {
54 ScoreCount int `json:"score_count"`
55 ScoreTime int `json:"score_time"`
56}
57
58func ErrorResponse(message string) Response {
59 return Response{
60 Success: false,
61 Message: message,
62 Data: nil,
63 }
64}