Add todo list with kanban board view

- todos table with title, description, status (todo/in_progress/done),
  priority (urgent/high/medium/low), optional device link, due date
- List view: sorted by priority, inline edit, click-to-advance status
  circle (empty → blue dot → green check), edit/delete actions
- Kanban board view: three columns, move buttons between statuses,
  priority badges, device links, due dates
- Toggle between List and Board views via URL param
- Optional link to a device for repair-related todos
- Sidebar nav item added

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-04-07 13:55:16 +07:00
parent 59371d0cbb
commit fe54496d79
5 changed files with 501 additions and 0 deletions
+24
View File
@@ -274,3 +274,27 @@ export const deviceLog = pgTable(
check('device_log_type_check', sql`${table.type} IN ('repair', 'inspection', 'cleaning', 'modification', 'diagnostic', 'recap', 'other')`)
]
);
// ─── Todos ──────────────────────────────────────────────────────────
export const todos = pgTable(
'todos',
{
id: uuid('id').defaultRandom().primaryKey(),
title: text('title').notNull(),
description: text('description'),
status: text('status').notNull().default('todo'),
priority: integer('priority').notNull().default(2), // 0=urgent, 1=high, 2=medium, 3=low
deviceId: uuid('device_id').references(() => devices.id, { onDelete: 'set null' }),
dueDate: timestamp('due_date', { withTimezone: true }),
createdAt: timestamp('created_at', { withTimezone: true }).defaultNow().notNull(),
updatedAt: timestamp('updated_at', { withTimezone: true }).defaultNow().notNull()
},
(table) => [
index('todos_status_idx').on(table.status),
index('todos_priority_idx').on(table.priority),
index('todos_device_idx').on(table.deviceId),
check('todos_status_check', sql`${table.status} IN ('todo', 'in_progress', 'done')`),
check('todos_priority_check', sql`${table.priority} IN (0, 1, 2, 3)`)
]
);