diff options
| author | Arda Serdar Pektezol <1669855+pektezol@users.noreply.github.com> | 2023-08-25 23:41:13 +0300 |
|---|---|---|
| committer | Arda Serdar Pektezol <1669855+pektezol@users.noreply.github.com> | 2023-08-25 23:41:13 +0300 |
| commit | ba09abbe6a8d0c1f3a54c8c7426eda7b930e1447 (patch) | |
| tree | 296837f577a86a042a16cd006a96c523cbcedcf5 | |
| parent | feat: better score handling in profiles (#51) (diff) | |
| download | lphub-ba09abbe6a8d0c1f3a54c8c7426eda7b930e1447.tar.gz lphub-ba09abbe6a8d0c1f3a54c8c7426eda7b930e1447.tar.bz2 lphub-ba09abbe6a8d0c1f3a54c8c7426eda7b930e1447.zip | |
docs: profile improvement swagger (#51)
Former-commit-id: ff35be478c4f29c611c40fa34ca5d134e970cc16
| -rw-r--r-- | docs/docs.go | 137 | ||||
| -rw-r--r-- | docs/swagger.json | 137 | ||||
| -rw-r--r-- | docs/swagger.yaml | 93 | ||||
| -rw-r--r-- | main.go | 4 |
4 files changed, 319 insertions, 52 deletions
diff --git a/docs/docs.go b/docs/docs.go index df01379..d0c78ac 100644 --- a/docs/docs.go +++ b/docs/docs.go | |||
| @@ -1158,6 +1158,68 @@ const docTemplate = `{ | |||
| 1158 | } | 1158 | } |
| 1159 | } | 1159 | } |
| 1160 | }, | 1160 | }, |
| 1161 | "controllers.ProfileRankings": { | ||
| 1162 | "type": "object", | ||
| 1163 | "properties": { | ||
| 1164 | "cooperative": { | ||
| 1165 | "$ref": "#/definitions/controllers.ProfileRankingsDetails" | ||
| 1166 | }, | ||
| 1167 | "overall": { | ||
| 1168 | "$ref": "#/definitions/controllers.ProfileRankingsDetails" | ||
| 1169 | }, | ||
| 1170 | "singleplayer": { | ||
| 1171 | "$ref": "#/definitions/controllers.ProfileRankingsDetails" | ||
| 1172 | } | ||
| 1173 | } | ||
| 1174 | }, | ||
| 1175 | "controllers.ProfileRankingsDetails": { | ||
| 1176 | "type": "object", | ||
| 1177 | "properties": { | ||
| 1178 | "completion_count": { | ||
| 1179 | "type": "integer" | ||
| 1180 | }, | ||
| 1181 | "completion_total": { | ||
| 1182 | "type": "integer" | ||
| 1183 | }, | ||
| 1184 | "rank": { | ||
| 1185 | "type": "integer" | ||
| 1186 | } | ||
| 1187 | } | ||
| 1188 | }, | ||
| 1189 | "controllers.ProfileRecords": { | ||
| 1190 | "type": "object", | ||
| 1191 | "properties": { | ||
| 1192 | "portal2_cooperative": { | ||
| 1193 | "type": "array", | ||
| 1194 | "items": { | ||
| 1195 | "$ref": "#/definitions/controllers.ProfileRecordsDetails" | ||
| 1196 | } | ||
| 1197 | }, | ||
| 1198 | "portal2_singleplayer": { | ||
| 1199 | "type": "array", | ||
| 1200 | "items": { | ||
| 1201 | "$ref": "#/definitions/controllers.ProfileRecordsDetails" | ||
| 1202 | } | ||
| 1203 | } | ||
| 1204 | } | ||
| 1205 | }, | ||
| 1206 | "controllers.ProfileRecordsDetails": { | ||
| 1207 | "type": "object", | ||
| 1208 | "properties": { | ||
| 1209 | "map_id": { | ||
| 1210 | "type": "integer" | ||
| 1211 | }, | ||
| 1212 | "map_name": { | ||
| 1213 | "type": "string" | ||
| 1214 | }, | ||
| 1215 | "scores": { | ||
| 1216 | "type": "array", | ||
| 1217 | "items": { | ||
| 1218 | "$ref": "#/definitions/controllers.ProfileScores" | ||
| 1219 | } | ||
| 1220 | } | ||
| 1221 | } | ||
| 1222 | }, | ||
| 1161 | "controllers.ProfileResponse": { | 1223 | "controllers.ProfileResponse": { |
| 1162 | "type": "object", | 1224 | "type": "object", |
| 1163 | "properties": { | 1225 | "properties": { |
| @@ -1167,26 +1229,46 @@ const docTemplate = `{ | |||
| 1167 | "country_code": { | 1229 | "country_code": { |
| 1168 | "type": "string" | 1230 | "type": "string" |
| 1169 | }, | 1231 | }, |
| 1232 | "links": { | ||
| 1233 | "$ref": "#/definitions/models.Links" | ||
| 1234 | }, | ||
| 1170 | "profile": { | 1235 | "profile": { |
| 1171 | "type": "boolean" | 1236 | "type": "boolean" |
| 1172 | }, | 1237 | }, |
| 1173 | "scores_mp": { | 1238 | "rankings": { |
| 1174 | "type": "array", | 1239 | "$ref": "#/definitions/controllers.ProfileRankings" |
| 1175 | "items": { | 1240 | }, |
| 1176 | "$ref": "#/definitions/controllers.ScoreResponse" | 1241 | "records": { |
| 1177 | } | 1242 | "$ref": "#/definitions/controllers.ProfileRecords" |
| 1178 | }, | 1243 | }, |
| 1179 | "scores_sp": { | 1244 | "steam_id": { |
| 1245 | "type": "string" | ||
| 1246 | }, | ||
| 1247 | "titles": { | ||
| 1180 | "type": "array", | 1248 | "type": "array", |
| 1181 | "items": { | 1249 | "items": { |
| 1182 | "$ref": "#/definitions/controllers.ScoreResponse" | 1250 | "$ref": "#/definitions/models.Title" |
| 1183 | } | 1251 | } |
| 1184 | }, | 1252 | }, |
| 1185 | "steam_id": { | 1253 | "user_name": { |
| 1254 | "type": "string" | ||
| 1255 | } | ||
| 1256 | } | ||
| 1257 | }, | ||
| 1258 | "controllers.ProfileScores": { | ||
| 1259 | "type": "object", | ||
| 1260 | "properties": { | ||
| 1261 | "date": { | ||
| 1186 | "type": "string" | 1262 | "type": "string" |
| 1187 | }, | 1263 | }, |
| 1188 | "user_name": { | 1264 | "demo_id": { |
| 1189 | "type": "string" | 1265 | "type": "string" |
| 1266 | }, | ||
| 1267 | "score_count": { | ||
| 1268 | "type": "integer" | ||
| 1269 | }, | ||
| 1270 | "score_time": { | ||
| 1271 | "type": "integer" | ||
| 1190 | } | 1272 | } |
| 1191 | } | 1273 | } |
| 1192 | }, | 1274 | }, |
| @@ -1218,15 +1300,6 @@ const docTemplate = `{ | |||
| 1218 | } | 1300 | } |
| 1219 | } | 1301 | } |
| 1220 | }, | 1302 | }, |
| 1221 | "controllers.ScoreResponse": { | ||
| 1222 | "type": "object", | ||
| 1223 | "properties": { | ||
| 1224 | "map_id": { | ||
| 1225 | "type": "integer" | ||
| 1226 | }, | ||
| 1227 | "records": {} | ||
| 1228 | } | ||
| 1229 | }, | ||
| 1230 | "controllers.SearchResponse": { | 1303 | "controllers.SearchResponse": { |
| 1231 | "type": "object", | 1304 | "type": "object", |
| 1232 | "properties": { | 1305 | "properties": { |
| @@ -1280,6 +1353,23 @@ const docTemplate = `{ | |||
| 1280 | } | 1353 | } |
| 1281 | } | 1354 | } |
| 1282 | }, | 1355 | }, |
| 1356 | "models.Links": { | ||
| 1357 | "type": "object", | ||
| 1358 | "properties": { | ||
| 1359 | "p2sr": { | ||
| 1360 | "type": "string" | ||
| 1361 | }, | ||
| 1362 | "stream": { | ||
| 1363 | "type": "string" | ||
| 1364 | }, | ||
| 1365 | "twitch": { | ||
| 1366 | "type": "string" | ||
| 1367 | }, | ||
| 1368 | "youtube": { | ||
| 1369 | "type": "string" | ||
| 1370 | } | ||
| 1371 | } | ||
| 1372 | }, | ||
| 1283 | "models.Map": { | 1373 | "models.Map": { |
| 1284 | "type": "object", | 1374 | "type": "object", |
| 1285 | "properties": { | 1375 | "properties": { |
| @@ -1380,6 +1470,17 @@ const docTemplate = `{ | |||
| 1380 | } | 1470 | } |
| 1381 | } | 1471 | } |
| 1382 | }, | 1472 | }, |
| 1473 | "models.Title": { | ||
| 1474 | "type": "object", | ||
| 1475 | "properties": { | ||
| 1476 | "color": { | ||
| 1477 | "type": "string" | ||
| 1478 | }, | ||
| 1479 | "name": { | ||
| 1480 | "type": "string" | ||
| 1481 | } | ||
| 1482 | } | ||
| 1483 | }, | ||
| 1383 | "models.UserRanking": { | 1484 | "models.UserRanking": { |
| 1384 | "type": "object", | 1485 | "type": "object", |
| 1385 | "properties": { | 1486 | "properties": { |
diff --git a/docs/swagger.json b/docs/swagger.json index 0f3dade..cf37a5a 100644 --- a/docs/swagger.json +++ b/docs/swagger.json | |||
| @@ -1151,6 +1151,68 @@ | |||
| 1151 | } | 1151 | } |
| 1152 | } | 1152 | } |
| 1153 | }, | 1153 | }, |
| 1154 | "controllers.ProfileRankings": { | ||
| 1155 | "type": "object", | ||
| 1156 | "properties": { | ||
| 1157 | "cooperative": { | ||
| 1158 | "$ref": "#/definitions/controllers.ProfileRankingsDetails" | ||
| 1159 | }, | ||
| 1160 | "overall": { | ||
| 1161 | "$ref": "#/definitions/controllers.ProfileRankingsDetails" | ||
| 1162 | }, | ||
| 1163 | "singleplayer": { | ||
| 1164 | "$ref": "#/definitions/controllers.ProfileRankingsDetails" | ||
| 1165 | } | ||
| 1166 | } | ||
| 1167 | }, | ||
| 1168 | "controllers.ProfileRankingsDetails": { | ||
| 1169 | "type": "object", | ||
| 1170 | "properties": { | ||
| 1171 | "completion_count": { | ||
| 1172 | "type": "integer" | ||
| 1173 | }, | ||
| 1174 | "completion_total": { | ||
| 1175 | "type": "integer" | ||
| 1176 | }, | ||
| 1177 | "rank": { | ||
| 1178 | "type": "integer" | ||
| 1179 | } | ||
| 1180 | } | ||
| 1181 | }, | ||
| 1182 | "controllers.ProfileRecords": { | ||
| 1183 | "type": "object", | ||
| 1184 | "properties": { | ||
| 1185 | "portal2_cooperative": { | ||
| 1186 | "type": "array", | ||
| 1187 | "items": { | ||
| 1188 | "$ref": "#/definitions/controllers.ProfileRecordsDetails" | ||
| 1189 | } | ||
| 1190 | }, | ||
| 1191 | "portal2_singleplayer": { | ||
| 1192 | "type": "array", | ||
| 1193 | "items": { | ||
| 1194 | "$ref": "#/definitions/controllers.ProfileRecordsDetails" | ||
| 1195 | } | ||
| 1196 | } | ||
| 1197 | } | ||
| 1198 | }, | ||
| 1199 | "controllers.ProfileRecordsDetails": { | ||
| 1200 | "type": "object", | ||
| 1201 | "properties": { | ||
| 1202 | "map_id": { | ||
| 1203 | "type": "integer" | ||
| 1204 | }, | ||
| 1205 | "map_name": { | ||
| 1206 | "type": "string" | ||
| 1207 | }, | ||
| 1208 | "scores": { | ||
| 1209 | "type": "array", | ||
| 1210 | "items": { | ||
| 1211 | "$ref": "#/definitions/controllers.ProfileScores" | ||
| 1212 | } | ||
| 1213 | } | ||
| 1214 | } | ||
| 1215 | }, | ||
| 1154 | "controllers.ProfileResponse": { | 1216 | "controllers.ProfileResponse": { |
| 1155 | "type": "object", | 1217 | "type": "object", |
| 1156 | "properties": { | 1218 | "properties": { |
| @@ -1160,26 +1222,46 @@ | |||
| 1160 | "country_code": { | 1222 | "country_code": { |
| 1161 | "type": "string" | 1223 | "type": "string" |
| 1162 | }, | 1224 | }, |
| 1225 | "links": { | ||
| 1226 | "$ref": "#/definitions/models.Links" | ||
| 1227 | }, | ||
| 1163 | "profile": { | 1228 | "profile": { |
| 1164 | "type": "boolean" | 1229 | "type": "boolean" |
| 1165 | }, | 1230 | }, |
| 1166 | "scores_mp": { | 1231 | "rankings": { |
| 1167 | "type": "array", | 1232 | "$ref": "#/definitions/controllers.ProfileRankings" |
| 1168 | "items": { | 1233 | }, |
| 1169 | "$ref": "#/definitions/controllers.ScoreResponse" | 1234 | "records": { |
| 1170 | } | 1235 | "$ref": "#/definitions/controllers.ProfileRecords" |
| 1171 | }, | 1236 | }, |
| 1172 | "scores_sp": { | 1237 | "steam_id": { |
| 1238 | "type": "string" | ||
| 1239 | }, | ||
| 1240 | "titles": { | ||
| 1173 | "type": "array", | 1241 | "type": "array", |
| 1174 | "items": { | 1242 | "items": { |
| 1175 | "$ref": "#/definitions/controllers.ScoreResponse" | 1243 | "$ref": "#/definitions/models.Title" |
| 1176 | } | 1244 | } |
| 1177 | }, | 1245 | }, |
| 1178 | "steam_id": { | 1246 | "user_name": { |
| 1247 | "type": "string" | ||
| 1248 | } | ||
| 1249 | } | ||
| 1250 | }, | ||
| 1251 | "controllers.ProfileScores": { | ||
| 1252 | "type": "object", | ||
| 1253 | "properties": { | ||
| 1254 | "date": { | ||
| 1179 | "type": "string" | 1255 | "type": "string" |
| 1180 | }, | 1256 | }, |
| 1181 | "user_name": { | 1257 | "demo_id": { |
| 1182 | "type": "string" | 1258 | "type": "string" |
| 1259 | }, | ||
| 1260 | "score_count": { | ||
| 1261 | "type": "integer" | ||
| 1262 | }, | ||
| 1263 | "score_time": { | ||
| 1264 | "type": "integer" | ||
| 1183 | } | 1265 | } |
| 1184 | } | 1266 | } |
| 1185 | }, | 1267 | }, |
| @@ -1211,15 +1293,6 @@ | |||
| 1211 | } | 1293 | } |
| 1212 | } | 1294 | } |
| 1213 | }, | 1295 | }, |
| 1214 | "controllers.ScoreResponse": { | ||
| 1215 | "type": "object", | ||
| 1216 | "properties": { | ||
| 1217 | "map_id": { | ||
| 1218 | "type": "integer" | ||
| 1219 | }, | ||
| 1220 | "records": {} | ||
| 1221 | } | ||
| 1222 | }, | ||
| 1223 | "controllers.SearchResponse": { | 1296 | "controllers.SearchResponse": { |
| 1224 | "type": "object", | 1297 | "type": "object", |
| 1225 | "properties": { | 1298 | "properties": { |
| @@ -1273,6 +1346,23 @@ | |||
| 1273 | } | 1346 | } |
| 1274 | } | 1347 | } |
| 1275 | }, | 1348 | }, |
| 1349 | "models.Links": { | ||
| 1350 | "type": "object", | ||
| 1351 | "properties": { | ||
| 1352 | "p2sr": { | ||
| 1353 | "type": "string" | ||
| 1354 | }, | ||
| 1355 | "stream": { | ||
| 1356 | "type": "string" | ||
| 1357 | }, | ||
| 1358 | "twitch": { | ||
| 1359 | "type": "string" | ||
| 1360 | }, | ||
| 1361 | "youtube": { | ||
| 1362 | "type": "string" | ||
| 1363 | } | ||
| 1364 | } | ||
| 1365 | }, | ||
| 1276 | "models.Map": { | 1366 | "models.Map": { |
| 1277 | "type": "object", | 1367 | "type": "object", |
| 1278 | "properties": { | 1368 | "properties": { |
| @@ -1373,6 +1463,17 @@ | |||
| 1373 | } | 1463 | } |
| 1374 | } | 1464 | } |
| 1375 | }, | 1465 | }, |
| 1466 | "models.Title": { | ||
| 1467 | "type": "object", | ||
| 1468 | "properties": { | ||
| 1469 | "color": { | ||
| 1470 | "type": "string" | ||
| 1471 | }, | ||
| 1472 | "name": { | ||
| 1473 | "type": "string" | ||
| 1474 | } | ||
| 1475 | } | ||
| 1476 | }, | ||
| 1376 | "models.UserRanking": { | 1477 | "models.UserRanking": { |
| 1377 | "type": "object", | 1478 | "type": "object", |
| 1378 | "properties": { | 1479 | "properties": { |
diff --git a/docs/swagger.yaml b/docs/swagger.yaml index f50fecb..0dd514d 100644 --- a/docs/swagger.yaml +++ b/docs/swagger.yaml | |||
| @@ -86,27 +86,80 @@ definitions: | |||
| 86 | summary: | 86 | summary: |
| 87 | $ref: '#/definitions/models.MapSummary' | 87 | $ref: '#/definitions/models.MapSummary' |
| 88 | type: object | 88 | type: object |
| 89 | controllers.ProfileRankings: | ||
| 90 | properties: | ||
| 91 | cooperative: | ||
| 92 | $ref: '#/definitions/controllers.ProfileRankingsDetails' | ||
| 93 | overall: | ||
| 94 | $ref: '#/definitions/controllers.ProfileRankingsDetails' | ||
| 95 | singleplayer: | ||
| 96 | $ref: '#/definitions/controllers.ProfileRankingsDetails' | ||
| 97 | type: object | ||
| 98 | controllers.ProfileRankingsDetails: | ||
| 99 | properties: | ||
| 100 | completion_count: | ||
| 101 | type: integer | ||
| 102 | completion_total: | ||
| 103 | type: integer | ||
| 104 | rank: | ||
| 105 | type: integer | ||
| 106 | type: object | ||
| 107 | controllers.ProfileRecords: | ||
| 108 | properties: | ||
| 109 | portal2_cooperative: | ||
| 110 | items: | ||
| 111 | $ref: '#/definitions/controllers.ProfileRecordsDetails' | ||
| 112 | type: array | ||
| 113 | portal2_singleplayer: | ||
| 114 | items: | ||
| 115 | $ref: '#/definitions/controllers.ProfileRecordsDetails' | ||
| 116 | type: array | ||
| 117 | type: object | ||
| 118 | controllers.ProfileRecordsDetails: | ||
| 119 | properties: | ||
| 120 | map_id: | ||
| 121 | type: integer | ||
| 122 | map_name: | ||
| 123 | type: string | ||
| 124 | scores: | ||
| 125 | items: | ||
| 126 | $ref: '#/definitions/controllers.ProfileScores' | ||
| 127 | type: array | ||
| 128 | type: object | ||
| 89 | controllers.ProfileResponse: | 129 | controllers.ProfileResponse: |
| 90 | properties: | 130 | properties: |
| 91 | avatar_link: | 131 | avatar_link: |
| 92 | type: string | 132 | type: string |
| 93 | country_code: | 133 | country_code: |
| 94 | type: string | 134 | type: string |
| 135 | links: | ||
| 136 | $ref: '#/definitions/models.Links' | ||
| 95 | profile: | 137 | profile: |
| 96 | type: boolean | 138 | type: boolean |
| 97 | scores_mp: | 139 | rankings: |
| 98 | items: | 140 | $ref: '#/definitions/controllers.ProfileRankings' |
| 99 | $ref: '#/definitions/controllers.ScoreResponse' | 141 | records: |
| 100 | type: array | 142 | $ref: '#/definitions/controllers.ProfileRecords' |
| 101 | scores_sp: | ||
| 102 | items: | ||
| 103 | $ref: '#/definitions/controllers.ScoreResponse' | ||
| 104 | type: array | ||
| 105 | steam_id: | 143 | steam_id: |
| 106 | type: string | 144 | type: string |
| 145 | titles: | ||
| 146 | items: | ||
| 147 | $ref: '#/definitions/models.Title' | ||
| 148 | type: array | ||
| 107 | user_name: | 149 | user_name: |
| 108 | type: string | 150 | type: string |
| 109 | type: object | 151 | type: object |
| 152 | controllers.ProfileScores: | ||
| 153 | properties: | ||
| 154 | date: | ||
| 155 | type: string | ||
| 156 | demo_id: | ||
| 157 | type: string | ||
| 158 | score_count: | ||
| 159 | type: integer | ||
| 160 | score_time: | ||
| 161 | type: integer | ||
| 162 | type: object | ||
| 110 | controllers.RankingsResponse: | 163 | controllers.RankingsResponse: |
| 111 | properties: | 164 | properties: |
| 112 | rankings_mp: | 165 | rankings_mp: |
| @@ -125,12 +178,6 @@ definitions: | |||
| 125 | score_time: | 178 | score_time: |
| 126 | type: integer | 179 | type: integer |
| 127 | type: object | 180 | type: object |
| 128 | controllers.ScoreResponse: | ||
| 129 | properties: | ||
| 130 | map_id: | ||
| 131 | type: integer | ||
| 132 | records: {} | ||
| 133 | type: object | ||
| 134 | controllers.SearchResponse: | 181 | controllers.SearchResponse: |
| 135 | properties: | 182 | properties: |
| 136 | maps: | 183 | maps: |
| @@ -165,6 +212,17 @@ definitions: | |||
| 165 | name: | 212 | name: |
| 166 | type: string | 213 | type: string |
| 167 | type: object | 214 | type: object |
| 215 | models.Links: | ||
| 216 | properties: | ||
| 217 | p2sr: | ||
| 218 | type: string | ||
| 219 | stream: | ||
| 220 | type: string | ||
| 221 | twitch: | ||
| 222 | type: string | ||
| 223 | youtube: | ||
| 224 | type: string | ||
| 225 | type: object | ||
| 168 | models.Map: | 226 | models.Map: |
| 169 | properties: | 227 | properties: |
| 170 | chapter_name: | 228 | chapter_name: |
| @@ -230,6 +288,13 @@ definitions: | |||
| 230 | success: | 288 | success: |
| 231 | type: boolean | 289 | type: boolean |
| 232 | type: object | 290 | type: object |
| 291 | models.Title: | ||
| 292 | properties: | ||
| 293 | color: | ||
| 294 | type: string | ||
| 295 | name: | ||
| 296 | type: string | ||
| 297 | type: object | ||
| 233 | models.UserRanking: | 298 | models.UserRanking: |
| 234 | properties: | 299 | properties: |
| 235 | total_score: | 300 | total_score: |
| @@ -19,8 +19,8 @@ import ( | |||
| 19 | // @license.name GNU General Public License, Version 2 | 19 | // @license.name GNU General Public License, Version 2 |
| 20 | // @license.url https://www.gnu.org/licenses/old-licenses/gpl-2.0.html | 20 | // @license.url https://www.gnu.org/licenses/old-licenses/gpl-2.0.html |
| 21 | 21 | ||
| 22 | // @host lp.ardapektezol.com/api | 22 | // @host lp.ardapektezol.com/api |
| 23 | // @BasePath /v1 | 23 | // @BasePath /v1 |
| 24 | func main() { | 24 | func main() { |
| 25 | if os.Getenv("ENV") == "PROD" { | 25 | if os.Getenv("ENV") == "PROD" { |
| 26 | gin.SetMode(gin.ReleaseMode) | 26 | gin.SetMode(gin.ReleaseMode) |