Skip to content

jferi/TaskModel

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Task Management API Documentation

Setup

To set up the Task Management API locally:

  1. Clone the repository:

git clone https://github.com/jferi/TaskModel.git

  1. Install the required dependencies:

pip install -r requirements.txt

  1. Apply database migrations:

python manage.py migrate

  1. Run this Python code in your repository after installation:

python -m spacy download en_core_web_md

  1. Run the development server:

python manage.py runserver 8888

Endpoints

1. List Tasks

  • GET /tasks/

  • Retrieves a list of tasks.

Request:

GET /tasks/

Response:

JSON

[
    {
        "id": 1,
        "title": "Task 1",
        "description": "Description of Task 1",
        "creation_date": "2024-03-15T14:30:00Z",
        "due_date": null,
        "status": "pending"
    },
    {
        "id": 2,
        "title": "Task 2",
        "description": "Description of Task 2",
        "creation_date": "2024-03-16T09:25:00Z",
        "due_date": "2024-03-20T12:00:00Z",
        "status": "in_progress"
    }
]

2. Create Task

POST /tasks/

  • Creates a new task.

Request Body:

{
    "title": "New Task",
    "description": "Description of the new task",
    "due_date": "2024-03-30T12:00:00Z",
    "status": "pending"
}

Response:

JSON

{
	"id": 3,
	"title": "New Task",
	"description": "Description of the new task",
	"creation_date": "2024-03-15T16:45:00Z",
	"due_date": "2024-03-30T12:00:00Z",
	"status": "pending"
}

3. Update Task

PATCH/PUT /tasks/{id}/

  • Updates the specified task.

Request Body:

{
    "title": "Updated Task Title",
    "description": "Updated description",
    "status": "completed"
}

Response:

JSON

{
    "id": 3,
    "title": "Updated Task Title",
    "description": "Updated description",
    "creation_date": "2024-03-15T16:45:00Z",
    "due_date": "2024-03-30T12:00:00Z",
    "status": "completed"
}

4. Delete Task

DELETE /tasks/{id}/

  • Removes the specified task.

Response:

JSON

Success (200 OK): Task successfully deleted message.

   {
       "message": "Task successfully deleted."
   }

Failure (404 Not Found): Task not found message.

   {
       "error": "Task not found."
   }

5. Suggestions

GET /suggestions/

Retrieves a list of task suggestions based on the analysis of completed tasks. Suggestions are generated by identifying common patterns and keywords among completed tasks and proposing potential new tasks or follow-up actions.

Response:

JSON

Success (200 OK): List of suggested tasks.

   {
       "suggestions": [
           "Consider creating a follow-up action or a task related to -> Budget Report",
           "Consider creating a follow-up action or a task related to -> Project Plan",
           "Finalize Project A"
       ]
   }

Project review

Filtering and Ordering:

Decision: Implemented filtering and ordering backends using DjangoFilterBackend and filters.OrderingFilter. This decision provides flexibility in querying tasks, improving user experience by allowing users to sort and filter tasks based on their needs.

Task Suggestions Feature:

Decision: Developed a generate_suggestions function based on analyzing completed tasks. This feature aims to provide value-added suggestions to users by identifying common patterns and keywords in completed tasks.

Error Handling and Validation:

Decision: Custom validation logic was implemented for task due dates and status transitions to enforce business rules (e.g., a task cannot be due in the past, certain status transitions are not allowed). Assumption: Assumed that enforcing these rules at the serializer level would prevent invalid data entries and maintain the integrity of the application state.

About

Django TaskModel API for job interview

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages