You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Feat: Implement DELETE /tasks/{task_id}/ API to soft delete a specific task (#46)
* feat: Add API to fetch a single task by ID
Implements the GET /tasks/{task_id} endpoint to retrieve details
of a specific task.
- Added get_by_id method to TaskRepository.
- Added get_task_by_id method to TaskService with error handling
for TaskNotFoundException and invalid ObjectId format.
- Updated TaskView to handle requests for a single task ID,
returning 404 for not found and 400 for invalid ID format.
- Added new URL pattern /tasks/<str:task_id> to todo/urls.py.
- Created GetTaskByIdResponse DTO for the response structure.
- Created TaskNotFoundException custom exception.
- Added PATH to ApiErrorSource enum for error reporting.
- Added new API error messages to todo/constants/messages.py.
- Added default SQLite DATABASES configuration to
todo_project/settings/base.py to ensure Django's test runner
operates correctly, resolving teardown errors.
- Added comprehensive unit tests for the new repository method,
service method, and view logic.
- Added integration tests for the new endpoint, covering success (200),
not found (404), and invalid ID format (400) scenarios.
* refactor: modified the class to include an __init__
method that sets a default descriptive error message, while still allowing a
custom message to be passed when raising the exception
* refactor(tests): address review feedback on task detail integration tests
.
- refactor to use existing
fixture instead of local mock data, improving test data consistency.
* refactor: address review feedback on exceptions and service logic
- Update to use a predefined constant
() for its default message,
improving consistency with message management.
- Correct instantiation in
to use instead of , aligning with Pydantic
field definitions and alias usage.
* refactor: Standardize Task API Views, Error Handling, and URLS
- Refactored the monolithic TaskView into TaskListView (handling GET /tasks for listing and POST /tasks for creation) and TaskDetailView (handling GET /tasks/{task_id} for retrieval).
- Updated URL configurations in to map to these new views, resolving previous Method Not Allowed errors and clarifying route responsibilities.
- Significantly enhanced the to provide consistent JSON structures for various error types.
- Ensured specific handling for (and s indicating invalid ID format), mapping them to HTTP 400 with a standardized error message ().
- Corrected logic to ensure objects consistently include a for generic exceptions.
- Streamlined error message usage from .
- Updated to explicitly raise when is encountered from the repository.
- Ensured pagination link generation in uses the correct URL name () via .
- Refined exception handling within service methods to use constants from .
- Consolidated error messages: removed and , relying on the primary messages ( and ).
- Removed an unnecessary docstring from as per review feedback.
- Updated all relevant unit and integration tests to reflect changes in view names, URL structures, error response formats, and constant usage.
- Ensured tests for invalid task IDs now correctly expect HTTP 400 and the standardized error message.
- Modified tests for the custom exception handler to align with its comprehensive error formatting.
* refactor: fixed the grammer and also changed the constant message
* fix(tasks): standardize invalid task ID error to 404 TaskNotFound
- modifies to handle
by raising a with the message
. This results in a consistent
HTTP 404 response when a task ID is malformed.
- generic exception handler within has also been
updated to raise .
- Integration tests (): Updated to expect an
HTTP 404 status and the revised error structure for invalid task ID formats.
- Unit tests (): Updated to assert that
is raised for invalid task ID formats.
* refactor: moved the TASK_NOT_FOUND and INVALID_TASK_ID_FORMAT to ValidationErrors
* refactor: moved the TASK_NOT_FOUND and INVALID_TASK_ID_FORMAT to ValidationErrors
* fix: Correct HTTP status and handling for invalid task ID format
* fix: Improve error handling for task ID issues and server errors
* refactor: Standardize InvalidId exception handling and naming
* refactor: Split TaskView, improve error handling & update tests
* refactor: Split TaskView, improve error handling & update tests
* fix: failing test
* chore: remove unnecessary comments
* feature: Implement the delete task API
* test: add test for view file
* test: add test for soft delete
* fix:merge conflicts
* fix: remove unnecessary spacing and simplify DB query logic
* fix: storing the task_id in variable
* refactor: remove unnecessary invalid ID exception handling
* refactor: remove unnecessary invalid ID exception handling
---------
Co-authored-by: Achintya-Chatterjee <[email protected]>
0 commit comments