TaskManager
nemicko.demo.todo.aim · intent nemicko.demo.todo · kind intent
---aim: nemicko.demo.todokind: intent---# TaskManager## SummaryA complete personal task management system supporting creation, completion, and deletion of daily todos.## Requirements- Users can create new tasks with a title and optional description.- Users can mark active tasks as completed.- Users can delete tasks to remove them permanently.- Tasks must securely belong only to the authenticated user.## Tests- A user cannot view or complete a task owned by a different user.- Completing an already completed task returns safely without error.## Record: TodoItem### SummaryThe core data entity representing a single user task.### Schema```schemaid: string generated uniqueownerId: string requiredtitle: string required max(100)description: string optionalstatus: enum(PENDING, COMPLETED) required default(PENDING)createdAt: timestamp generated```## Contract: CreateTodo### SummaryCreates a new pending task for the active user.### Input```schematitle: string requireddescription: string optional```### Authz- User must be actively authenticated.### Expects- Title must not be empty or purely whitespace.### Ensures- Orchestration is delegated to the creation flow — [invokes](aim:#Flow:ExecuteCreateTodo).- Persists a new TodoItem with `status="PENDING"` and `ownerId=currentUser.id` — [mutates](aim:#Record:TodoItem).- Emits the creation event — [emits](aim:#Event:TodoCreated).### Returns- The created TodoItem.## Contract: CompleteTodo### SummarySafely marks an active task as complete.### Input```schematodoId: string required```### Authz- User must be authenticated.- User must be the `ownerId` of the TodoItem.### Expects- The TodoItem record must exist.- `TodoItem.status` must currently be `PENDING`.### Ensures- Updates `TodoItem.status` to `COMPLETED` — [mutates](aim:#Record:TodoItem).### Returns- The updated TodoItem.## Flow: ExecuteCreateTodo### SummaryOrchestrates database insertion and event publishing for new tasks.### Steps1. Extract the userId via `Auth.GetCurrentUser`.2. Construct a new TodoItem with input data and the extracted userId.3. Insert the record — [mutates](aim:#Record:TodoItem).4. Publish the creation event — [emits](aim:#Event:TodoCreated).### On Error- Log a warning via `Logger.Warn("Failed to create task")`.- Rethrow the error to surface to the UI.## Persona: StandardUserA regular individual managing their personal task list.### Role- `user:standard`### Access- [accesses](aim:#View:TodoDashboard)## View: TodoDashboard### SummaryThe main interface for viewing and interacting with the task list.### Display- A list of [reads](aim:#Record:TodoItem) records where `ownerId = currentUser.id`.- Visual distinction between PENDING and COMPLETED tasks.- Empty state message if no tasks exist.### Actions- Submitting the "New Task" form — [exposes](aim:#Contract:CreateTodo)- Tapping the checkbox on a PENDING task — [exposes](aim:#Contract:CompleteTodo)### Layout- The "New Task" form sits above the list.- Completed tasks below the pending ones.## Style: Plain### SummaryQuiet and legible: a white sheet, dark text, one blue for the action — nothing decorative.### Palette- surface: white- ink: near-black `#1f1f1f`- accent: one clear blue for the primary action### Type- body: the platform's own sans, comfortable size### Shape- corners: slightly rounded- elevation: flat## State: TodoStatus### SummaryA todo is pending until its owner completes it; a completed todo stays completed.### Of- `Record:TodoItem.status`### States- Pending — initial- Completed — final### Moves- Pending → Completed — [Contract:CompleteTodo]## Event: TodoCreated### SummaryEmitted when a new todo is persisted.### Payload```schematodoId: string requiredownerId: string requiredcreatedAt: timestamp required```### Routing- Channel: `todos.created`