feat(api): implement task CRUD API endpoints#5
Merged
raychrisgdp merged 3 commits intomainfrom Jan 3, 2026
Merged
Conversation
- Set DEBUG to false in .env.example for production readiness. - Removed unnecessary database and LLM configuration options from .env.example. - Updated the Typer dependency in pyproject.toml and uv.lock to remove the 'all' extra, simplifying the installation process. - Improved developer quickstart instructions for installing dependencies and running the application. - Enhanced PR-002 task CRUD API documentation with additional details on response shapes and pagination. These changes aim to streamline configuration, clarify setup instructions, and improve API documentation.
- Added a new API v1 for task management, including endpoints for creating, retrieving, updating, and deleting tasks. - Introduced task schemas for request validation and response formatting. - Implemented error handling for task not found scenarios with a standardized error response. - Updated the Makefile to include precommit checks in the test coverage command. - Removed linting step from CI workflow to streamline the testing process. These changes enhance the API functionality for task management and improve error handling, contributing to a more robust application.
- Add model_validator to TaskUpdate to reject title: null (prevents DB integrity errors) - Fix async generator return type annotation in test fixture - Add noqa comment for magic number in pagination test - Add test for null title rejection Fixes CI/CD issues: mypy errors and ruff warnings
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Issues & Goals:
Implementation Highlights:
POST /api/v1/tasks,GET /api/v1/tasks,GET /api/v1/tasks/{id},PATCH /api/v1/tasks/{id},DELETE /api/v1/tasks/{id}) inbackend/api/v1/tasks.pybackend/services/task_service.py) with business logic for task operations, filtering, and paginationbackend/schemas/task.py) for request/response validation withTaskCreate,TaskUpdate,TaskResponse,TaskListResponse, andErrorResponsetotal,page, andpage_sizefields with default ordering (created_at DESC, id ASC) for stable pagination{"error": "...", "code": "TASK_NOT_FOUND"}shape for 404sattachments: []placeholder until PR-004 lands (no attachment joins)tests/api/test_tasks.py) covering CRUD operations, validation, filtering, pagination, and error cases (24 tests).env.exampleto focus on essential settings, updateddocs/DEVELOPER_QUICKSTART.mdwith API testing instructions, and updated PR spec with implementation detailsHow to Test
Backend API Testing:
Start the API server:
Swagger UI Testing:
http://127.0.0.1:8080/docsin your browserAPI Endpoint Testing with curl:
Expected API Behavior:
id,created_at,updated_at, andattachments: []{"tasks": [...], "total": <int>, "page": <int>, "page_size": <int>}wherepage = floor(offset / limit) + 1{"error": "Task not found", "code": "TASK_NOT_FOUND"}total(total count matching filters),page(calculated from offset/limit), andpage_size(limit value)created_at DESC, id ASCfor stable paginationattachments: []as empty list (placeholder for PR-004)Validation Testing:
Filtering and Pagination Testing:
Automated Test Execution:
Expected Behavior:
total,page, andpage_sizefieldscreated_at DESC, id ASCby defaultattachments: []as empty list{"error": "...", "code": "TASK_NOT_FOUND"}Related Issues
Author Checklist
mainbranchAdditional Notes
Key Implementation Areas for Review
Backend API:
backend/api/v1/tasks.py: FastAPI router with 5 CRUD endpoints - verify error handling, response models, and query parameter validationbackend/main.py: Router registration at/api/v1prefix - verify FastAPI app configurationService Layer:
backend/services/task_service.py: Business logic for task operations - verify filtering logic, pagination calculation (page = floor(offset / limit) + 1), and default ordering (created_at DESC, id ASC)backend/services/__init__.py: Service exports - verify public API exports match usageSchemas:
backend/schemas/task.py: Pydantic schemas for validation - verifyTaskCreate,TaskUpdate,TaskResponse,TaskListResponse, andErrorResponsematch API contractTaskResponseincludesattachments: []as empty list (placeholder for PR-004)TaskListResponseincludestotal,page, andpage_sizefieldsTesting:
tests/api/test_tasks.py: Comprehensive API test suite (24 tests) - verify CRUD operations, validation, filtering, pagination, and error cases are coveredtmp_pathfixture)Configuration & Documentation:
.env.example: Simplified configuration - verify only essential settings are includeddocs/02-implementation/pr-specs/PR-002-task-crud-api.md: Spec updates - verify implementation matches spec requirementsdocs/DEVELOPER_QUICKSTART.md: Dev setup instructions - verify API testing commands are accuratepyproject.toml: Dependency updates - verifytyperdependency change (removed[all]extra)Testing Notes
total,page,page_size) and default ordering{"error": "...", "code": "TASK_NOT_FOUND"}shape for 404sattachments: []as empty list (placeholder until PR-004)page = floor(offset / limit) + 1when limit > 0, otherwise page = 1created_at DESC, id ASCfor stable pagination across requests/docs) or curl commands to test endpoints interactivelytmp_pathfixture for isolated database per test