2.9 KiB
2.9 KiB
Feature — Checklists
Simple ordered checklists with toggle-able items, domain/project scoping, and soft delete.
Schema
checklists
| Column | Type | Constraints | Description |
|---|---|---|---|
id |
uuid |
PK | |
title |
varchar(255) |
NOT NULL | |
status |
varchar(20) |
default 'active' |
|
domain_id |
uuid |
FK → domains.id, nullable |
|
project_id |
uuid |
FK → projects.id, nullable, ON DELETE SET NULL |
|
deleted_at |
timestamptz |
nullable | Soft delete (SoftDeletableEntity) |
Indexes: domain_id, project_id, status
checklist_items
| Column | Type | Constraints | Description |
|---|---|---|---|
id |
uuid |
PK | |
checklist_id |
uuid |
FK → checklists.id, ON DELETE CASCADE |
|
text |
varchar(500) |
NOT NULL | |
checked |
boolean |
default false |
|
sort_order |
integer |
default 0 |
Indexes: checklist_id
API
| Method | Endpoint | Description |
|---|---|---|
GET |
/api/checklists |
List checklists (?domainId=, ?status=) |
POST |
/api/checklists |
Create checklist (with optional inline items) |
GET |
/api/checklists/:id |
Get checklist by ID with items |
PATCH |
/api/checklists/:id |
Update checklist |
DELETE |
/api/checklists/:id |
Soft delete checklist |
POST |
/api/checklists/:id/items |
Add item to checklist |
PATCH |
/api/checklists/:id/items/:itemId |
Update checklist item |
DELETE |
/api/checklists/:id/items/:itemId |
Remove checklist item |
POST |
/api/checklists/:id/items/:itemId/toggle |
Toggle item checked state |
Backend Module
ChecklistsModule — imports TypeOrmModule (Checklist, ChecklistItem). Uses ProjectResolverService for domain resolution from project.
Business rules:
- Items are eagerly loaded with checklists (cascade create)
- New items auto-increment
sortOrderfrom max existing - Toggle endpoint flips
checkedboolean - Soft delete sets
deletedAttimestamp - Domain auto-resolved from project if only
projectIdis provided - Items ordered by
sortOrderASC, checklists bycreatedAtDESC
Frontend
Routes
/checklists— Checklists dashboard
Components
ChecklistsPage— Main list with filtersChecklistCard— Individual checklist with toggle-able items
Data
const { checklists, createChecklist, toggleItem, addItem, removeItem } = useChecklists();
Key Interactions
- Toggle: click item checkbox to toggle checked/unchecked
- Add item: inline add at bottom of checklist
- Quick create: create checklist with initial items in one step
- Delete: soft delete removes from active view
Implementation Phase
Phase 2 (Core Features) — ChecklistsModule, item CRUD, toggle, soft delete.