diff --git a/todo-backend/README.md b/todo-backend/README.md new file mode 100644 index 0000000..493bc5f --- /dev/null +++ b/todo-backend/README.md @@ -0,0 +1,312 @@ +# Todo Backend + +#### Task Object: + +``` +{ + id: + taskId: + title: + description: | null + priority: LOW | MEDIUM | HIGH + status: TODO | IN_PROGRESS | DONE + assignee: { + id: + name: + } | null + labels: [ + { + name: + color: + createdAt: | null + updatedAt: | null + createdBy: { + id: + name: + } | null + updatedBy: { + id: + name: + } | null + } + ] + isAcknowledged: + isDeleted: + deferredDetails: { + deferredAt: | null + deferredTill: | null + deferredBy: | null + } + dueDate: + startDate: | null + createdAt: + updatedAt: | null + createdBy: + updatedBy: | null +} +``` + +#### DeferredDetails Object: + +``` +{ + deferredDate: | null + deferredTill: | null + deferredBy: | null +} +``` + +## **Requests** + +| Route | Description | +| :---------------------------: | :------------------------------: | +| [GET /v1/tasks](#get-tasks) | Return all tasks with pagination | +| [POST /v1/tasks](#post-tasks) | Creates new task | +| [GET /v1/health](#get-health) | Health check endpoint | + +## **GET /v1/tasks** + +Return all tasks with pagination support + +- **Params** + None +- **Query** + + - Optional: `page=[integer]` (Page number for pagination, default: 1) + - Optional: `limit=[integer]` (Number of items per page, default: from Settings) + +- **Success Response:** + + - **Code:** 200 + - **Content:** + ```json + { + "statusCode": 200, + "sucessMessage": "Tasks retrieved successfully", + "data": [ + { + "id": "", + "taskId": "", + "title": "", + "description": " | null", + "priority": "LOW | MEDIUM | HIGH", + "status": "TODO | IN_PROGRESS | DONE", + "assignee": { + "id": "", + "name": "" + } | null, + "isAcknowledged": "", + "labels": [ + { + "name": "", + "color": "", + "createdAt": " | null", + "updatedAt": " | null", + "createdBy": { + "id": "", + "name": "" + } | null, + "updatedBy": { + "id": "", + "name": "" + } | null + } + ], + "startDate": " | null", + "dueDate": " | null", + "createdAt": "", + "updatedAt": " | null", + "createdBy": { + "id": "", + "name": "" + }, + "updatedBy": { + "id": "", + "name": "" + } | null + } + ], + "links": { + "next": " | null", + "prev": " | null" + }, + "count":"number" + } + ``` + +- **Error Response:** + + - **Code:** 400 + - **Content:** + + ```json + { + "status": "validation_failed", + "statusCode": 400, + "errorMessage": "Validation Error", + "errors": [ + { + "field": "", + "message": "" + } + + ] + } + ``` + + - **Code:** 500 + - **Content:** + + ```json + { + "statusCode": 500, + "errorMessage": "An unexpected error occurred", + "errors": [ + { + "detail": "Internal server error" + } + ] + } + ``` + +## **POST /v1/tasks** + +Creates a new task + +- **Params** + None +- **Body** + + ```json + { + "title": "", + "description": " | null", + "priority": "LOW | MEDIUM | HIGH", + "status": "TODO | IN_PROGRESS | DONE", + "assignee": " | null", + "labels": [""], + "dueDate": "" + } + ``` + +- **Success Response:** + + - **Code:** 201 + - **Content:** + ```json + { + "statusCode": 201, + "sucessMessage": "Task created successfully", + "data": { + "id": "", + "taskId": "", // "TASK-1001" + "title": "", + "description": " | null", + "priority": "LOW | MEDIUM | HIGH", + "status": "TODO | IN_PROGRESS | DONE", + "assignee": { + "id": "", + "name": "" + } | null, + "isAcknowledged": "", + "labels": [ + { + "name": "", + "color": "", + "createdAt": "", + "updatedAt": null, + "createdBy": { + "id": "", + "name": "" + }, + "updatedBy": null + } + ], + "startDate": null, + "dueDate": " | null", + "createdAt": "", + "updatedAt": null, + "createdBy": { + "id": "", + "name": "" + }, + "updatedBy": null + } + } + ``` + +- **Error Response:** + - **Code:** 400 + - **Content:** + ```json + { + "status": "validation_failed" + "statusCode": 400, + "errorMessage": "Validation Error", + "errors": [ + { + "field": "", + "message": "" + }, + + ] + } + ``` + - **Code:** 500 + - **Content:** + ```json + { + "status": "internal_server_error" + "statusCode": 500, + "errorMessage": "An unexpected error occurred", + "errors": [ + { + "detail": "Internal server error" + } + ] + } + ``` + +## **GET /v1/health** + +Health check endpoint + +- **Params** + None +- **Query** + None + +- **Success Response:** + + - **Code:** 200 + - **Content:** + ```json + { + "status": "healthy" + } + ``` + +- **Error Response:** + - **Code:** 500 + - **Content:** + ```json + { + "status": "unhealthy" + } + ``` + +## **Error Codes** + +| Status Code | Description | +| :---------: | :----------------------------: | +| 200 | Success | +| 201 | Created | +| 400 | Bad Request (Validation Error) | +| 404 | Not Found | +| 500 | Internal Server Error |