diff --git a/api/Database.py b/api/Database.py index 7411f72c0fef83864015df15615bdada4b14c03c..0678c7416577c91ce7d29781ae61e45f1ac2f376 100644 --- a/api/Database.py +++ b/api/Database.py @@ -128,9 +128,9 @@ class Database: query = f'SELECT * FROM tasks WHERE "{TaskParameters.ID.value}"=%s;' return self.__query(query, taskID, fetch_type=FetchType.ONE) - def add_task(self, milestoneID, title, description): + def add_task(self, milestoneID, title, description, status): query = f'INSERT INTO tasks ("{TaskParameters.MILESTONE_ID.value}", "{TaskParameters.TITLE.value}", "{TaskParameters.DESCRIPTION.value}", "{TaskParameters.STATUS.value}") VALUES (%s, %s, %s, %s);' - self.__query(query, milestoneID, title, description, 1, fetch_type=FetchType.NONE) + self.__query(query, milestoneID, title, description, status, fetch_type=FetchType.NONE) def update_task(self, taskID, milestoneID, title, description, status): query = f'UPDATE tasks SET "{TaskParameters.MILESTONE_ID.value}"=%s, "{TaskParameters.TITLE.value}"=%s, "{TaskParameters.DESCRIPTION.value}"=%s, "{TaskParameters.STATUS.value}"=%s WHERE "{TaskParameters.ID.value}"=%s;' @@ -157,9 +157,9 @@ class Database: query = f'SELECT * FROM subtasks WHERE "{SubTaskParameters.ID.value}"=%s;' return self.__query(query, subTaskID, fetch_type=FetchType.ONE) - def add_sub_task(self, taskID, title, description): + def add_sub_task(self, taskID, title, description, status): query = f'INSERT INTO subtasks ("{SubTaskParameters.TASK_ID.value}", "{SubTaskParameters.TITLE.value}", "{SubTaskParameters.DESCRIPTION.value}", "{SubTaskParameters.STATUS.value}") VALUES (%s, %s, %s, %s);' - self.__query(query, taskID, title, description, 1, fetch_type=FetchType.NONE) + self.__query(query, taskID, title, description, status, fetch_type=FetchType.NONE) def update_sub_task(self, subTaskID, taskID, title, description, status): query = f'UPDATE subtasks SET "{SubTaskParameters.TASK_ID.value}"=%s, "{SubTaskParameters.TITLE.value}"=%s, "{SubTaskParameters.DESCRIPTION.value}"=%s, "{SubTaskParameters.STATUS.value}"=%s WHERE "{SubTaskParameters.ID.value}"=%s;' diff --git a/api/blueprints/TaskAPI.py b/api/blueprints/TaskAPI.py index 289c2a0a8002b68aadd5eb991bd5d965c54d138c..05ed73289836e5c3760eed20c907b7400e7cb5a2 100644 --- a/api/blueprints/TaskAPI.py +++ b/api/blueprints/TaskAPI.py @@ -46,8 +46,8 @@ def construct_blueprint(database): database.add_task(parameters[TaskParameters.MILESTONE_ID.value], parameters[TaskParameters.TITLE.value], - parameters[TaskParameters.DESCRIPTION.value, - parameters[TaskParameters.STATUS.value]]) + parameters[TaskParameters.DESCRIPTION.value], + parameters[TaskParameters.STATUS.value]) return jsonify({"success": True}) @task_api.route('/task/<int:taskID>', methods=['DELETE']) diff --git a/api/docs/api.html b/api/docs/api.html index a1fed1b2c8956444c718eaebacefe9b4b63dc6c4..d122ada5fb49289da9c1e5c0f9b3e70f9c6c88c7 100644 --- a/api/docs/api.html +++ b/api/docs/api.html @@ -35,7 +35,7 @@ <script> window.onload = function() { - var spec = {"openapi": "3.0.0", "servers": [{"description": "Roadmaps API Server", "url": "https://roadmaps.thecodelabs.de:10000/"}], "info": {"description": "The Official Roadmaps API", "version": "2.3.2", "title": "Roadmaps API"}, "tags": [{"name": "admins", "description": "Secured Admin-only calls"}, {"name": "public", "description": "Operations available to the public"}], "paths": {"/version": {"get": {"tags": ["public"], "summary": "Gets information about the server version", "operationId": "version", "responses": {"200": {"description": "The server version information", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/Version"}}}}}}}, "/login": {"post": {"tags": ["public"], "summary": "Gets a bearer JSON Web Token", "operationId": "login", "requestBody": {"description": "Credentials", "required": true, "content": {"application/json": {"schema": {"$ref": "#/components/schemas/Credentials"}}}}, "responses": {"200": {"description": "success response", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/TokenResponse"}}}}, "401": {"description": "unauthorized response", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/UnauthorizedResponse"}}}}, "default": {"description": "error response", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/ErrorResponse"}}}}}}}, "/roadmaps": {"get": {"tags": ["public"], "summary": "Gets all roadmaps", "operationId": "roadmaps", "responses": {"200": {"description": "All available roadmaps", "content": {"application/json": {"schema": {"type": "array", "items": {"$ref": "#/components/schemas/Roadmap"}}}}}}}}, "/roadmap/{roadmapID}": {"get": {"tags": ["public"], "summary": "Gets a specific roadmap", "operationId": "roadmap", "parameters": [{"in": "path", "name": "roadmapID", "description": "The roadmap ID", "required": true, "schema": {"type": "integer"}}], "responses": {"200": {"description": "The roadmap", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/Roadmap"}}}}}}, "delete": {"tags": ["admins"], "description": "Deletes a roadmap based on the given ID", "operationId": "deleteRoadmap", "parameters": [{"in": "path", "name": "roadmapID", "description": "The roadmap ID", "required": true, "schema": {"type": "integer"}}], "security": [{"BearerAuth": []}], "responses": {"200": {"description": "success response", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/SuccessResponse"}}}}, "401": {"description": "unauthorized response", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/UnauthorizedResponse"}}}}, "default": {"description": "error response", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/ErrorResponse"}}}}}}}, "/roadmap": {"post": {"tags": ["admins"], "summary": "Adds a new roadmap", "operationId": "addRoadmap", "requestBody": {"description": "Roadmap to add", "required": true, "content": {"application/json": {"schema": {"$ref": "#/components/schemas/NewRoadmap"}}}}, "security": [{"BearerAuth": []}], "responses": {"200": {"description": "success response", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/SuccessResponse"}}}}, "401": {"description": "unauthorized response", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/UnauthorizedResponse"}}}}, "default": {"description": "error response", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/ErrorResponse"}}}}}}, "put": {"tags": ["admins"], "summary": "Updates a roadmap", "operationId": "updateRoadmap", "requestBody": {"description": "Roadmap to update", "required": true, "content": {"application/json": {"schema": {"$ref": "#/components/schemas/Roadmap"}}}}, "security": [{"BearerAuth": []}], "responses": {"200": {"description": "success response", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/SuccessResponse"}}}}, "401": {"description": "unauthorized response", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/UnauthorizedResponse"}}}}, "default": {"description": "error response", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/ErrorResponse"}}}}}}}, "/roadmap/{roadmapID}/full": {"get": {"tags": ["public"], "summary": "Gets a specific roadmap with all milestones, tasks and sub tasks", "operationId": "roadmapFull", "parameters": [{"in": "path", "name": "roadmapID", "description": "The roadmap ID", "required": true, "schema": {"type": "integer"}}], "responses": {"200": {"description": "The roadmap", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/RoadmapFull"}}}}}}}, "/milestones/{roadmapID}": {"get": {"tags": ["public"], "summary": "Gets all milestones for a roadmap", "operationId": "milestones", "parameters": [{"in": "path", "name": "roadmapID", "description": "The roadmap ID", "required": true, "schema": {"type": "integer"}}], "responses": {"200": {"description": "All milestones for the given roadmap ID", "content": {"application/json": {"schema": {"type": "array", "items": {"$ref": "#/components/schemas/Milestone"}}}}}}}}, "/milestones/{roadmapID}/open": {"get": {"tags": ["public"], "summary": "Gets all open milestones for a roadmap", "operationId": "openMilestones", "parameters": [{"in": "path", "name": "roadmapID", "description": "The roadmap ID", "required": true, "schema": {"type": "integer"}}], "responses": {"200": {"description": "All open milestones for the given roadmap ID", "content": {"application/json": {"schema": {"type": "array", "items": {"$ref": "#/components/schemas/Milestone"}}}}}}}}, "/milestones/{roadmapID}/latest": {"get": {"tags": ["public"], "summary": "Gets the lastest finished milestone for a roadmap", "operationId": "latestMilestone", "parameters": [{"in": "path", "name": "roadmapID", "description": "The roadmap ID", "required": true, "schema": {"type": "integer"}}], "responses": {"200": {"description": "The latest finished milestone for the given roadmap ID", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/Milestone"}}}}}}}, "/milestone/{milestoneID}": {"get": {"tags": ["public"], "summary": "Gets a specific milestone", "operationId": "milestone", "parameters": [{"in": "path", "name": "milestoneID", "description": "The milestone ID", "required": true, "schema": {"type": "string"}}], "responses": {"200": {"description": "The milestone", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/Milestone"}}}}}}, "delete": {"tags": ["admins"], "description": "Deletes a milestone based on the given ID", "operationId": "deleteMilestone", "parameters": [{"in": "path", "name": "milestoneID", "description": "The milestone ID", "required": true, "schema": {"type": "integer"}}], "security": [{"BearerAuth": []}], "responses": {"200": {"description": "success response", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/SuccessResponse"}}}}, "401": {"description": "unauthorized response", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/UnauthorizedResponse"}}}}, "default": {"description": "error response", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/ErrorResponse"}}}}}}}, "/milestone": {"post": {"tags": ["admins"], "summary": "Adds a new milestone", "operationId": "addMilestone", "requestBody": {"description": "Milestone to add", "required": true, "content": {"application/json": {"schema": {"$ref": "#/components/schemas/NewMilestone"}}}}, "security": [{"BearerAuth": []}], "responses": {"200": {"description": "success response", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/SuccessResponse"}}}}, "401": {"description": "unauthorized response", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/UnauthorizedResponse"}}}}, "default": {"description": "error response", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/ErrorResponse"}}}}}}, "put": {"tags": ["admins"], "summary": "Updates a milestone", "operationId": "updateMilestone", "requestBody": {"description": "Milestone to update", "required": true, "content": {"application/json": {"schema": {"$ref": "#/components/schemas/Milestone"}}}}, "security": [{"BearerAuth": []}], "responses": {"200": {"description": "success response", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/SuccessResponse"}}}}, "401": {"description": "unauthorized response", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/UnauthorizedResponse"}}}}, "default": {"description": "error response", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/ErrorResponse"}}}}}}}, "/tasks/{milestoneID}": {"get": {"tags": ["public"], "summary": "Gets all tasks for a milestone", "operationId": "tasks", "parameters": [{"in": "path", "name": "milestoneID", "description": "The milestone ID", "required": true, "schema": {"type": "integer"}}], "responses": {"200": {"description": "All tasks for the given milestone ID", "content": {"application/json": {"schema": {"type": "array", "items": {"$ref": "#/components/schemas/Task"}}}}}}}}, "/tasks/{milestoneID}/open": {"get": {"tags": ["public"], "summary": "Gets all open tasks for a milestone", "operationId": "openTasks", "parameters": [{"in": "path", "name": "milestoneID", "description": "The milestone ID", "required": true, "schema": {"type": "integer"}}], "responses": {"200": {"description": "All open tasks for the given milestone ID", "content": {"application/json": {"schema": {"type": "array", "items": {"$ref": "#/components/schemas/Task"}}}}}}}}, "/task/{taskID}": {"get": {"tags": ["public"], "summary": "Gets a specific task", "operationId": "task", "parameters": [{"in": "path", "name": "taskID", "description": "The task ID", "required": true, "schema": {"type": "string"}}], "responses": {"200": {"description": "The task", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/Task"}}}}}}, "delete": {"tags": ["admins"], "description": "Deletes a task based on the given ID", "operationId": "deleteTask", "parameters": [{"in": "path", "name": "taskID", "description": "The task ID", "required": true, "schema": {"type": "integer"}}], "security": [{"BearerAuth": []}], "responses": {"200": {"description": "success response", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/SuccessResponse"}}}}, "401": {"description": "unauthorized response", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/UnauthorizedResponse"}}}}, "default": {"description": "error response", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/ErrorResponse"}}}}}}}, "/task": {"post": {"tags": ["admins"], "summary": "Adds a new task", "operationId": "addTask", "requestBody": {"description": "Task to add", "required": true, "content": {"application/json": {"schema": {"$ref": "#/components/schemas/NewTask"}}}}, "security": [{"BearerAuth": []}], "responses": {"200": {"description": "success response", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/SuccessResponse"}}}}, "401": {"description": "unauthorized response", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/UnauthorizedResponse"}}}}, "default": {"description": "error response", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/ErrorResponse"}}}}}}, "put": {"tags": ["admins"], "summary": "Updates a task", "operationId": "updateTask", "requestBody": {"description": "Task to update", "required": true, "content": {"application/json": {"schema": {"$ref": "#/components/schemas/Task"}}}}, "security": [{"BearerAuth": []}], "responses": {"200": {"description": "success response", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/SuccessResponse"}}}}, "401": {"description": "unauthorized response", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/UnauthorizedResponse"}}}}, "default": {"description": "error response", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/ErrorResponse"}}}}}}}, "/subtasks/{taskID}": {"get": {"tags": ["public"], "summary": "Gets all sub taks for a task", "operationId": "substasks", "parameters": [{"in": "path", "name": "taskID", "description": "The task ID", "required": true, "schema": {"type": "integer"}}], "responses": {"200": {"description": "All sub tasks for the given task ID", "content": {"application/json": {"schema": {"type": "array", "items": {"$ref": "#/components/schemas/SubTask"}}}}}}}}, "/subtasks/{taskID}/open": {"get": {"tags": ["public"], "summary": "Gets all open sub taks for a task", "operationId": "openSubtasks", "parameters": [{"in": "path", "name": "taskID", "description": "The task ID", "required": true, "schema": {"type": "integer"}}], "responses": {"200": {"description": "All open sub tasks for the given task ID", "content": {"application/json": {"schema": {"type": "array", "items": {"$ref": "#/components/schemas/SubTask"}}}}}}}}, "/subtask/{subtaskID}": {"get": {"tags": ["public"], "summary": "Gets a specific sub task", "operationId": "subtask", "parameters": [{"in": "path", "name": "subtaskID", "description": "The sub task ID", "required": true, "schema": {"type": "string"}}], "responses": {"200": {"description": "The sub task", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/SubTask"}}}}}}, "delete": {"tags": ["admins"], "description": "Deletes a sub task based on the given ID", "operationId": "deleteSubTask", "parameters": [{"in": "path", "name": "subtaskID", "description": "The sub task ID", "required": true, "schema": {"type": "integer"}}], "security": [{"BearerAuth": []}], "responses": {"200": {"description": "success response", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/SuccessResponse"}}}}, "401": {"description": "unauthorized response", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/UnauthorizedResponse"}}}}, "default": {"description": "error response", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/ErrorResponse"}}}}}}}, "/subtask": {"post": {"tags": ["admins"], "summary": "Adds a new sub task", "operationId": "addSubTask", "requestBody": {"description": "Sub task to add", "required": true, "content": {"application/json": {"schema": {"$ref": "#/components/schemas/NewSubTask"}}}}, "security": [{"BearerAuth": []}], "responses": {"200": {"description": "success response", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/SuccessResponse"}}}}, "401": {"description": "unauthorized response", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/UnauthorizedResponse"}}}}, "default": {"description": "error response", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/ErrorResponse"}}}}}}, "put": {"tags": ["admins"], "summary": "Updates a sub task", "operationId": "updateSubTask", "requestBody": {"description": "Sub task to update", "required": true, "content": {"application/json": {"schema": {"$ref": "#/components/schemas/SubTask"}}}}, "security": [{"BearerAuth": []}], "responses": {"200": {"description": "success response", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/SuccessResponse"}}}}, "401": {"description": "unauthorized response", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/UnauthorizedResponse"}}}}, "default": {"description": "error response", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/ErrorResponse"}}}}}}}}, "components": {"securitySchemes": {"BearerAuth": {"type": "http", "scheme": "bearer", "bearerFormat": "JWT"}}, "schemas": {"Version": {"type": "object", "required": ["code", "name", "date"], "properties": {"code": {"type": "integer", "example": 1}, "name": {"type": "string", "example": "v1.0.0"}, "date": {"type": "string", "format": "date", "example": "30.05.19"}}}, "Credentials": {"type": "object", "required": ["username", "password"], "properties": {"username": {"type": "string", "example": "admin"}, "password": {"type": "string", "example": "123"}}}, "Roadmap": {"type": "object", "required": ["ID", "Projectname"], "properties": {"ID": {"type": "integer", "example": 1}, "Projectname": {"type": "string", "example": "Example Roadmap"}}}, "RoadmapFull": {"allOf": [{"$ref": "#/components/schemas/Roadmap"}, {"type": "object", "properties": {"milestones": {"type": "array", "items": {"allOf": [{"$ref": "#/components/schemas/Milestone"}, {"type": "object", "properties": {"tasks": {"type": "array", "items": {"allOf": [{"$ref": "#/components/schemas/Task"}, {"type": "object", "properties": {"subtasks": {"type": "array", "items": {"$ref": "#/components/schemas/SubTask"}}}}]}}}}]}}}}]}, "NewRoadmap": {"type": "object", "required": ["ID", "Projectname"], "properties": {"ID": {"type": "integer", "example": 1}, "Projectname": {"type": "string", "example": "Example Roadmap"}}}, "Milestone": {"type": "object", "required": ["ID", "RoadmapID", "VersionCode", "VersionName", "Title", "DueDate", "CompletionDate", "Status"], "properties": {"ID": {"type": "integer", "example": 1}, "RoadmapID": {"type": "integer", "example": 2}, "VersionCode": {"type": "integer", "example": 3}, "VersionName": {"type": "string", "example": "v1.0.0"}, "Title": {"type": "string", "example": "My awesome milestone"}, "DueDate": {"type": "string", "format": "date", "example": "2019-05-30"}, "CompletionDate": {"type": "string", "format": "date", "example": "2019-05-30"}, "Status": {"type": "integer", "enum": [0, 1]}}}, "NewMilestone": {"type": "object", "required": ["RoadmapID", "VersionCode", "VersionName", "Title", "DueDate", "CompletionDate", "Status"], "properties": {"RoadmapID": {"type": "integer", "example": 2}, "VersionCode": {"type": "integer", "example": 3}, "VersionName": {"type": "string", "example": "v1.0.0"}, "Title": {"type": "string", "example": "My awesome milestone"}, "DueDate": {"type": "string", "format": "date", "example": "2019-05-30"}, "CompletionDate": {"type": "string", "format": "date", "example": "2019-05-30"}, "Status": {"type": "integer", "enum": [0, 1]}}}, "Task": {"type": "object", "required": ["ID", "MilestoneID", "Title", "Description", "Status"], "properties": {"ID": {"type": "integer", "example": 1}, "MilestoneID": {"type": "integer", "example": 2}, "Title": {"type": "string", "example": "My awesome task"}, "Description": {"type": "string", "example": "Lorem Ipsum dolor sit amet"}, "Status": {"type": "integer", "enum": [0, 1]}}}, "NewTask": {"type": "object", "required": ["MilestoneID", "Title", "Description", "Status"], "properties": {"MilestoneID": {"type": "integer", "example": 2}, "Title": {"type": "string", "example": "My awesome task"}, "Description": {"type": "string", "example": "Lorem Ipsum dolor sit amet"}, "Status": {"type": "integer", "enum": [0, 1]}}}, "SubTask": {"type": "object", "required": ["ID", "TaskID", "Title", "Description", "Status"], "properties": {"ID": {"type": "integer", "example": 1}, "TaskID": {"type": "integer", "example": 2}, "Title": {"type": "string", "example": "My awesome sub task"}, "Description": {"type": "string", "example": "Lorem Ipsum dolor sit amet"}, "Status": {"type": "integer", "enum": [0, 1]}}}, "NewSubTask": {"type": "object", "required": ["TaskID", "Title", "Description", "Status"], "properties": {"TaskID": {"type": "integer", "example": 2}, "Title": {"type": "string", "example": "My awesome sub task"}, "Description": {"type": "string", "example": "Lorem Ipsum dolor sit amet"}, "Status": {"type": "integer", "enum": [0, 1]}}}, "UnauthorizedResponse": {"description": "Access token is missing or invalid", "properties": {"msg": {"type": "string", "example": "Missing Authorization Header"}}}, "TokenResponse": {"description": "JSON web token", "properties": {"access_token": {"type": "string"}}}, "SuccessResponse": {"required": ["success"], "properties": {"success": {"type": "boolean"}}}, "ErrorResponse": {"required": ["success", "msg"], "properties": {"success": {"type": "boolean"}, "msg": {"type": "string"}}}}}}; + var spec = {"openapi": "3.0.0", "servers": [{"description": "Roadmaps API Server", "url": "https://roadmaps.thecodelabs.de:10000/"}], "info": {"description": "The Official Roadmaps API", "version": "2.3.4", "title": "Roadmaps API"}, "tags": [{"name": "admins", "description": "Secured Admin-only calls"}, {"name": "public", "description": "Operations available to the public"}], "paths": {"/version": {"get": {"tags": ["public"], "summary": "Gets information about the server version", "operationId": "version", "responses": {"200": {"description": "The server version information", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/Version"}}}}}}}, "/login": {"post": {"tags": ["public"], "summary": "Gets a bearer JSON Web Token", "operationId": "login", "requestBody": {"description": "Credentials", "required": true, "content": {"application/json": {"schema": {"$ref": "#/components/schemas/Credentials"}}}}, "responses": {"200": {"description": "success response", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/TokenResponse"}}}}, "401": {"description": "unauthorized response", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/UnauthorizedResponse"}}}}, "default": {"description": "error response", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/ErrorResponse"}}}}}}}, "/roadmaps": {"get": {"tags": ["public"], "summary": "Gets all roadmaps", "operationId": "roadmaps", "responses": {"200": {"description": "All available roadmaps", "content": {"application/json": {"schema": {"type": "array", "items": {"$ref": "#/components/schemas/Roadmap"}}}}}}}}, "/roadmap/{roadmapID}": {"get": {"tags": ["public"], "summary": "Gets a specific roadmap", "operationId": "roadmap", "parameters": [{"in": "path", "name": "roadmapID", "description": "The roadmap ID", "required": true, "schema": {"type": "integer"}}], "responses": {"200": {"description": "The roadmap", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/Roadmap"}}}}}}, "delete": {"tags": ["admins"], "description": "Deletes a roadmap based on the given ID", "operationId": "deleteRoadmap", "parameters": [{"in": "path", "name": "roadmapID", "description": "The roadmap ID", "required": true, "schema": {"type": "integer"}}], "security": [{"BearerAuth": []}], "responses": {"200": {"description": "success response", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/SuccessResponse"}}}}, "401": {"description": "unauthorized response", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/UnauthorizedResponse"}}}}, "default": {"description": "error response", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/ErrorResponse"}}}}}}}, "/roadmap": {"post": {"tags": ["admins"], "summary": "Adds a new roadmap", "operationId": "addRoadmap", "requestBody": {"description": "Roadmap to add", "required": true, "content": {"application/json": {"schema": {"$ref": "#/components/schemas/NewRoadmap"}}}}, "security": [{"BearerAuth": []}], "responses": {"200": {"description": "success response", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/SuccessResponse"}}}}, "401": {"description": "unauthorized response", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/UnauthorizedResponse"}}}}, "default": {"description": "error response", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/ErrorResponse"}}}}}}, "put": {"tags": ["admins"], "summary": "Updates a roadmap", "operationId": "updateRoadmap", "requestBody": {"description": "Roadmap to update", "required": true, "content": {"application/json": {"schema": {"$ref": "#/components/schemas/Roadmap"}}}}, "security": [{"BearerAuth": []}], "responses": {"200": {"description": "success response", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/SuccessResponse"}}}}, "401": {"description": "unauthorized response", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/UnauthorizedResponse"}}}}, "default": {"description": "error response", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/ErrorResponse"}}}}}}}, "/roadmap/{roadmapID}/full": {"get": {"tags": ["public"], "summary": "Gets a specific roadmap with all milestones, tasks and sub tasks", "operationId": "roadmapFull", "parameters": [{"in": "path", "name": "roadmapID", "description": "The roadmap ID", "required": true, "schema": {"type": "integer"}}], "responses": {"200": {"description": "The roadmap", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/RoadmapFull"}}}}}}}, "/milestones/{roadmapID}": {"get": {"tags": ["public"], "summary": "Gets all milestones for a roadmap", "operationId": "milestones", "parameters": [{"in": "path", "name": "roadmapID", "description": "The roadmap ID", "required": true, "schema": {"type": "integer"}}], "responses": {"200": {"description": "All milestones for the given roadmap ID", "content": {"application/json": {"schema": {"type": "array", "items": {"$ref": "#/components/schemas/Milestone"}}}}}}}}, "/milestones/{roadmapID}/open": {"get": {"tags": ["public"], "summary": "Gets all open milestones for a roadmap", "operationId": "openMilestones", "parameters": [{"in": "path", "name": "roadmapID", "description": "The roadmap ID", "required": true, "schema": {"type": "integer"}}], "responses": {"200": {"description": "All open milestones for the given roadmap ID", "content": {"application/json": {"schema": {"type": "array", "items": {"$ref": "#/components/schemas/Milestone"}}}}}}}}, "/milestones/{roadmapID}/latest": {"get": {"tags": ["public"], "summary": "Gets the lastest finished milestone for a roadmap", "operationId": "latestMilestone", "parameters": [{"in": "path", "name": "roadmapID", "description": "The roadmap ID", "required": true, "schema": {"type": "integer"}}], "responses": {"200": {"description": "The latest finished milestone for the given roadmap ID", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/Milestone"}}}}}}}, "/milestone/{milestoneID}": {"get": {"tags": ["public"], "summary": "Gets a specific milestone", "operationId": "milestone", "parameters": [{"in": "path", "name": "milestoneID", "description": "The milestone ID", "required": true, "schema": {"type": "string"}}], "responses": {"200": {"description": "The milestone", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/Milestone"}}}}}}, "delete": {"tags": ["admins"], "description": "Deletes a milestone based on the given ID", "operationId": "deleteMilestone", "parameters": [{"in": "path", "name": "milestoneID", "description": "The milestone ID", "required": true, "schema": {"type": "integer"}}], "security": [{"BearerAuth": []}], "responses": {"200": {"description": "success response", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/SuccessResponse"}}}}, "401": {"description": "unauthorized response", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/UnauthorizedResponse"}}}}, "default": {"description": "error response", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/ErrorResponse"}}}}}}}, "/milestone": {"post": {"tags": ["admins"], "summary": "Adds a new milestone", "operationId": "addMilestone", "requestBody": {"description": "Milestone to add", "required": true, "content": {"application/json": {"schema": {"$ref": "#/components/schemas/NewMilestone"}}}}, "security": [{"BearerAuth": []}], "responses": {"200": {"description": "success response", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/SuccessResponse"}}}}, "401": {"description": "unauthorized response", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/UnauthorizedResponse"}}}}, "default": {"description": "error response", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/ErrorResponse"}}}}}}, "put": {"tags": ["admins"], "summary": "Updates a milestone", "operationId": "updateMilestone", "requestBody": {"description": "Milestone to update", "required": true, "content": {"application/json": {"schema": {"$ref": "#/components/schemas/Milestone"}}}}, "security": [{"BearerAuth": []}], "responses": {"200": {"description": "success response", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/SuccessResponse"}}}}, "401": {"description": "unauthorized response", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/UnauthorizedResponse"}}}}, "default": {"description": "error response", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/ErrorResponse"}}}}}}}, "/tasks/{milestoneID}": {"get": {"tags": ["public"], "summary": "Gets all tasks for a milestone", "operationId": "tasks", "parameters": [{"in": "path", "name": "milestoneID", "description": "The milestone ID", "required": true, "schema": {"type": "integer"}}], "responses": {"200": {"description": "All tasks for the given milestone ID", "content": {"application/json": {"schema": {"type": "array", "items": {"$ref": "#/components/schemas/Task"}}}}}}}}, "/tasks/{milestoneID}/open": {"get": {"tags": ["public"], "summary": "Gets all open tasks for a milestone", "operationId": "openTasks", "parameters": [{"in": "path", "name": "milestoneID", "description": "The milestone ID", "required": true, "schema": {"type": "integer"}}], "responses": {"200": {"description": "All open tasks for the given milestone ID", "content": {"application/json": {"schema": {"type": "array", "items": {"$ref": "#/components/schemas/Task"}}}}}}}}, "/task/{taskID}": {"get": {"tags": ["public"], "summary": "Gets a specific task", "operationId": "task", "parameters": [{"in": "path", "name": "taskID", "description": "The task ID", "required": true, "schema": {"type": "string"}}], "responses": {"200": {"description": "The task", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/Task"}}}}}}, "delete": {"tags": ["admins"], "description": "Deletes a task based on the given ID", "operationId": "deleteTask", "parameters": [{"in": "path", "name": "taskID", "description": "The task ID", "required": true, "schema": {"type": "integer"}}], "security": [{"BearerAuth": []}], "responses": {"200": {"description": "success response", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/SuccessResponse"}}}}, "401": {"description": "unauthorized response", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/UnauthorizedResponse"}}}}, "default": {"description": "error response", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/ErrorResponse"}}}}}}}, "/task": {"post": {"tags": ["admins"], "summary": "Adds a new task", "operationId": "addTask", "requestBody": {"description": "Task to add", "required": true, "content": {"application/json": {"schema": {"$ref": "#/components/schemas/NewTask"}}}}, "security": [{"BearerAuth": []}], "responses": {"200": {"description": "success response", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/SuccessResponse"}}}}, "401": {"description": "unauthorized response", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/UnauthorizedResponse"}}}}, "default": {"description": "error response", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/ErrorResponse"}}}}}}, "put": {"tags": ["admins"], "summary": "Updates a task", "operationId": "updateTask", "requestBody": {"description": "Task to update", "required": true, "content": {"application/json": {"schema": {"$ref": "#/components/schemas/Task"}}}}, "security": [{"BearerAuth": []}], "responses": {"200": {"description": "success response", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/SuccessResponse"}}}}, "401": {"description": "unauthorized response", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/UnauthorizedResponse"}}}}, "default": {"description": "error response", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/ErrorResponse"}}}}}}}, "/subtasks/{taskID}": {"get": {"tags": ["public"], "summary": "Gets all sub taks for a task", "operationId": "substasks", "parameters": [{"in": "path", "name": "taskID", "description": "The task ID", "required": true, "schema": {"type": "integer"}}], "responses": {"200": {"description": "All sub tasks for the given task ID", "content": {"application/json": {"schema": {"type": "array", "items": {"$ref": "#/components/schemas/SubTask"}}}}}}}}, "/subtasks/{taskID}/open": {"get": {"tags": ["public"], "summary": "Gets all open sub taks for a task", "operationId": "openSubtasks", "parameters": [{"in": "path", "name": "taskID", "description": "The task ID", "required": true, "schema": {"type": "integer"}}], "responses": {"200": {"description": "All open sub tasks for the given task ID", "content": {"application/json": {"schema": {"type": "array", "items": {"$ref": "#/components/schemas/SubTask"}}}}}}}}, "/subtask/{subtaskID}": {"get": {"tags": ["public"], "summary": "Gets a specific sub task", "operationId": "subtask", "parameters": [{"in": "path", "name": "subtaskID", "description": "The sub task ID", "required": true, "schema": {"type": "string"}}], "responses": {"200": {"description": "The sub task", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/SubTask"}}}}}}, "delete": {"tags": ["admins"], "description": "Deletes a sub task based on the given ID", "operationId": "deleteSubTask", "parameters": [{"in": "path", "name": "subtaskID", "description": "The sub task ID", "required": true, "schema": {"type": "integer"}}], "security": [{"BearerAuth": []}], "responses": {"200": {"description": "success response", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/SuccessResponse"}}}}, "401": {"description": "unauthorized response", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/UnauthorizedResponse"}}}}, "default": {"description": "error response", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/ErrorResponse"}}}}}}}, "/subtask": {"post": {"tags": ["admins"], "summary": "Adds a new sub task", "operationId": "addSubTask", "requestBody": {"description": "Sub task to add", "required": true, "content": {"application/json": {"schema": {"$ref": "#/components/schemas/NewSubTask"}}}}, "security": [{"BearerAuth": []}], "responses": {"200": {"description": "success response", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/SuccessResponse"}}}}, "401": {"description": "unauthorized response", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/UnauthorizedResponse"}}}}, "default": {"description": "error response", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/ErrorResponse"}}}}}}, "put": {"tags": ["admins"], "summary": "Updates a sub task", "operationId": "updateSubTask", "requestBody": {"description": "Sub task to update", "required": true, "content": {"application/json": {"schema": {"$ref": "#/components/schemas/SubTask"}}}}, "security": [{"BearerAuth": []}], "responses": {"200": {"description": "success response", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/SuccessResponse"}}}}, "401": {"description": "unauthorized response", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/UnauthorizedResponse"}}}}, "default": {"description": "error response", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/ErrorResponse"}}}}}}}}, "components": {"securitySchemes": {"BearerAuth": {"type": "http", "scheme": "bearer", "bearerFormat": "JWT"}}, "schemas": {"Version": {"type": "object", "required": ["code", "name", "date"], "properties": {"code": {"type": "integer", "example": 1}, "name": {"type": "string", "example": "v1.0.0"}, "date": {"type": "string", "format": "date", "example": "30.05.19"}}}, "Credentials": {"type": "object", "required": ["username", "password"], "properties": {"username": {"type": "string", "example": "admin"}, "password": {"type": "string", "example": "123"}}}, "Roadmap": {"type": "object", "required": ["ID", "Projectname"], "properties": {"ID": {"type": "integer", "example": 1}, "Projectname": {"type": "string", "example": "Example Roadmap"}}}, "RoadmapFull": {"allOf": [{"$ref": "#/components/schemas/Roadmap"}, {"type": "object", "properties": {"milestones": {"type": "array", "items": {"allOf": [{"$ref": "#/components/schemas/Milestone"}, {"type": "object", "properties": {"tasks": {"type": "array", "items": {"allOf": [{"$ref": "#/components/schemas/Task"}, {"type": "object", "properties": {"subtasks": {"type": "array", "items": {"$ref": "#/components/schemas/SubTask"}}}}]}}}}]}}}}]}, "NewRoadmap": {"type": "object", "required": ["ID", "Projectname"], "properties": {"ID": {"type": "integer", "example": 1}, "Projectname": {"type": "string", "example": "Example Roadmap"}}}, "Milestone": {"type": "object", "required": ["ID", "RoadmapID", "VersionCode", "VersionName", "Title", "DueDate", "CompletionDate", "Status"], "properties": {"ID": {"type": "integer", "example": 1}, "RoadmapID": {"type": "integer", "example": 2}, "VersionCode": {"type": "integer", "example": 3}, "VersionName": {"type": "string", "example": "v1.0.0"}, "Title": {"type": "string", "example": "My awesome milestone"}, "DueDate": {"type": "string", "format": "date", "example": "2019-05-30"}, "CompletionDate": {"type": "string", "format": "date", "example": "2019-05-30"}, "Status": {"type": "integer", "enum": [0, 1]}}}, "NewMilestone": {"type": "object", "required": ["RoadmapID", "VersionCode", "VersionName", "Title", "DueDate", "CompletionDate", "Status"], "properties": {"RoadmapID": {"type": "integer", "example": 2}, "VersionCode": {"type": "integer", "example": 3}, "VersionName": {"type": "string", "example": "v1.0.0"}, "Title": {"type": "string", "example": "My awesome milestone"}, "DueDate": {"type": "string", "format": "date", "example": "2019-05-30"}, "CompletionDate": {"type": "string", "format": "date", "example": "2019-05-30"}, "Status": {"type": "integer", "enum": [0, 1]}}}, "Task": {"type": "object", "required": ["ID", "MilestoneID", "Title", "Description", "Status"], "properties": {"ID": {"type": "integer", "example": 1}, "MilestoneID": {"type": "integer", "example": 2}, "Title": {"type": "string", "example": "My awesome task"}, "Description": {"type": "string", "example": "Lorem Ipsum dolor sit amet"}, "Status": {"type": "integer", "enum": [0, 1]}}}, "NewTask": {"type": "object", "required": ["MilestoneID", "Title", "Description", "Status"], "properties": {"MilestoneID": {"type": "integer", "example": 2}, "Title": {"type": "string", "example": "My awesome task"}, "Description": {"type": "string", "example": "Lorem Ipsum dolor sit amet"}, "Status": {"type": "integer", "enum": [0, 1]}}}, "SubTask": {"type": "object", "required": ["ID", "TaskID", "Title", "Description", "Status"], "properties": {"ID": {"type": "integer", "example": 1}, "TaskID": {"type": "integer", "example": 2}, "Title": {"type": "string", "example": "My awesome sub task"}, "Description": {"type": "string", "example": "Lorem Ipsum dolor sit amet"}, "Status": {"type": "integer", "enum": [0, 1]}}}, "NewSubTask": {"type": "object", "required": ["TaskID", "Title", "Description", "Status"], "properties": {"TaskID": {"type": "integer", "example": 2}, "Title": {"type": "string", "example": "My awesome sub task"}, "Description": {"type": "string", "example": "Lorem Ipsum dolor sit amet"}, "Status": {"type": "integer", "enum": [0, 1]}}}, "UnauthorizedResponse": {"description": "Access token is missing or invalid", "properties": {"msg": {"type": "string", "example": "Missing Authorization Header"}}}, "TokenResponse": {"description": "JSON web token", "properties": {"access_token": {"type": "string"}}}, "SuccessResponse": {"required": ["success"], "properties": {"success": {"type": "boolean"}}}, "ErrorResponse": {"required": ["success", "msg"], "properties": {"success": {"type": "boolean"}, "msg": {"type": "string"}}}}}}; // Build a system const ui = SwaggerUIBundle({ diff --git a/api/docs/api.yml b/api/docs/api.yml index 9282b269cc62cda0f651616637ac3e64ca38678b..c4034f81cfa35f744444952f31e75aae9403c548 100644 --- a/api/docs/api.yml +++ b/api/docs/api.yml @@ -4,7 +4,7 @@ servers: url: https://roadmaps.thecodelabs.de:10000/ info: description: The Official Roadmaps API - version: "2.3.3" + version: "2.3.4" title: Roadmaps API tags: - name: admins diff --git a/api/version.json b/api/version.json index 75451741ae2d550554c34a05eb326aeb1666b914..01f1bb04f3bb4695dfb3cf3954501bb8a7d10ead 100644 --- a/api/version.json +++ b/api/version.json @@ -1,7 +1,7 @@ { "version": { - "name": "v2.3.3", - "code": 10, - "date": "29.07.19" + "name": "v2.3.4", + "code": 11, + "date": "30.07.19" } } \ No newline at end of file