From 96f55dba15bcbba4e6d8f14035ecfd20ebcea8a8 Mon Sep 17 00:00:00 2001 From: Arda Serdar Pektezol <1669855+pektezol@users.noreply.github.com> Date: Mon, 27 Oct 2025 22:12:31 +0300 Subject: feat/backend: timeline stats endpoint --- backend/docs/docs.go | 148 ++++++++++++++++++++++++++++++++-------------- backend/docs/swagger.json | 148 ++++++++++++++++++++++++++++++++-------------- backend/docs/swagger.yaml | 87 +++++++++++++++++++-------- 3 files changed, 272 insertions(+), 111 deletions(-) (limited to 'backend/docs') diff --git a/backend/docs/docs.go b/backend/docs/docs.go index 44d53e1..7ce9a8b 100644 --- a/backend/docs/docs.go +++ b/backend/docs/docs.go @@ -250,37 +250,6 @@ const docTemplate = `{ } } }, - "/logs/score": { - "get": { - "description": "Get score logs of every player.", - "produces": [ - "application/json" - ], - "tags": [ - "logs" - ], - "responses": { - "200": { - "description": "OK", - "schema": { - "allOf": [ - { - "$ref": "#/definitions/models.Response" - }, - { - "type": "object", - "properties": { - "data": { - "$ref": "#/definitions/handlers.ScoreLogsResponse" - } - } - } - ] - } - } - } - } - }, "/maps/{mapid}/discussions": { "get": { "description": "Get map discussions with specified map id.", @@ -1220,6 +1189,68 @@ const docTemplate = `{ } } }, + "/stats/scores": { + "get": { + "description": "Get score logs of every player.", + "produces": [ + "application/json" + ], + "tags": [ + "stats" + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "allOf": [ + { + "$ref": "#/definitions/models.Response" + }, + { + "type": "object", + "properties": { + "data": { + "$ref": "#/definitions/handlers.ScoresResponse" + } + } + } + ] + } + } + } + } + }, + "/stats/timeline": { + "get": { + "description": "Get the history of portal count world records over time.", + "produces": [ + "application/json" + ], + "tags": [ + "stats" + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "allOf": [ + { + "$ref": "#/definitions/models.Response" + }, + { + "type": "object", + "properties": { + "data": { + "$ref": "#/definitions/handlers.TimelineResponse" + } + } + } + ] + } + } + } + } + }, "/token": { "get": { "description": "Gets the token cookie value from the user.", @@ -1774,18 +1805,7 @@ const docTemplate = `{ } } }, - "handlers.ScoreLogsResponse": { - "type": "object", - "properties": { - "scores": { - "type": "array", - "items": { - "$ref": "#/definitions/handlers.ScoreLogsResponseDetails" - } - } - } - }, - "handlers.ScoreLogsResponseDetails": { + "handlers.ScoresDetails": { "type": "object", "properties": { "date": { @@ -1811,6 +1831,17 @@ const docTemplate = `{ } } }, + "handlers.ScoresResponse": { + "type": "object", + "properties": { + "scores": { + "type": "array", + "items": { + "$ref": "#/definitions/handlers.ScoresDetails" + } + } + } + }, "handlers.SearchResponse": { "type": "object", "properties": { @@ -1860,6 +1891,34 @@ const docTemplate = `{ } } }, + "handlers.TimelinePoint": { + "type": "object", + "properties": { + "count": { + "type": "integer" + }, + "date": { + "type": "string" + } + } + }, + "handlers.TimelineResponse": { + "type": "object", + "properties": { + "timeline_multiplayer": { + "type": "array", + "items": { + "$ref": "#/definitions/handlers.TimelinePoint" + } + }, + "timeline_singleplayer": { + "type": "array", + "items": { + "$ref": "#/definitions/handlers.TimelinePoint" + } + } + } + }, "models.Category": { "type": "object", "properties": { @@ -1945,6 +2004,9 @@ const docTemplate = `{ "chapter_name": { "type": "string" }, + "difficulty": { + "type": "integer" + }, "game_name": { "type": "string" }, diff --git a/backend/docs/swagger.json b/backend/docs/swagger.json index 6c10cfc..981d017 100644 --- a/backend/docs/swagger.json +++ b/backend/docs/swagger.json @@ -244,37 +244,6 @@ } } }, - "/logs/score": { - "get": { - "description": "Get score logs of every player.", - "produces": [ - "application/json" - ], - "tags": [ - "logs" - ], - "responses": { - "200": { - "description": "OK", - "schema": { - "allOf": [ - { - "$ref": "#/definitions/models.Response" - }, - { - "type": "object", - "properties": { - "data": { - "$ref": "#/definitions/handlers.ScoreLogsResponse" - } - } - } - ] - } - } - } - } - }, "/maps/{mapid}/discussions": { "get": { "description": "Get map discussions with specified map id.", @@ -1214,6 +1183,68 @@ } } }, + "/stats/scores": { + "get": { + "description": "Get score logs of every player.", + "produces": [ + "application/json" + ], + "tags": [ + "stats" + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "allOf": [ + { + "$ref": "#/definitions/models.Response" + }, + { + "type": "object", + "properties": { + "data": { + "$ref": "#/definitions/handlers.ScoresResponse" + } + } + } + ] + } + } + } + } + }, + "/stats/timeline": { + "get": { + "description": "Get the history of portal count world records over time.", + "produces": [ + "application/json" + ], + "tags": [ + "stats" + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "allOf": [ + { + "$ref": "#/definitions/models.Response" + }, + { + "type": "object", + "properties": { + "data": { + "$ref": "#/definitions/handlers.TimelineResponse" + } + } + } + ] + } + } + } + } + }, "/token": { "get": { "description": "Gets the token cookie value from the user.", @@ -1768,18 +1799,7 @@ } } }, - "handlers.ScoreLogsResponse": { - "type": "object", - "properties": { - "scores": { - "type": "array", - "items": { - "$ref": "#/definitions/handlers.ScoreLogsResponseDetails" - } - } - } - }, - "handlers.ScoreLogsResponseDetails": { + "handlers.ScoresDetails": { "type": "object", "properties": { "date": { @@ -1805,6 +1825,17 @@ } } }, + "handlers.ScoresResponse": { + "type": "object", + "properties": { + "scores": { + "type": "array", + "items": { + "$ref": "#/definitions/handlers.ScoresDetails" + } + } + } + }, "handlers.SearchResponse": { "type": "object", "properties": { @@ -1854,6 +1885,34 @@ } } }, + "handlers.TimelinePoint": { + "type": "object", + "properties": { + "count": { + "type": "integer" + }, + "date": { + "type": "string" + } + } + }, + "handlers.TimelineResponse": { + "type": "object", + "properties": { + "timeline_multiplayer": { + "type": "array", + "items": { + "$ref": "#/definitions/handlers.TimelinePoint" + } + }, + "timeline_singleplayer": { + "type": "array", + "items": { + "$ref": "#/definitions/handlers.TimelinePoint" + } + } + } + }, "models.Category": { "type": "object", "properties": { @@ -1939,6 +1998,9 @@ "chapter_name": { "type": "string" }, + "difficulty": { + "type": "integer" + }, "game_name": { "type": "string" }, diff --git a/backend/docs/swagger.yaml b/backend/docs/swagger.yaml index 8f33b94..0b3258c 100644 --- a/backend/docs/swagger.yaml +++ b/backend/docs/swagger.yaml @@ -287,14 +287,7 @@ definitions: score_time: type: integer type: object - handlers.ScoreLogsResponse: - properties: - scores: - items: - $ref: '#/definitions/handlers.ScoreLogsResponseDetails' - type: array - type: object - handlers.ScoreLogsResponseDetails: + handlers.ScoresDetails: properties: date: type: string @@ -311,6 +304,13 @@ definitions: user: $ref: '#/definitions/models.UserShort' type: object + handlers.ScoresResponse: + properties: + scores: + items: + $ref: '#/definitions/handlers.ScoresDetails' + type: array + type: object handlers.SearchResponse: properties: maps: @@ -343,6 +343,24 @@ definitions: user_name: type: string type: object + handlers.TimelinePoint: + properties: + count: + type: integer + date: + type: string + type: object + handlers.TimelineResponse: + properties: + timeline_multiplayer: + items: + $ref: '#/definitions/handlers.TimelinePoint' + type: array + timeline_singleplayer: + items: + $ref: '#/definitions/handlers.TimelinePoint' + type: array + type: object models.Category: properties: id: @@ -398,6 +416,8 @@ definitions: properties: chapter_name: type: string + difficulty: + type: integer game_name: type: string id: @@ -672,23 +692,6 @@ paths: type: object tags: - login - /logs/score: - get: - description: Get score logs of every player. - produces: - - application/json - responses: - "200": - description: OK - schema: - allOf: - - $ref: '#/definitions/models.Response' - - properties: - data: - $ref: '#/definitions/handlers.ScoreLogsResponse' - type: object - tags: - - logs /maps/{mapid}/discussions: get: description: Get map discussions with specified map id. @@ -1259,6 +1262,40 @@ paths: type: object tags: - search + /stats/scores: + get: + description: Get score logs of every player. + produces: + - application/json + responses: + "200": + description: OK + schema: + allOf: + - $ref: '#/definitions/models.Response' + - properties: + data: + $ref: '#/definitions/handlers.ScoresResponse' + type: object + tags: + - stats + /stats/timeline: + get: + description: Get the history of portal count world records over time. + produces: + - application/json + responses: + "200": + description: OK + schema: + allOf: + - $ref: '#/definitions/models.Response' + - properties: + data: + $ref: '#/definitions/handlers.TimelineResponse' + type: object + tags: + - stats /token: delete: description: Deletes the token cookie from the user. -- cgit v1.2.3