From 9cd44de9be62e1291f84763bc029f995301e1e03 Mon Sep 17 00:00:00 2001 From: Arda Serdar Pektezol <1669855+pektezol@users.noreply.github.com> Date: Fri, 22 Sep 2023 23:58:26 +0300 Subject: feat: discussions (#59) Former-commit-id: ac6ac59367650b6a37650f5aec0587c6ce4d3dd1 --- docs/swagger.json | 527 ++++++++++++++++++++++++++++++++++++++---------------- 1 file changed, 376 insertions(+), 151 deletions(-) (limited to 'docs/swagger.json') diff --git a/docs/swagger.json b/docs/swagger.json index ae83321..226cadd 100644 --- a/docs/swagger.json +++ b/docs/swagger.json @@ -13,7 +13,7 @@ "host": "lp.ardapektezol.com/api", "basePath": "/v1", "paths": { - "/chapters/{id}": { + "/chapters/{chapterid}": { "get": { "description": "Get maps from the specified chapter id.", "produces": [ @@ -26,7 +26,7 @@ { "type": "integer", "description": "Chapter ID", - "name": "id", + "name": "chapterid", "in": "path", "required": true } @@ -86,12 +86,6 @@ "schema": { "type": "file" } - }, - "400": { - "description": "Bad Request", - "schema": { - "$ref": "#/definitions/models.Response" - } } } } @@ -136,7 +130,7 @@ } } }, - "/games/{id}": { + "/games/{gameid}": { "get": { "description": "Get chapters from the specified game id.", "produces": [ @@ -149,7 +143,7 @@ { "type": "integer", "description": "Game ID", - "name": "id", + "name": "gameid", "in": "path", "required": true } @@ -172,12 +166,6 @@ } ] } - }, - "400": { - "description": "Bad Request", - "schema": { - "$ref": "#/definitions/models.Response" - } } } } @@ -212,12 +200,6 @@ } ] } - }, - "400": { - "description": "Bad Request", - "schema": { - "$ref": "#/definitions/models.Response" - } } } } @@ -258,12 +240,6 @@ } ] } - }, - "400": { - "description": "Bad Request", - "schema": { - "$ref": "#/definitions/models.Response" - } } } } @@ -295,19 +271,159 @@ } ] } + } + } + } + }, + "/maps/{mapid}/discussions": { + "get": { + "description": "Get map discussions with specified map id.", + "produces": [ + "application/json" + ], + "tags": [ + "maps" + ], + "parameters": [ + { + "type": "integer", + "description": "Map ID", + "name": "mapid", + "in": "path", + "required": true + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "allOf": [ + { + "$ref": "#/definitions/models.Response" + }, + { + "type": "object", + "properties": { + "data": { + "$ref": "#/definitions/handlers.MapDiscussionsResponse" + } + } + } + ] + } + } + } + }, + "post": { + "description": "Create map discussion with specified map id.", + "produces": [ + "application/json" + ], + "tags": [ + "maps" + ], + "parameters": [ + { + "type": "string", + "description": "JWT Token", + "name": "Authorization", + "in": "header", + "required": true }, - "400": { - "description": "Bad Request", + { + "type": "integer", + "description": "Map ID", + "name": "mapid", + "in": "path", + "required": true + }, + { + "type": "integer", + "description": "Discussion ID", + "name": "discussionid", + "in": "path", + "required": true + }, + { + "description": "Body", + "name": "request", + "in": "body", + "required": true, "schema": { - "$ref": "#/definitions/models.Response" + "$ref": "#/definitions/handlers.CreateMapDiscussionRequest" + } + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "allOf": [ + { + "$ref": "#/definitions/models.Response" + }, + { + "type": "object", + "properties": { + "data": { + "$ref": "#/definitions/handlers.CreateMapDiscussionRequest" + } + } + } + ] } } } } }, - "/maps/{id}/image": { + "/maps/{mapid}/discussions/{discussionid}": { + "get": { + "description": "Get map discussion with specified map and discussion id.", + "produces": [ + "application/json" + ], + "tags": [ + "maps" + ], + "parameters": [ + { + "type": "integer", + "description": "Map ID", + "name": "mapid", + "in": "path", + "required": true + }, + { + "type": "integer", + "description": "Discussion ID", + "name": "discussionid", + "in": "path", + "required": true + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "allOf": [ + { + "$ref": "#/definitions/models.Response" + }, + { + "type": "object", + "properties": { + "data": { + "$ref": "#/definitions/handlers.MapDiscussionResponse" + } + } + } + ] + } + } + } + }, "put": { - "description": "Edit map image with specified map id.", + "description": "Edit map discussion with specified map id.", "produces": [ "application/json" ], @@ -325,7 +441,14 @@ { "type": "integer", "description": "Map ID", - "name": "id", + "name": "mapid", + "in": "path", + "required": true + }, + { + "type": "integer", + "description": "Discussion ID", + "name": "discussionid", "in": "path", "required": true }, @@ -335,7 +458,7 @@ "in": "body", "required": true, "schema": { - "$ref": "#/definitions/handlers.EditMapImageRequest" + "$ref": "#/definitions/handlers.EditMapDiscussionRequest" } } ], @@ -351,15 +474,49 @@ "type": "object", "properties": { "data": { - "$ref": "#/definitions/handlers.EditMapImageRequest" + "$ref": "#/definitions/handlers.EditMapDiscussionRequest" } } } ] } + } + } + }, + "delete": { + "description": "Delete map summary with specified map id.", + "produces": [ + "application/json" + ], + "tags": [ + "maps" + ], + "parameters": [ + { + "type": "string", + "description": "JWT Token", + "name": "Authorization", + "in": "header", + "required": true }, - "400": { - "description": "Bad Request", + { + "type": "integer", + "description": "Map ID", + "name": "mapid", + "in": "path", + "required": true + }, + { + "type": "integer", + "description": "Discussion ID", + "name": "discussionid", + "in": "path", + "required": true + } + ], + "responses": { + "200": { + "description": "OK", "schema": { "$ref": "#/definitions/models.Response" } @@ -367,7 +524,63 @@ } } }, - "/maps/{id}/leaderboards": { + "/maps/{mapid}/image": { + "put": { + "description": "Edit map image with specified map id.", + "produces": [ + "application/json" + ], + "tags": [ + "maps" + ], + "parameters": [ + { + "type": "string", + "description": "JWT Token", + "name": "Authorization", + "in": "header", + "required": true + }, + { + "type": "integer", + "description": "Map ID", + "name": "mapid", + "in": "path", + "required": true + }, + { + "description": "Body", + "name": "request", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/handlers.EditMapImageRequest" + } + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "allOf": [ + { + "$ref": "#/definitions/models.Response" + }, + { + "type": "object", + "properties": { + "data": { + "$ref": "#/definitions/handlers.EditMapImageRequest" + } + } + } + ] + } + } + } + } + }, + "/maps/{mapid}/leaderboards": { "get": { "description": "Get map leaderboards with specified id.", "produces": [ @@ -380,7 +593,7 @@ { "type": "integer", "description": "Map ID", - "name": "id", + "name": "mapid", "in": "path", "required": true }, @@ -415,17 +628,11 @@ } ] } - }, - "400": { - "description": "Bad Request", - "schema": { - "$ref": "#/definitions/models.Response" - } } } } }, - "/maps/{id}/record": { + "/maps/{mapid}/record": { "post": { "description": "Post record with demo of a specific map.", "consumes": [ @@ -441,7 +648,7 @@ { "type": "integer", "description": "Map ID", - "name": "id", + "name": "mapid", "in": "path", "required": true }, @@ -496,23 +703,11 @@ } ] } - }, - "400": { - "description": "Bad Request", - "schema": { - "$ref": "#/definitions/models.Response" - } - }, - "401": { - "description": "Unauthorized", - "schema": { - "$ref": "#/definitions/models.Response" - } } } } }, - "/maps/{id}/summary": { + "/maps/{mapid}/summary": { "get": { "description": "Get map summary with specified id.", "produces": [ @@ -525,7 +720,7 @@ { "type": "integer", "description": "Map ID", - "name": "id", + "name": "mapid", "in": "path", "required": true } @@ -548,12 +743,6 @@ } ] } - }, - "400": { - "description": "Bad Request", - "schema": { - "$ref": "#/definitions/models.Response" - } } } }, @@ -576,7 +765,7 @@ { "type": "integer", "description": "Map ID", - "name": "id", + "name": "mapid", "in": "path", "required": true }, @@ -608,12 +797,6 @@ } ] } - }, - "400": { - "description": "Bad Request", - "schema": { - "$ref": "#/definitions/models.Response" - } } } }, @@ -636,7 +819,7 @@ { "type": "integer", "description": "Map ID", - "name": "id", + "name": "mapid", "in": "path", "required": true }, @@ -668,12 +851,6 @@ } ] } - }, - "400": { - "description": "Bad Request", - "schema": { - "$ref": "#/definitions/models.Response" - } } } }, @@ -696,7 +873,7 @@ { "type": "integer", "description": "Map ID", - "name": "id", + "name": "mapid", "in": "path", "required": true }, @@ -728,12 +905,6 @@ } ] } - }, - "400": { - "description": "Bad Request", - "schema": { - "$ref": "#/definitions/models.Response" - } } } } @@ -777,18 +948,6 @@ } ] } - }, - "400": { - "description": "Bad Request", - "schema": { - "$ref": "#/definitions/models.Response" - } - }, - "401": { - "description": "Unauthorized", - "schema": { - "$ref": "#/definitions/models.Response" - } } } }, @@ -825,18 +984,6 @@ "schema": { "$ref": "#/definitions/models.Response" } - }, - "400": { - "description": "Bad Request", - "schema": { - "$ref": "#/definitions/models.Response" - } - }, - "401": { - "description": "Unauthorized", - "schema": { - "$ref": "#/definitions/models.Response" - } } } }, @@ -878,18 +1025,6 @@ } ] } - }, - "400": { - "description": "Bad Request", - "schema": { - "$ref": "#/definitions/models.Response" - } - }, - "401": { - "description": "Unauthorized", - "schema": { - "$ref": "#/definitions/models.Response" - } } } } @@ -921,12 +1056,6 @@ } ] } - }, - "400": { - "description": "Bad Request", - "schema": { - "$ref": "#/definitions/models.Response" - } } } } @@ -966,12 +1095,6 @@ } ] } - }, - "400": { - "description": "Bad Request", - "schema": { - "$ref": "#/definitions/models.Response" - } } } } @@ -1048,7 +1171,7 @@ } } }, - "/users/{id}": { + "/users/{userid}": { "get": { "description": "Get profile page of another user.", "consumes": [ @@ -1064,7 +1187,7 @@ { "type": "integer", "description": "User ID", - "name": "id", + "name": "userid", "in": "path", "required": true } @@ -1087,18 +1210,6 @@ } ] } - }, - "400": { - "description": "Bad Request", - "schema": { - "$ref": "#/definitions/models.Response" - } - }, - "404": { - "description": "Not Found", - "schema": { - "$ref": "#/definitions/models.Response" - } } } } @@ -1133,6 +1244,21 @@ } } }, + "handlers.CreateMapDiscussionRequest": { + "type": "object", + "required": [ + "content", + "title" + ], + "properties": { + "content": { + "type": "string" + }, + "title": { + "type": "string" + } + } + }, "handlers.CreateMapSummaryRequest": { "type": "object", "required": [ @@ -1174,6 +1300,21 @@ } } }, + "handlers.EditMapDiscussionRequest": { + "type": "object", + "required": [ + "content", + "title" + ], + "properties": { + "content": { + "type": "string" + }, + "title": { + "type": "string" + } + } + }, "handlers.EditMapImageRequest": { "type": "object", "required": [ @@ -1248,6 +1389,90 @@ } } }, + "handlers.MapDiscussion": { + "type": "object", + "properties": { + "comments": { + "type": "array", + "items": { + "$ref": "#/definitions/handlers.MapDiscussionComment" + } + }, + "content": { + "type": "string" + }, + "creator": { + "$ref": "#/definitions/models.UserShortWithAvatar" + }, + "id": { + "type": "integer" + }, + "title": { + "type": "string" + }, + "updated_at": { + "description": "Upvotes int `json:\"upvotes\"`", + "type": "string" + } + } + }, + "handlers.MapDiscussionComment": { + "type": "object", + "properties": { + "comment": { + "type": "string" + }, + "date": { + "type": "string" + }, + "user": { + "$ref": "#/definitions/models.UserShortWithAvatar" + } + } + }, + "handlers.MapDiscussionOnlyTitle": { + "type": "object", + "properties": { + "comments": { + "type": "array", + "items": { + "$ref": "#/definitions/handlers.MapDiscussionComment" + } + }, + "creator": { + "$ref": "#/definitions/models.UserShortWithAvatar" + }, + "id": { + "type": "integer" + }, + "title": { + "type": "string" + }, + "updated_at": { + "description": "Upvotes int `json:\"upvotes\"`", + "type": "string" + } + } + }, + "handlers.MapDiscussionResponse": { + "type": "object", + "properties": { + "discussion": { + "$ref": "#/definitions/handlers.MapDiscussion" + } + } + }, + "handlers.MapDiscussionsResponse": { + "type": "object", + "properties": { + "discussions": { + "type": "array", + "items": { + "$ref": "#/definitions/handlers.MapDiscussionOnlyTitle" + } + } + } + }, "handlers.MapLeaderboardsResponse": { "type": "object", "properties": { -- cgit v1.2.3