plan(backend): Update task list

Generated by: Planning Agent
Timestamp: 2025-11-21T23:47:15.641944+00:00
Component: backend
This commit is contained in:
AI Agent 2025-11-21 23:47:15 +00:00
parent 1f9e1c7a86
commit 58632cda8a

View file

@ -2,7 +2,227 @@
"project": "mnemo_cards_backend", "project": "mnemo_cards_backend",
"component": "backend", "component": "backend",
"version": "1.0", "version": "1.0",
"generated_at": "2025-11-21T23:29:11.898583+00:00", "generated_at": "2025-01-27T12:00:00.000Z",
"generated_by": "planning_agent", "generated_by": "planning_agent",
"tasks": [ ] "tasks": [
{
"id": "BACKEND-001",
"title": "Add unit tests for TasksApiV2 getTasks endpoint",
"priority": "high",
"status": "pending",
"estimated_hours": 2.0,
"description": "Create comprehensive unit tests for the GET /api/v2/tasks endpoint. Test filtering by type, difficulty, status, tags, pagination, and error cases. Use mockito for mocking Isar database calls.",
"acceptance_criteria": [
"Test file created: test/api/v2/tasks_api_v2_test.dart",
"Tests cover: successful task retrieval, filtering by type/difficulty/status/tags, pagination (limit/offset), empty results, unauthorized access",
"All tests use mocked Isar instances (no real database calls)",
"10+ test cases pass with >80% coverage for getTasks method",
"Tests follow existing test patterns from other API tests"
],
"dependencies": [],
"files_to_modify": [
"mnemo_cards_backend/test/api/v2/tasks_api_v2_test.dart"
],
"component": "backend"
},
{
"id": "BACKEND-002",
"title": "Add unit tests for TasksApiV2 getTask endpoint",
"priority": "high",
"status": "pending",
"estimated_hours": 1.5,
"description": "Create unit tests for the GET /api/v2/tasks/{taskId} endpoint. Test successful retrieval, invalid task ID, task not found, and unauthorized access.",
"acceptance_criteria": [
"Tests added to test/api/v2/tasks_api_v2_test.dart",
"Tests cover: valid task retrieval, invalid task ID format, task not found (404), unauthorized access (401)",
"5+ test cases pass with >80% coverage for getTask method",
"All tests use mocked Isar instances"
],
"dependencies": ["BACKEND-001"],
"files_to_modify": [
"mnemo_cards_backend/test/api/v2/tasks_api_v2_test.dart"
],
"component": "backend"
},
{
"id": "BACKEND-003",
"title": "Add unit tests for TasksApiV2 startTask and completeTask endpoints",
"priority": "high",
"status": "pending",
"estimated_hours": 2.5,
"description": "Create unit tests for POST /api/v2/tasks/{taskId}/start and POST /api/v2/tasks/{taskId}/complete endpoints. Test successful operations, invalid states, task not found, and progress updates.",
"acceptance_criteria": [
"Tests added to test/api/v2/tasks_api_v2_test.dart",
"startTask tests: successful start, task not found, task not active, unauthorized access, progress update verification",
"completeTask tests: successful completion, invalid status transitions, proof URL handling, rewards application, progress update with rewards",
"15+ test cases pass with >80% coverage for both methods",
"All tests use mocked Isar instances"
],
"dependencies": ["BACKEND-001"],
"files_to_modify": [
"mnemo_cards_backend/test/api/v2/tasks_api_v2_test.dart"
],
"component": "backend"
},
{
"id": "BACKEND-004",
"title": "Add POST endpoint for creating new tasks (admin only)",
"priority": "high",
"status": "pending",
"estimated_hours": 2.5,
"description": "Implement POST /api/v2/tasks endpoint for creating new tasks. This should be admin-only. Validate input data, create task in database, and return created task. Include proper error handling.",
"acceptance_criteria": [
"POST /api/v2/tasks endpoint implemented in TasksApiV2",
"Endpoint requires admin authorization (use existing admin check patterns)",
"Validates required fields: title, description, type, difficulty, rewards, expiresAt",
"Validates task type is one of: app_internal, external, social",
"Validates difficulty is one of: easy, medium, hard",
"Creates task in Isar database with proper timestamps",
"Returns 201 status with created task JSON",
"Returns 400 for invalid input, 401 for unauthorized, 403 for non-admin",
"Integration test passes verifying task creation"
],
"dependencies": [],
"files_to_modify": [
"mnemo_cards_backend/lib/api/v2/tasks_api_v2.dart",
"mnemo_cards_backend/lib/api/v2/tasks_api_v2.g.dart"
],
"component": "backend"
},
{
"id": "BACKEND-005",
"title": "Add PUT endpoint for updating existing tasks (admin only)",
"priority": "medium",
"status": "pending",
"estimated_hours": 2.0,
"description": "Implement PUT /api/v2/tasks/{taskId} endpoint for updating tasks. Admin-only. Allow partial updates of task fields. Validate input and update task in database.",
"acceptance_criteria": [
"PUT /api/v2/tasks/{taskId} endpoint implemented",
"Endpoint requires admin authorization",
"Allows partial updates (only provided fields are updated)",
"Validates updated fields match schema constraints",
"Returns 200 with updated task JSON",
"Returns 404 if task not found, 400 for invalid input, 403 for non-admin",
"Integration test passes verifying task update"
],
"dependencies": ["BACKEND-004"],
"files_to_modify": [
"mnemo_cards_backend/lib/api/v2/tasks_api_v2.dart",
"mnemo_cards_backend/test/api/v2/tasks_api_v2_test.dart"
],
"component": "backend"
},
{
"id": "BACKEND-006",
"title": "Add task expiration check and auto-expire mechanism",
"priority": "medium",
"status": "pending",
"estimated_hours": 2.0,
"description": "Implement automatic task expiration checking. Tasks should be marked as expired when expiresAt date passes. Add middleware or helper method to check and update expired tasks. Update getTasks to filter out expired tasks by default.",
"acceptance_criteria": [
"Helper method _checkAndExpireTasks() implemented in TasksApiV2",
"Method checks tasks where expiresAt < now and status != 'expired'",
"Updates expired tasks status to 'expired'",
"getTasks endpoint filters out expired tasks by default (unless includeExpired=true query param)",
"startTask endpoint rejects expired tasks",
"Unit test verifies expiration logic",
"Integration test verifies expired tasks are filtered"
],
"dependencies": [],
"files_to_modify": [
"mnemo_cards_backend/lib/api/v2/tasks_api_v2.dart",
"mnemo_cards_backend/test/api/v2/tasks_api_v2_test.dart"
],
"component": "backend"
},
{
"id": "BACKEND-007",
"title": "Add task validation for external tasks requiring proof",
"priority": "medium",
"status": "pending",
"estimated_hours": 2.5,
"description": "Enhance completeTask endpoint to validate external tasks require proofUrl. Add validation logic to check task type and ensure proof is provided for external tasks. Return appropriate error if proof is missing.",
"acceptance_criteria": [
"completeTask validates proofUrl is required for external tasks",
"Returns 400 error if external task completed without proofUrl",
"Allows app_internal and social tasks to complete without proof",
"Validates proofUrl format (URL validation)",
"Unit tests cover all validation scenarios",
"Integration test verifies proof requirement enforcement"
],
"dependencies": ["BACKEND-003"],
"files_to_modify": [
"mnemo_cards_backend/lib/api/v2/tasks_api_v2.dart",
"mnemo_cards_backend/test/api/v2/tasks_api_v2_test.dart"
],
"component": "backend"
},
{
"id": "BACKEND-008",
"title": "Add endpoint to get user's task history and statistics",
"priority": "medium",
"status": "pending",
"estimated_hours": 2.0,
"description": "Implement GET /api/v2/users/me/tasks/history endpoint that returns user's completed tasks with completion dates, rewards earned, and statistics (total completed, total XP, total coins). Include pagination.",
"acceptance_criteria": [
"GET /api/v2/users/me/tasks/history endpoint implemented",
"Returns list of completed tasks from UserTaskResultModel",
"Includes task details, completion date, rewards, and status",
"Supports pagination with limit/offset query params",
"Returns statistics: totalCompleted, totalXp, totalCoins, completionRate",
"Returns 401 if unauthorized",
"Unit tests cover successful retrieval and pagination",
"Integration test verifies history retrieval"
],
"dependencies": [],
"files_to_modify": [
"mnemo_cards_backend/lib/api/v2/tasks_api_v2.dart",
"mnemo_cards_backend/test/api/v2/tasks_api_v2_test.dart"
],
"component": "backend"
},
{
"id": "BACKEND-009",
"title": "Add endpoint for task result approval (admin only)",
"priority": "low",
"status": "pending",
"estimated_hours": 2.5,
"description": "Implement POST /api/v2/tasks/results/{resultId}/approve and POST /api/v2/tasks/results/{resultId}/reject endpoints for admin review of external task submissions. Update UserTaskResultModel with approval status.",
"acceptance_criteria": [
"POST /api/v2/tasks/results/{resultId}/approve endpoint implemented (admin only)",
"POST /api/v2/tasks/results/{resultId}/reject endpoint implemented (admin only)",
"Approval updates UserTaskResultModel.approved and reviewedAt fields",
"Rejection updates status and reviewedAt",
"Returns 404 if result not found, 403 for non-admin",
"Unit tests cover approval/rejection flows",
"Integration test verifies admin approval workflow"
],
"dependencies": ["BACKEND-007"],
"files_to_modify": [
"mnemo_cards_backend/lib/api/v2/tasks_api_v2.dart",
"mnemo_cards_backend/test/api/v2/tasks_api_v2_test.dart"
],
"component": "backend"
},
{
"id": "BACKEND-010",
"title": "Add unit tests for getUserProgress and getTaskCategories endpoints",
"priority": "high",
"status": "pending",
"estimated_hours": 2.0,
"description": "Create unit tests for GET /api/v2/users/me/tasks/progress and GET /api/v2/tasks/categories endpoints. Test successful retrieval, progress initialization, category extraction, and error cases.",
"acceptance_criteria": [
"Tests added to test/api/v2/tasks_api_v2_test.dart",
"getUserProgress tests: existing progress retrieval, new progress initialization, unauthorized access",
"getTaskCategories tests: category extraction from all tasks, empty categories, unauthorized access",
"10+ test cases pass with >80% coverage for both methods",
"All tests use mocked Isar instances"
],
"dependencies": ["BACKEND-001"],
"files_to_modify": [
"mnemo_cards_backend/test/api/v2/tasks_api_v2_test.dart"
],
"component": "backend"
}
]
} }