Add checklist templates with import into devices
- checklist_templates and template_items tables for reusable checklists - /checklists page: create/edit/delete templates with ordered items - "Import" button on device detail imports a template as a new checklist with all items copied (unchecked) - Sidebar nav item for Checklists between Locations and Gallery Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -195,6 +195,29 @@ export const installationLog = pgTable(
|
||||
]
|
||||
);
|
||||
|
||||
// ─── Checklist Templates ────────────────────────────────────────────
|
||||
|
||||
export const checklistTemplates = pgTable('checklist_templates', {
|
||||
id: uuid('id').defaultRandom().primaryKey(),
|
||||
title: text('title').notNull(),
|
||||
description: text('description'),
|
||||
createdAt: timestamp('created_at', { withTimezone: true }).defaultNow().notNull(),
|
||||
updatedAt: timestamp('updated_at', { withTimezone: true }).defaultNow().notNull()
|
||||
});
|
||||
|
||||
export const templateItems = pgTable(
|
||||
'template_items',
|
||||
{
|
||||
id: uuid('id').defaultRandom().primaryKey(),
|
||||
templateId: uuid('template_id')
|
||||
.notNull()
|
||||
.references(() => checklistTemplates.id, { onDelete: 'cascade' }),
|
||||
text: text('text').notNull(),
|
||||
sortOrder: integer('sort_order').default(0).notNull()
|
||||
},
|
||||
(table) => [index('template_items_template_idx').on(table.templateId)]
|
||||
);
|
||||
|
||||
// ─── Device Checklists ──────────────────────────────────────────────
|
||||
|
||||
export const deviceChecklists = pgTable(
|
||||
|
||||
Reference in New Issue
Block a user