{ "swagger": "2.0", "info": { "description": "API Service for CodinLab", "title": "API Service", "contact": {}, "version": "v1" }, "host": "localhost", "basePath": "/api/v1", "paths": { "/private/admin/user": { "get": { "description": "Retrieves All Users", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "Admin" ], "summary": "Get Users", "responses": { "200": { "description": "OK", "schema": { "$ref": "#/definitions/response.BaseResponse" } }, "400": { "description": "Bad Request", "schema": { "$ref": "#/definitions/response.BaseResponse" } } } } }, "/private/admin/user/{userID}": { "get": { "description": "Retrieves User Profile", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "Admin" ], "summary": "Get Profile", "parameters": [ { "type": "string", "description": "User ID", "name": "userID", "in": "path", "required": true } ], "responses": { "200": { "description": "OK", "schema": { "allOf": [ { "$ref": "#/definitions/response.BaseResponse" }, { "type": "object", "properties": { "data": { "$ref": "#/definitions/dto.UserDTO" } } } ] } }, "400": { "description": "Bad Request", "schema": { "$ref": "#/definitions/response.BaseResponse" } } } }, "post": { "description": "Updates User", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "Admin" ], "summary": "Updates User", "parameters": [ { "type": "string", "description": "User ID", "name": "userID", "in": "path", "required": true }, { "description": "New User Creds", "name": "user", "in": "body", "required": true, "schema": { "$ref": "#/definitions/dto.AdminUpdateUsersDTO" } } ], "responses": { "200": { "description": "OK", "schema": { "$ref": "#/definitions/response.BaseResponse" } } } }, "delete": { "description": "Deletes User", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "Admin" ], "summary": "Deletes User", "parameters": [ { "type": "string", "description": "User ID", "name": "userID", "in": "path", "required": true } ], "responses": { "200": { "description": "OK", "schema": { "$ref": "#/definitions/response.BaseResponse" } } } } }, "/private/common/stop/{containerID}": { "get": { "description": "Stops Quest Tests", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "Common" ], "summary": "Stops Quest Tests", "parameters": [ { "type": "string", "description": "Container ID", "name": "containerID", "in": "path", "required": true } ], "responses": { "200": { "description": "OK", "schema": { "$ref": "#/definitions/response.BaseResponse" } } } } }, "/private/home/advancement": { "get": { "description": "Get User Advancement", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "Home" ], "summary": "GetUserAdvancement", "responses": { "200": { "description": "OK", "schema": { "$ref": "#/definitions/response.BaseResponse" } } } } }, "/private/home/development": { "get": { "description": "Get User Development", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "Home" ], "summary": "GetUserDevelopment", "responses": { "200": { "description": "OK", "schema": { "$ref": "#/definitions/response.BaseResponse" } } } } }, "/private/home/inventories": { "get": { "description": "Get Inventories", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "Home" ], "summary": "GetInventories", "responses": { "200": { "description": "OK", "schema": { "$ref": "#/definitions/response.BaseResponse" } } } } }, "/private/home/level": { "get": { "description": "Get User Level", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "Home" ], "summary": "GetUserLevel", "parameters": [ { "type": "string", "description": "Language", "name": "Language", "in": "header" } ], "responses": { "200": { "description": "OK", "schema": { "$ref": "#/definitions/response.BaseResponse" } } } } }, "/private/lab/answer/{programmingID}/{labID}": { "post": { "description": "This is for answering quests.", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "Lab" ], "summary": "Answer", "parameters": [ { "type": "string", "description": "labID", "name": "labID", "in": "path" }, { "type": "string", "description": "programmingID", "name": "programmingID", "in": "path", "required": true }, { "description": "Answer Lab DTO", "name": "answerLabDTO", "in": "body", "required": true, "schema": { "$ref": "#/definitions/dto.AnswerLabDTO" } } ], "responses": { "200": { "description": "OK", "schema": { "$ref": "#/definitions/response.BaseResponse" } } } } }, "/private/lab/reset/{programmingID}/{labID}": { "get": { "description": "Reset Lab By Programming Language ID \u0026 Lab ID", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "Lab" ], "summary": "ResetLabHistory", "parameters": [ { "type": "string", "description": "Lab ID", "name": "labID", "in": "path", "required": true }, { "type": "string", "description": "Programming Language ID", "name": "programmingID", "in": "path", "required": true } ], "responses": { "200": { "description": "OK", "schema": { "$ref": "#/definitions/response.BaseResponse" } } } } }, "/private/lab/{labID}": { "get": { "description": "Get Lab By Programming Language ID \u0026 Lab ID", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "Lab" ], "summary": "GetLabByID", "parameters": [ { "type": "string", "description": "Language", "name": "Language", "in": "header" }, { "type": "string", "description": "Lab ID", "name": "labID", "in": "path", "required": true }, { "type": "string", "description": "Programming Language ID", "name": "programmingID", "in": "query" } ], "responses": { "200": { "description": "OK", "schema": { "$ref": "#/definitions/response.BaseResponse" } } } } }, "/private/labs/difficulty/stats": { "get": { "description": "Get User Lab Difficulty Statistics", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "Lab" ], "summary": "GetUserLabDifficultyStats", "responses": { "200": { "description": "OK", "schema": { "$ref": "#/definitions/response.BaseResponse" } } } } }, "/private/labs/general/stats": { "get": { "description": "Get User Programming Language Lab Statistics", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "Lab" ], "summary": "GetUserProgrammingLanguageLabStats", "responses": { "200": { "description": "OK", "schema": { "$ref": "#/definitions/response.BaseResponse" } } } } }, "/private/labs/progress/stats": { "get": { "description": "Get User Lab Progress Statistics", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "Lab" ], "summary": "GetUserLabProgressStats", "responses": { "200": { "description": "OK", "schema": { "$ref": "#/definitions/response.BaseResponse" } } } } }, "/private/labs/{programmingID}": { "get": { "description": "Get Labs", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "Lab" ], "summary": "GetLabs", "parameters": [ { "type": "string", "description": "Language", "name": "Language", "in": "header" }, { "type": "string", "description": "Programming Language ID", "name": "programmingID", "in": "path", "required": true } ], "responses": { "200": { "description": "OK", "schema": { "$ref": "#/definitions/response.BaseResponse" } } } } }, "/private/log": { "get": { "description": "Retrieves all logs based on the provided query parameters.", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "Log" ], "summary": "Get all logs", "parameters": [ { "type": "string", "description": "User ID", "name": "userID", "in": "query" }, { "type": "integer", "description": "Programming ID", "name": "programmingID", "in": "query" }, { "type": "integer", "description": "Log Lab or Path ID", "name": "labRoadID", "in": "query" }, { "type": "string", "description": "Log Content", "name": "content", "in": "query" }, { "type": "string", "description": "Log Type", "name": "type", "in": "query" } ], "responses": { "200": { "description": "OK", "schema": { "allOf": [ { "$ref": "#/definitions/response.BaseResponse" }, { "type": "object", "properties": { "data": { "type": "array", "items": { "$ref": "#/definitions/dto.LogDTO" } } } } ] } } } } }, "/private/log/lab": { "get": { "description": "Add dummy data for testing", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "Log" ], "summary": "DummyLogData", "responses": { "200": { "description": "OK", "schema": { "$ref": "#/definitions/response.BaseResponse" } } } } }, "/private/log/rates": { "get": { "description": "Retrieves language usage rates", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "Log" ], "summary": "Get Language Usage Rates", "responses": { "200": { "description": "OK", "schema": { "$ref": "#/definitions/response.BaseResponse" } }, "400": { "description": "Bad Request", "schema": { "$ref": "#/definitions/response.BaseResponse" } } } } }, "/private/log/road": { "get": { "description": "Add dummy data for testing", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "Log" ], "summary": "DummyLogData", "responses": { "200": { "description": "OK", "schema": { "$ref": "#/definitions/response.BaseResponse" } } } } }, "/private/log/solution/byday/{year}": { "get": { "description": "Retrieves the number of lab and road solutions solved day by day.", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "Log" ], "summary": "GetSolutionsByDay", "parameters": [ { "type": "string", "description": "Desired Year", "name": "year", "in": "path", "required": true } ], "responses": { "200": { "description": "OK", "schema": { "allOf": [ { "$ref": "#/definitions/response.BaseResponse" }, { "type": "object", "properties": { "data": { "type": "array", "items": { "$ref": "#/definitions/dto.SolutionsByDayDTO" } } } } ] } } } } }, "/private/log/solution/week": { "get": { "description": "Retrieves the total counts for lab and road solutions for each programming language in the last week.", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "Log" ], "summary": "GetSolutionsByProgramming", "responses": { "200": { "description": "OK", "schema": { "allOf": [ { "$ref": "#/definitions/response.BaseResponse" }, { "type": "object", "properties": { "data": { "type": "array", "items": { "$ref": "#/definitions/dto.SolutionsByProgrammingDTO" } } } } ] } } } } }, "/private/road/answer/{programmingID}/{pathID}": { "post": { "description": "This is for answering quests.", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "Road" ], "summary": "Answer", "parameters": [ { "type": "string", "description": "Programming ID", "name": "programmingID", "in": "path", "required": true }, { "type": "string", "description": "Language", "name": "Language", "in": "header" }, { "type": "string", "description": "Path ID", "name": "pathID", "in": "path", "required": true }, { "description": "Answer Road DTO", "name": "answerRoadDTO", "in": "body", "required": true, "schema": { "$ref": "#/definitions/dto.AnswerRoadDTO" } } ], "responses": { "200": { "description": "OK", "schema": { "$ref": "#/definitions/response.BaseResponse" } } } } }, "/private/road/general/stats": { "get": { "description": "Gets users language road stats", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "Road" ], "summary": "GetUserLanguageRoadStats", "responses": { "200": { "description": "OK", "schema": { "$ref": "#/definitions/response.BaseResponse" } } } } }, "/private/road/path/{programmingID}/{pathID}": { "get": { "description": "Get Path By ID", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "Road" ], "summary": "GetPathByID", "parameters": [ { "type": "string", "description": "Language", "name": "Language", "in": "header" }, { "type": "string", "description": "Programming ID", "name": "programmingID", "in": "path", "required": true }, { "type": "string", "description": "Path ID", "name": "pathID", "in": "path", "required": true } ], "responses": { "200": { "description": "OK", "schema": { "allOf": [ { "$ref": "#/definitions/response.BaseResponse" }, { "type": "object", "properties": { "data": { "$ref": "#/definitions/dto.PathDTO" } } } ] } } } } }, "/private/road/progress/stats": { "get": { "description": "Gets users road progress stats", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "Road" ], "summary": "GetUserRoadProgressStats", "responses": { "200": { "description": "OK", "schema": { "$ref": "#/definitions/response.BaseResponse" } } } } }, "/private/road/reset/{programmingID}/{pathID}": { "get": { "description": "Reset Path By Programming Language ID \u0026 Path ID", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "Road" ], "summary": "ResetPathHistory", "parameters": [ { "type": "string", "description": "Path ID", "name": "pathID", "in": "path", "required": true }, { "type": "string", "description": "Programming Language ID", "name": "programmingID", "in": "path", "required": true }, { "type": "string", "description": "Language", "name": "Language", "in": "header" } ], "responses": { "200": { "description": "OK", "schema": { "$ref": "#/definitions/response.BaseResponse" } } } } }, "/private/road/start": { "post": { "description": "Start Road", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "Road" ], "summary": "StartRoad", "parameters": [ { "description": "Start", "name": "start", "in": "body", "required": true, "schema": { "$ref": "#/definitions/dto.StartDTO" } } ], "responses": { "200": { "description": "OK", "schema": { "$ref": "#/definitions/response.BaseResponse" } } } } }, "/private/road/{programmingID}": { "get": { "description": "Get Road with Paths", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "Road" ], "summary": "GetRoads", "parameters": [ { "type": "string", "description": "Language", "name": "Language", "in": "header" }, { "type": "string", "description": "programmingID", "name": "programmingID", "in": "path", "required": true } ], "responses": { "200": { "description": "OK", "schema": { "allOf": [ { "$ref": "#/definitions/response.BaseResponse" }, { "type": "object", "properties": { "data": { "$ref": "#/definitions/dto.RoadDTO" } } } ] } } } } }, "/private/socket/ws": { "get": { "description": "Initiates a WebSocket connection for real-time communication. Clients can send and receive messages.", "tags": [ "WebSocket" ], "summary": "Establish a WebSocket Connection", "responses": { "101": { "description": "Connection Established", "schema": { "type": "string" } }, "400": { "description": "Bad Request", "schema": { "type": "string" } }, "500": { "description": "Internal Server Error", "schema": { "type": "string" } } } } }, "/private/user/": { "get": { "description": "Gets users profile", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "User" ], "summary": "GetProfile", "responses": { "200": { "description": "OK", "schema": { "allOf": [ { "$ref": "#/definitions/response.BaseResponse" }, { "type": "object", "properties": { "data": { "$ref": "#/definitions/dto.UserDTO" } } } ] } } } }, "put": { "description": "Updates user", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "User" ], "summary": "UpdateUser", "parameters": [ { "description": "UpdateUser", "name": "update", "in": "body", "required": true, "schema": { "$ref": "#/definitions/dto.UpdateUserDTO" } } ], "responses": { "200": { "description": "OK", "schema": { "$ref": "#/definitions/response.BaseResponse" } } } } }, "/private/user/password": { "put": { "description": "Updates users password", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "User" ], "summary": "UpdatePassword", "parameters": [ { "description": "UpdatePassword", "name": "update", "in": "body", "required": true, "schema": { "$ref": "#/definitions/dto.UpdatePasswordDTO" } } ], "responses": { "200": { "description": "OK", "schema": { "$ref": "#/definitions/response.BaseResponse" } } } } }, "/public/login": { "post": { "description": "Login", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "Auth" ], "summary": "Login", "parameters": [ { "description": "Login", "name": "login", "in": "body", "required": true, "schema": { "$ref": "#/definitions/dto.LoginDTO" } } ], "responses": { "200": { "description": "OK", "schema": { "$ref": "#/definitions/response.BaseResponse" } } } } }, "/public/logout": { "post": { "description": "Logout", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "Auth" ], "summary": "Logout", "responses": { "200": { "description": "OK", "schema": { "$ref": "#/definitions/response.BaseResponse" } } } } }, "/public/register": { "post": { "description": "Register", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "Auth" ], "summary": "Register", "parameters": [ { "description": "Register", "name": "register", "in": "body", "required": true, "schema": { "$ref": "#/definitions/dto.RegisterDTO" } } ], "responses": { "200": { "description": "OK", "schema": { "$ref": "#/definitions/response.BaseResponse" } } } } } }, "definitions": { "dto.AdminUpdateUsersDTO": { "type": "object", "properties": { "githubProfile": { "type": "string", "maxLength": 30 }, "name": { "type": "string" }, "role": { "type": "string", "enum": [ "admin", "user", "" ] }, "surname": { "type": "string" }, "username": { "type": "string", "maxLength": 30 } } }, "dto.AnswerLabDTO": { "type": "object", "properties": { "userCode": { "type": "string" } } }, "dto.AnswerRoadDTO": { "type": "object", "properties": { "userCode": { "description": "ProgrammingID int `json:\"programmindID\"`\n\tPathID int `json:\"pathID\"`", "type": "string" } } }, "dto.LanguageRoadDTO": { "type": "object", "properties": { "content": { "type": "string" }, "description": { "type": "string" }, "lang": { "type": "string" }, "note": { "type": "string" }, "title": { "type": "string" } } }, "dto.LogDTO": { "type": "object", "properties": { "content": { "type": "string" }, "id": { "type": "string" }, "labPathID": { "type": "integer" }, "logType": { "type": "string" }, "programmingID": { "type": "integer" }, "userId": { "type": "string" } } }, "dto.LoginDTO": { "type": "object", "required": [ "password", "username" ], "properties": { "password": { "type": "string", "minLength": 8 }, "username": { "type": "string", "maxLength": 30, "minLength": 3 } } }, "dto.PathDTO": { "type": "object", "properties": { "difficulty": { "type": "integer" }, "id": { "type": "integer" }, "language": { "$ref": "#/definitions/dto.LanguageRoadDTO" }, "name": { "type": "string" }, "pathIsFinished": { "type": "boolean" }, "pathIsStarted": { "type": "boolean" }, "template": { "type": "string" } } }, "dto.RegisterDTO": { "type": "object", "required": [ "name", "password", "surname", "username" ], "properties": { "githubProfile": { "type": "string", "maxLength": 30 }, "name": { "type": "string" }, "password": { "type": "string", "minLength": 8 }, "surname": { "type": "string" }, "username": { "type": "string", "maxLength": 30, "minLength": 3 } } }, "dto.RoadDTO": { "type": "object", "properties": { "description": { "type": "string" }, "iconPath": { "type": "string" }, "isImageExists": { "type": "boolean" }, "name": { "type": "string" }, "paths": { "type": "array", "items": { "$ref": "#/definitions/dto.PathDTO" } }, "roadIsFinished": { "type": "boolean" }, "roadIsStarted": { "type": "boolean" }, "title": { "type": "string" } } }, "dto.SolutionsByDayDTO": { "type": "object", "properties": { "count": { "type": "integer" }, "date": { "type": "string" }, "level": { "type": "integer" } } }, "dto.SolutionsByProgrammingDTO": { "type": "object", "properties": { "labCount": { "type": "integer" }, "programmingID": { "type": "integer" }, "programmingName": { "type": "string" }, "roadCount": { "type": "integer" }, "totalCount": { "type": "integer" } } }, "dto.StartDTO": { "type": "object", "properties": { "programmingID": { "type": "integer" } } }, "dto.UpdatePasswordDTO": { "type": "object", "required": [ "confirmPassword", "newPassword", "password" ], "properties": { "confirmPassword": { "type": "string", "minLength": 8 }, "newPassword": { "type": "string", "minLength": 8 }, "password": { "type": "string" } } }, "dto.UpdateUserDTO": { "type": "object", "required": [ "password" ], "properties": { "githubProfile": { "type": "string", "maxLength": 30 }, "name": { "type": "string" }, "password": { "type": "string" }, "surname": { "type": "string" }, "username": { "type": "string", "maxLength": 30 } } }, "dto.UserDTO": { "type": "object", "properties": { "bestLanguage": { "type": "string" }, "githubProfile": { "type": "string" }, "name": { "type": "string" }, "role": { "type": "string" }, "surname": { "type": "string" }, "username": { "type": "string" } } }, "response.BaseResponse": { "type": "object", "properties": { "data": {}, "data_count": { "type": "integer" }, "errors": {}, "message": { "type": "string" }, "status_code": { "type": "integer" } } } }, "securityDefinitions": { "ApiKeyAuth": { "type": "apiKey", "name": "session_id", "in": "cookie" } } }