diff options
| author | Nidboj132 <lol2s@vp.plm> | 2023-09-05 18:23:11 +0200 |
|---|---|---|
| committer | Nidboj132 <lol2s@vp.plm> | 2023-09-05 18:23:11 +0200 |
| commit | 3869cb67351ccf3bc45b076f31afdc7133292c39 (patch) | |
| tree | dc03341e147dde0964bf6be84b14e13424c647b7 /backend/models/models.go | |
| parent | added graph and fixed some css (diff) | |
| parent | fix: create map summary, why the fuck does this have to be a pointer integer?? (diff) | |
| download | lphub-3869cb67351ccf3bc45b076f31afdc7133292c39.tar.gz lphub-3869cb67351ccf3bc45b076f31afdc7133292c39.tar.bz2 lphub-3869cb67351ccf3bc45b076f31afdc7133292c39.zip | |
Merge branch 'main' of https://github.com/pektezol/LeastPortalsHub
Former-commit-id: 221385f463b7f5b0fc43a093b2c7c46e68d46d68
Diffstat (limited to 'backend/models/models.go')
| -rw-r--r-- | backend/models/models.go | 63 |
1 files changed, 33 insertions, 30 deletions
diff --git a/backend/models/models.go b/backend/models/models.go index 1231cb1..2d54295 100644 --- a/backend/models/models.go +++ b/backend/models/models.go | |||
| @@ -4,6 +4,20 @@ import ( | |||
| 4 | "time" | 4 | "time" |
| 5 | ) | 5 | ) |
| 6 | 6 | ||
| 7 | type Response struct { | ||
| 8 | Success bool `json:"success"` | ||
| 9 | Message string `json:"message"` | ||
| 10 | Data any `json:"data"` | ||
| 11 | } | ||
| 12 | |||
| 13 | func ErrorResponse(message string) Response { | ||
| 14 | return Response{ | ||
| 15 | Success: false, | ||
| 16 | Message: message, | ||
| 17 | Data: nil, | ||
| 18 | } | ||
| 19 | } | ||
| 20 | |||
| 7 | type User struct { | 21 | type User struct { |
| 8 | SteamID string `json:"steam_id"` | 22 | SteamID string `json:"steam_id"` |
| 9 | UserName string `json:"user_name"` | 23 | UserName string `json:"user_name"` |
| @@ -11,7 +25,7 @@ type User struct { | |||
| 11 | CountryCode string `json:"country_code"` | 25 | CountryCode string `json:"country_code"` |
| 12 | CreatedAt time.Time `json:"created_at"` | 26 | CreatedAt time.Time `json:"created_at"` |
| 13 | UpdatedAt time.Time `json:"updated_at"` | 27 | UpdatedAt time.Time `json:"updated_at"` |
| 14 | Titles []string `json:"titles"` | 28 | Titles []Title `json:"titles"` |
| 15 | } | 29 | } |
| 16 | 30 | ||
| 17 | type UserShort struct { | 31 | type UserShort struct { |
| @@ -19,6 +33,12 @@ type UserShort struct { | |||
| 19 | UserName string `json:"user_name"` | 33 | UserName string `json:"user_name"` |
| 20 | } | 34 | } |
| 21 | 35 | ||
| 36 | type UserShortWithAvatar struct { | ||
| 37 | SteamID string `json:"steam_id"` | ||
| 38 | UserName string `json:"user_name"` | ||
| 39 | AvatarLink string `json:"avatar_link"` | ||
| 40 | } | ||
| 41 | |||
| 22 | type Map struct { | 42 | type Map struct { |
| 23 | ID int `json:"id"` | 43 | ID int `json:"id"` |
| 24 | GameName string `json:"game_name"` | 44 | GameName string `json:"game_name"` |
| @@ -57,9 +77,8 @@ type MapRecords struct { | |||
| 57 | } | 77 | } |
| 58 | 78 | ||
| 59 | type UserRanking struct { | 79 | type UserRanking struct { |
| 60 | UserID string `json:"user_id"` | 80 | User UserShort `json:"user"` |
| 61 | UserName string `json:"user_name"` | 81 | TotalScore int `json:"total_score"` |
| 62 | TotalScore int `json:"total_score"` | ||
| 63 | } | 82 | } |
| 64 | 83 | ||
| 65 | type Game struct { | 84 | type Game struct { |
| @@ -78,32 +97,16 @@ type Category struct { | |||
| 78 | Name string `json:"name"` | 97 | Name string `json:"name"` |
| 79 | } | 98 | } |
| 80 | 99 | ||
| 81 | type RecordSP struct { | 100 | type Title struct { |
| 82 | RecordID int `json:"record_id"` | 101 | Name string `json:"name"` |
| 83 | Placement int `json:"placement"` | 102 | Color string `json:"color"` |
| 84 | UserID string `json:"user_id"` | 103 | } |
| 85 | UserName string `json:"user_name"` | 104 | |
| 86 | UserAvatar string `json:"user_avatar"` | 105 | type Links struct { |
| 87 | ScoreCount int `json:"score_count"` | 106 | P2SR string `json:"p2sr"` |
| 88 | ScoreTime int `json:"score_time"` | 107 | Steam string `json:"stream"` |
| 89 | DemoID string `json:"demo_id"` | 108 | YouTube string `json:"youtube"` |
| 90 | RecordDate time.Time `json:"record_date"` | 109 | Twitch string `json:"twitch"` |
| 91 | } | ||
| 92 | |||
| 93 | type RecordMP struct { | ||
| 94 | RecordID int `json:"record_id"` | ||
| 95 | Placement int `json:"placement"` | ||
| 96 | HostID string `json:"host_id"` | ||
| 97 | HostName string `json:"host_name"` | ||
| 98 | HostAvatar string `json:"host_avatar"` | ||
| 99 | PartnerID string `json:"partner_id"` | ||
| 100 | PartnerName string `json:"partner_name"` | ||
| 101 | PartnerAvatar string `json:"partner_avatar"` | ||
| 102 | ScoreCount int `json:"score_count"` | ||
| 103 | ScoreTime int `json:"score_time"` | ||
| 104 | HostDemoID string `json:"host_demo_id"` | ||
| 105 | PartnerDemoID string `json:"partner_demo_id"` | ||
| 106 | RecordDate time.Time `json:"record_date"` | ||
| 107 | } | 110 | } |
| 108 | 111 | ||
| 109 | type PlayerSummaries struct { | 112 | type PlayerSummaries struct { |