diff options
| author | Arda Serdar Pektezol <1669855+pektezol@users.noreply.github.com> | 2023-04-19 14:14:11 +0300 |
|---|---|---|
| committer | Arda Serdar Pektezol <1669855+pektezol@users.noreply.github.com> | 2023-04-19 14:14:11 +0300 |
| commit | 9fade13368c732401030d392ef2332279716243e (patch) | |
| tree | 17427c8ec058ee8c32d0244230031fb4f6f50767 /backend/controllers/recordController.go | |
| parent | doc: swagger init for login and user routes (#34) (diff) | |
| download | lphub-9fade13368c732401030d392ef2332279716243e.tar.gz lphub-9fade13368c732401030d392ef2332279716243e.tar.bz2 lphub-9fade13368c732401030d392ef2332279716243e.zip | |
doc: complete rest of swagger implementation, change rankings response (#34)
Diffstat (limited to 'backend/controllers/recordController.go')
| -rw-r--r-- | backend/controllers/recordController.go | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/backend/controllers/recordController.go b/backend/controllers/recordController.go index 1cfaa56..27f39fc 100644 --- a/backend/controllers/recordController.go +++ b/backend/controllers/recordController.go | |||
| @@ -18,6 +18,20 @@ import ( | |||
| 18 | "google.golang.org/api/drive/v3" | 18 | "google.golang.org/api/drive/v3" |
| 19 | ) | 19 | ) |
| 20 | 20 | ||
| 21 | // POST Record | ||
| 22 | // | ||
| 23 | // @Summary Post record with demo of a specific map. | ||
| 24 | // @Accept mpfd | ||
| 25 | // @Produce json | ||
| 26 | // @Param demos formData []file true "Demos" | ||
| 27 | // @Param score_count formData int true "Score Count" | ||
| 28 | // @Param score_time formData int true "Score Time" | ||
| 29 | // @Param is_partner_orange formData boolean true "Is Partner Orange" | ||
| 30 | // @Param partner_id formData string true "Partner ID" | ||
| 31 | // @Success 200 {object} models.Response{data=models.RecordRequest} | ||
| 32 | // @Failure 400 {object} models.Response | ||
| 33 | // @Failure 401 {object} models.Response | ||
| 34 | // @Router /maps/{id}/record [post] | ||
| 21 | func CreateRecordWithDemo(c *gin.Context) { | 35 | func CreateRecordWithDemo(c *gin.Context) { |
| 22 | mapId := c.Param("id") | 36 | mapId := c.Param("id") |
| 23 | // Check if user exists | 37 | // Check if user exists |
| @@ -176,6 +190,15 @@ func CreateRecordWithDemo(c *gin.Context) { | |||
| 176 | return | 190 | return |
| 177 | } | 191 | } |
| 178 | 192 | ||
| 193 | // GET Demo | ||
| 194 | // | ||
| 195 | // @Summary Get demo with specified demo uuid. | ||
| 196 | // @Accept json | ||
| 197 | // @Produce octet-stream | ||
| 198 | // @Param uuid path int true "Demo UUID" | ||
| 199 | // @Success 200 {file} binary "Demo File" | ||
| 200 | // @Failure 400 {object} models.Response | ||
| 201 | // @Router /demo [get] | ||
| 179 | func DownloadDemoWithID(c *gin.Context) { | 202 | func DownloadDemoWithID(c *gin.Context) { |
| 180 | uuid := c.Query("uuid") | 203 | uuid := c.Query("uuid") |
| 181 | var locationID string | 204 | var locationID string |