--- task_id: sprint_4_story_2_task_1 story_id: sprint_4_story_2 sprint_id: sprint_4 status: not_started type: frontend assignee: Frontend Developer 2 created_date: 2025-11-05 estimated_hours: 2 --- # Task 1: Verify Task API Endpoints and Create Task Types ## Description Verify that all Task API endpoints are working correctly and create TypeScript types for Task entities. This task ensures the backend is ready and establishes the type-safe foundation for Task management. ## What to Do 1. Test Task API endpoints using Postman or Swagger 2. Verify GET /api/v1/stories/{storyId}/tasks returns Task list 3. Verify POST /api/v1/tasks creates Task correctly 4. Verify PUT /api/v1/tasks/{id} updates Task 5. Verify DELETE /api/v1/tasks/{id} deletes Task 6. Verify PUT /api/v1/tasks/{id}/status changes status 7. Check multi-tenant isolation (cannot access other tenant Tasks) 8. Add Task types to `types/project.ts` 9. Document any API quirks or issues ## Files to Create/Modify - `types/project.ts` (modify, add Task types ~50 lines) ## Implementation Details ```typescript // types/project.ts // Add these Task types export interface Task { id: string; title: string; description?: string; storyId: string; projectId: string; status: WorkItemStatus; priority: WorkItemPriority; estimatedHours?: number; actualHours?: number; assigneeId?: string; tenantId: string; createdAt: string; updatedAt: string; createdBy?: string; updatedBy?: string; } export interface CreateTaskDto { storyId: string; projectId?: string; // May be auto-filled from Story title: string; description?: string; priority: WorkItemPriority; estimatedHours?: number; createdBy: string; } export interface UpdateTaskDto { title?: string; description?: string; priority?: WorkItemPriority; estimatedHours?: number; actualHours?: number; } export interface ChangeTaskStatusDto { status: WorkItemStatus; } export interface AssignTaskDto { assigneeId: string; } // Add Task to existing types if needed export interface Story { // ... existing fields taskCount?: number; // Optional: count of Tasks tasks?: Task[]; // Optional: nested Tasks } ``` ## API Testing Checklist **GET /api/v1/stories/{storyId}/tasks** - List Tasks: ```bash # Expected: 200 OK, array of Tasks curl -H "Authorization: Bearer {token}" \ GET https://api.colaflow.com/api/v1/stories/{storyId}/tasks # Test cases: # - Valid storyId → Returns tasks array # - Empty story → Returns [] # - Invalid storyId → Returns 404 # - Other tenant story → Returns 403 or empty array ``` **POST /api/v1/tasks** - Create Task: ```bash # Expected: 201 Created, Task object curl -H "Authorization: Bearer {token}" \ -H "Content-Type: application/json" \ -d '{ "storyId": "story-123", "title": "Implement login API", "description": "Create POST /auth/login endpoint", "priority": "High", "estimatedHours": 8, "createdBy": "user-123" }' \ POST https://api.colaflow.com/api/v1/tasks # Test cases: # - Valid data → Creates task # - Missing title → Returns 400 validation error # - Invalid storyId → Returns 404 or 400 # - Missing storyId → Returns 400 ``` **PUT /api/v1/tasks/{id}** - Update Task: ```bash # Expected: 200 OK, updated Task object curl -H "Authorization: Bearer {token}" \ -H "Content-Type: application/json" \ -d '{ "title": "Updated title", "priority": "Critical" }' \ PUT https://api.colaflow.com/api/v1/tasks/{id} # Test cases: # - Valid update → Returns updated task # - Invalid taskId → Returns 404 # - Other tenant task → Returns 403 ``` **DELETE /api/v1/tasks/{id}** - Delete Task: ```bash # Expected: 204 No Content or 200 OK curl -H "Authorization: Bearer {token}" \ DELETE https://api.colaflow.com/api/v1/tasks/{id} # Test cases: # - Valid taskId → Deletes task # - Invalid taskId → Returns 404 # - Other tenant task → Returns 403 ``` **PUT /api/v1/tasks/{id}/status** - Change Status: ```bash # Expected: 200 OK, updated Task object curl -H "Authorization: Bearer {token}" \ -H "Content-Type: application/json" \ -d '{ "status": "Done" }' \ PUT https://api.colaflow.com/api/v1/tasks/{id}/status # Test cases: # - Valid status → Updates status # - Invalid status → Returns 400 # - Other tenant task → Returns 403 ``` ## Acceptance Criteria - [ ] All Task API endpoints tested and working - [ ] GET endpoint returns Task list for Story - [ ] POST endpoint creates Task successfully - [ ] PUT endpoint updates Task correctly - [ ] DELETE endpoint removes Task - [ ] Status change endpoint works - [ ] Multi-tenant isolation verified (cannot access other tenant Tasks) - [ ] Task types added to `types/project.ts` - [ ] All Task fields properly typed - [ ] CreateTaskDto, UpdateTaskDto, ChangeTaskStatusDto defined - [ ] API quirks documented (if any) ## Testing **Postman/Swagger Testing**: 1. Import Task API collection (if available) 2. Test each endpoint with valid data 3. Test error cases (invalid IDs, missing fields, validation) 4. Verify responses match TypeScript types 5. Document any discrepancies **Expected API Behavior**: - All endpoints require authentication (JWT token) - All endpoints respect multi-tenant isolation (TenantId filter) - Validation errors return 400 with error details - Not found errors return 404 - Forbidden errors return 403 - Successful creates return 201 Created - Successful updates/deletes return 200 OK or 204 No Content ## Dependencies **Prerequisites**: - ✅ Task API ready (TasksController.cs) - ✅ JWT authentication working - ✅ Postman or Swagger access **Blocks**: - Task 2 (API client depends on verified endpoints) ## Estimated Time 2 hours ## Notes **Document API Issues**: If you find any API issues, document them clearly: - Missing fields in response - Unexpected validation rules - Incorrect HTTP status codes - Multi-tenant isolation not working - Performance issues (slow responses) **Communicate with Backend**: If API endpoints are not ready or have issues, immediately notify Backend team and Product Manager. This is a blocker for Story 2. **Fallback Plan**: If Task API is not ready, frontend can proceed with mock data for development, but API must be ready before Story 2 completion.