{ "components": { "examples": {}, "headers": {}, "parameters": {}, "requestBodies": {}, "responses": {}, "schemas": { "ApiInfoResponseDto": { "properties": { "name": { "type": "string" }, "version": { "type": "string" }, "description": { "type": "string" }, "author": { "type": "string" }, "createdAt": { "type": "string", "format": "date-time" }, "environment": { "type": "string" } }, "required": [ "name", "version", "description", "author", "createdAt" ], "type": "object", "additionalProperties": false }, "UserRoleType": { "type": "string", "enum": [ "Student", "Admin" ] }, "LoginResponseDto": { "properties": { "apiMessage": { "type": "string" }, "uuid": { "type": "string" }, "email": { "type": "string" }, "createdAt": { "type": "string", "format": "date-time" }, "firstname": { "type": "string" }, "lastname": { "type": "string" }, "role": { "$ref": "#/components/schemas/UserRoleType" }, "token": { "type": "string", "nullable": true }, "updatedAt": { "type": "string", "format": "date-time" }, "jwt": { "type": "string" } }, "required": [ "apiMessage", "uuid", "email", "createdAt", "role", "jwt" ], "type": "object", "additionalProperties": false }, "CreateChallengeResponseDto": { "properties": { "apiMessage": { "type": "string" } }, "required": [ "apiMessage" ], "type": "object", "additionalProperties": false }, "QuestionBody": { "properties": { "questionText": { "type": "string" }, "expectedAnswer": { "type": "string" }, "command": { "type": "string" }, "note": { "type": "number", "format": "double" } }, "required": [ "questionText", "expectedAnswer", "note" ], "type": "object", "additionalProperties": false }, "CreateChallengeBody": { "properties": { "name": { "type": "string" }, "description": { "type": "string" }, "questions": { "items": { "$ref": "#/components/schemas/QuestionBody" }, "type": "array" } }, "required": [ "name", "description", "questions" ], "type": "object", "additionalProperties": false }, "ChallengeStatusType": { "type": "string", "enum": [ "opened", "closed" ] }, "GetChallengeByUuidResponseDto": { "properties": { "apiMessage": { "type": "string" }, "uuid": { "type": "string" }, "name": { "type": "string" }, "description": { "type": "string" }, "createdAt": { "type": "string", "format": "date-time" }, "status": { "$ref": "#/components/schemas/ChallengeStatusType" }, "creatorUuid": { "type": "string" }, "updatedAt": { "type": "string", "format": "date-time" } }, "required": [ "apiMessage", "uuid", "name", "description", "createdAt", "status" ], "type": "object", "additionalProperties": false }, "ChallengeDto": { "properties": { "uuid": { "type": "string" }, "name": { "type": "string" }, "description": { "type": "string" }, "createdAt": { "type": "string", "format": "date-time" }, "status": { "$ref": "#/components/schemas/ChallengeStatusType" }, "creatorUuid": { "type": "string" }, "updatedAt": { "type": "string", "format": "date-time" } }, "required": [ "uuid", "name", "description", "createdAt", "status" ], "type": "object", "additionalProperties": false }, "GetChallengesResponseDto": { "properties": { "apiMessage": { "type": "string" }, "page": { "type": "number", "format": "double" }, "limit": { "type": "number", "format": "double" }, "total": { "type": "number", "format": "double" }, "rows": { "items": { "$ref": "#/components/schemas/ChallengeDto" }, "type": "array" } }, "required": [ "apiMessage", "page", "limit", "total", "rows" ], "type": "object", "additionalProperties": false }, "SendAdminMagicLinkResponseDto": { "properties": { "apiMessage": { "type": "string" } }, "required": [ "apiMessage" ], "type": "object", "additionalProperties": false }, "SendStudentMagicLinkResponseDto": { "properties": { "apiMessage": { "type": "string" } }, "required": [ "apiMessage" ], "type": "object", "additionalProperties": false } }, "securitySchemes": { "jwt": { "type": "apiKey", "name": "jwt", "in": "header", "authorizationUrl": "http://swagger.io/api/oauth/dialog" } } }, "info": { "title": "api", "version": "0.0.1", "license": { "name": "ISC" }, "contact": {} }, "openapi": "3.0.0", "paths": { "/": { "get": { "operationId": "Info", "responses": { "200": { "description": "Ok", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ApiInfoResponseDto" } } } } }, "security": [], "parameters": [] } }, "/auth/login": { "get": { "operationId": "Index", "responses": { "200": { "description": "Ok", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/LoginResponseDto" }, "examples": { "Example 1": { "value": { "uuid": "123e4567-e89b-12d3-a456-426655440000", "email": "johndoe@example.com", "createdAt": "2023-10-20T11:14:44.647Z", "firstname": "John", "lastname": "Doe", "role": "Student", "token": null, "jwt": "jwt-token", "apiMessage": "success true" } } } } } } }, "description": "Login controller called when user clicks on the magic link.", "security": [], "parameters": [ { "description": "Token sent to check if user may be authenticated", "in": "query", "name": "token", "required": true, "schema": { "type": "string" } } ] } }, "/protected/challenge": { "post": { "operationId": "Index", "responses": { "200": { "description": "Ok", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/CreateChallengeResponseDto" } } } } }, "security": [ { "jwt": [ "Admin" ] } ], "parameters": [], "requestBody": { "required": true, "content": { "application/json": { "schema": { "$ref": "#/components/schemas/CreateChallengeBody" } } } } } }, "/protected/challenge/{challengeUuid}": { "get": { "operationId": "Index", "responses": { "200": { "description": "Ok", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/GetChallengeByUuidResponseDto" } } } } }, "security": [], "parameters": [ { "in": "path", "name": "challengeUuid", "required": true, "schema": { "type": "string" } } ] } }, "/protected/challenges": { "get": { "operationId": "Index", "responses": { "200": { "description": "Ok", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/GetChallengesResponseDto" } } } } }, "security": [ { "jwt": [ "Admin" ] } ], "parameters": [] } }, "/auth/magic-link-admin": { "get": { "operationId": "SendAdminMagicLink", "responses": { "200": { "description": "Ok", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/SendAdminMagicLinkResponseDto" } } } } }, "security": [], "parameters": [ { "in": "query", "name": "email", "required": true, "schema": { "type": "string" } } ] } }, "/auth/magic-link-student": { "get": { "operationId": "SendStudentMagicLink", "responses": { "200": { "description": "Ok", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/SendStudentMagicLinkResponseDto" } } } } }, "security": [], "parameters": [ { "in": "query", "name": "email", "required": true, "schema": { "type": "string" } }, { "in": "query", "name": "challengeUuid", "required": true, "schema": { "type": "string" } } ] } } }, "servers": [ { "url": "/api" } ] }