Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add task service for get task API #12

Open
wants to merge 5 commits into
base: feat-get-todo-api-view-and-validator
Choose a base branch
from

Conversation

samarpan1738
Copy link
Contributor

@samarpan1738 samarpan1738 commented Dec 20, 2024

Date: 20 Dec 2024

Developer Name: Samarpan Harit



Issue Ticket Number

Description

  1. Add get tasks api response, task and label DTOs
  2. Add task service which fetches data from DB using repository and prepares the response from it
  3. Add tests for task service and task view
  4. For now using a dummy SYSTEM username. When we add authentication, we'll be using the correct use details here
Success Response URL - GET http://127.0.0.1:8000/v1/tasks?page=1&limit=1

Response Code: 200

{
    "links": {
        "next": "/v1/tasks?page=2&limit=1"
    },
    "tasks": [
        {
            "id": "672f7c5b775ee9f4471ff1dd",
            "displayId": "#1",
            "title": "created rest api",
            "priority": "HIGH",
            "status": "TODO",
            "assignee": {
                "id": "qMbT6M2GB65W7UHgJS4g",
                "name": "SYSTEM"
            },
            "labels": [
                {
                    "name": "Beginner Friendly",
                    "color": "#fa1e4e"
                }
            ],
            "startedAt": "2024-11-09T15:14:35.724000",
            "dueAt": "2024-11-09T15:14:35.724000",
            "createdAt": "2024-11-09T15:14:35.724000",
            "updatedAt": "2024-10-18T15:55:14.802000Z",
            "createdBy": {
                "id": "xQ1CkCncM8Novk252oAj",
                "name": "SYSTEM"
            },
            "updatedBy": {
                "id": "Kn5N4Z3mdvpkv0HpqUCt",
                "name": "SYSTEM"
            }
        }
    ]
}
Error Response (Incorrect query params) URL - GET http://127.0.0.1:8000/v1/tasks?page=1&limit=-1

Response Code: 400

{
    "statusCode": 400,
    "message": "Invalid request",
    "errors": [
        {
            "source": {
                "parameter": "limit"
            },
            "detail": "limit must be greater than or equal to 1"
        }
    ]
}

Documentation Updated?

  • Yes
  • No

Under Feature Flag

  • Yes
  • No

Database Changes

  • Yes
  • No

Breaking Changes

  • Yes
  • No

Development Tested?

  • Yes
  • No

Screenshots

Success Response Screenshot 2024-12-17 at 10 24 21 PM
Error Response (Incorrect query params) Screenshot 2024-12-17 at 10 24 38 PM

Test Coverage

Coverage report Screenshot 2024-12-21 at 12 08 54 AM

Additional Notes

The CI is failing right now because there an issue in the workflow. I have raised a PR to fix this. Once it's merged the CI should pass

@samarpan1738 samarpan1738 changed the title Feat get todo api view and service Add task service Dec 20, 2024
@samarpan1738 samarpan1738 changed the title Add task service Add task service implementing get tasks method Dec 20, 2024
@samarpan1738 samarpan1738 changed the title Add task service implementing get tasks method Add task service for get task API Dec 20, 2024
@samarpan1738 samarpan1738 force-pushed the feat-get-todo-api-view-and-validator branch from 074fa71 to f91df5a Compare December 22, 2024 19:38
@samarpan1738 samarpan1738 force-pushed the feat-get-todo-api-view-and-service branch from bf89c2a to 81848f5 Compare December 22, 2024 19:39
Comment on lines +10 to +13
createdAt: datetime | None = None
updatedAt: datetime | None = None
createdBy: UserDTO | None = None
updatedBy: UserDTO | None = None

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These values can ever be none?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes. This label DTO can be used in other places also
In get tasks API, we only need to send name and color of the label

from todo.dto.task_dto import TaskDTO


class GetTasksResponse(PaginatedResponse):

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why not TasksResponse?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants