aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--backend/controllers/recordController.go8
-rw-r--r--backend/models/responses.go5
2 files changed, 9 insertions, 4 deletions
diff --git a/backend/controllers/recordController.go b/backend/controllers/recordController.go
index af8eb63..d1404f4 100644
--- a/backend/controllers/recordController.go
+++ b/backend/controllers/recordController.go
@@ -2,7 +2,7 @@ package controllers
2 2
3import ( 3import (
4 "context" 4 "context"
5 b64 "encoding/base64" 5 "encoding/base64"
6 "io" 6 "io"
7 "log" 7 "log"
8 "mime/multipart" 8 "mime/multipart"
@@ -31,7 +31,7 @@ import (
31// @Param partner_demo formData file false "Partner Demo" 31// @Param partner_demo formData file false "Partner Demo"
32// @Param is_partner_orange formData boolean false "Is Partner Orange" 32// @Param is_partner_orange formData boolean false "Is Partner Orange"
33// @Param partner_id formData string false "Partner ID" 33// @Param partner_id formData string false "Partner ID"
34// @Success 200 {object} models.Response 34// @Success 200 {object} models.Response{data=models.RecordResponse}
35// @Failure 400 {object} models.Response 35// @Failure 400 {object} models.Response
36// @Failure 401 {object} models.Response 36// @Failure 401 {object} models.Response
37// @Router /maps/{id}/record [post] 37// @Router /maps/{id}/record [post]
@@ -183,7 +183,7 @@ func CreateRecordWithDemo(c *gin.Context) {
183 c.JSON(http.StatusOK, models.Response{ 183 c.JSON(http.StatusOK, models.Response{
184 Success: true, 184 Success: true,
185 Message: "Successfully created record.", 185 Message: "Successfully created record.",
186 Data: nil, 186 Data: models.RecordResponse{ScoreCount: hostDemoScoreCount, ScoreTime: hostDemoScoreTime},
187 }) 187 })
188} 188}
189 189
@@ -240,7 +240,7 @@ func DownloadDemoWithID(c *gin.Context) {
240 240
241// Use Service account 241// Use Service account
242func serviceAccount() *http.Client { 242func serviceAccount() *http.Client {
243 privateKey, _ := b64.StdEncoding.DecodeString(os.Getenv("GOOGLE_PRIVATE_KEY_BASE64")) 243 privateKey, _ := base64.StdEncoding.DecodeString(os.Getenv("GOOGLE_PRIVATE_KEY_BASE64"))
244 config := &jwt.Config{ 244 config := &jwt.Config{
245 Email: os.Getenv("GOOGLE_CLIENT_EMAIL"), 245 Email: os.Getenv("GOOGLE_CLIENT_EMAIL"),
246 PrivateKey: []byte(privateKey), 246 PrivateKey: []byte(privateKey),
diff --git a/backend/models/responses.go b/backend/models/responses.go
index dc554ff..459911c 100644
--- a/backend/models/responses.go
+++ b/backend/models/responses.go
@@ -50,6 +50,11 @@ type ChapterMapsResponse struct {
50 Maps []MapShort `json:"maps"` 50 Maps []MapShort `json:"maps"`
51} 51}
52 52
53type RecordResponse struct {
54 ScoreCount int `json:"score_count"`
55 ScoreTime int `json:"score_time"`
56}
57
53func ErrorResponse(message string) Response { 58func ErrorResponse(message string) Response {
54 return Response{ 59 return Response{
55 Success: false, 60 Success: false,