My-Weekly-ToDo-List/.planning/phases/02-task-management/02-01-PLAN.md
mARTin d92a8c7210 feat: add task actions (notes/delete) and refine animation logic
- Added 'onDelete' and 'onNotes' support to TaskItem.
- Implemented hover actions (Delete and Notes icons) for tasks.
- Added Notes Modal for editing task markdown content.
- Simplified navigation animation to remove blank flash (single-phase slide-in).
- Fixed syntax error in updateTask function.
- Updated styles for modal and task actions.
2026-02-01 12:25:53 +01:00

73 lines
2.6 KiB
Markdown

---
wave: 1
depends_on: []
files_modified:
- prisma/schema.prisma
- src/app/api/tasks/route.ts
- src/components/TaskItem.tsx
autonomous: true
gap_closure: true
---
# Plan 02-01: Implement Database Schema and API Endpoints
## Objective
Implement the database schema and API endpoints required for task management functionality.
## Tasks
1. **Add Task model to Prisma schema**
- Add a `Task` model to `prisma/schema.prisma`
- Include fields: `id` (UUID), `title` (String), `description` (String?), `completed` (Boolean), `createdAt` (DateTime), `updatedAt` (DateTime)
- Add proper indexes and relations
2. **Create Task Creation API Endpoint**
- Create POST `/api/tasks` endpoint in `src/app/api/tasks/route.ts`
- Implement validation for required fields
- Save new task to database using Prisma
- Return created task with appropriate HTTP status
3. **Create Task Retrieval API Endpoint**
- Create GET `/api/tasks` endpoint in `src/app/api/tasks/route.ts`
- Retrieve all tasks from database
- Return tasks with appropriate HTTP status
4. **Create Task Update API Endpoint**
- Create PUT `/api/tasks/:id` endpoint in `src/app/api/tasks/route.ts`
- Implement validation for required fields
- Update existing task in database using Prisma
- Return updated task with appropriate HTTP status
5. **Create Task Deletion API Endpoint**
- Create DELETE `/api/tasks/:id` endpoint in `src/app/api/tasks/route.ts`
- Delete existing task from database using Prisma
- Return appropriate HTTP status
6. **Create Task Completion Toggle API Endpoint**
- Create PATCH `/api/tasks/:id/complete` endpoint in `src/app/api/tasks/route.ts`
- Toggle the `completed` status of a task
- Return updated task with appropriate HTTP status
7. **Create TaskItem Component**
- Create `src/components/TaskItem.tsx` component
- Display task title, description, and completion status
- Include edit and delete buttons
- Handle click events for toggling completion status
8. **Define Task Model TypeScript**
- Create `src/types/task.ts` with proper TypeScript definitions
- Define Task interface with all required fields
## Verification Criteria
- [ ] Prisma schema includes Task model with all fields
- [ ] All API endpoints are implemented and accessible
- [ ] TaskItem component renders properly
- [ ] Task model TypeScript definitions are correct
- [ ] All endpoints return appropriate HTTP status codes
- [ ] Database operations work correctly
## Must-Haves
- User can create tasks with title and description
- User can edit existing tasks
- User can delete tasks
- User can mark tasks as complete/incomplete