Seed tablet-checkin app + push/admin/settings capabilities
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
parent
dfa6718cb5
commit
0574ceddb0
1 changed files with 37 additions and 0 deletions
37
src/db.js
37
src/db.js
|
|
@ -575,6 +575,43 @@ export async function initDb() {
|
|||
sort_order = EXCLUDED.sort_order
|
||||
`)
|
||||
|
||||
// Seed tablet-checkin app + capabilities. LXC 132 — staff-push guest
|
||||
// check-in tablet (contact details, car reg, marketing opt-in, T&Cs +
|
||||
// signature). No default Staff grants — writes guest PII to NewBook and
|
||||
// holds signed regcards, access is admin-assigned per role via the portal
|
||||
// (same convention as hvac/plant/wages/utilities). 'push' also covers the
|
||||
// standalone Chrome extension's manual-test surface inside this app's own
|
||||
// Devices page — the extension's real push call authenticates via a
|
||||
// terminal API key, not this capability (see project_checkin memory).
|
||||
await pool.query(`
|
||||
INSERT INTO apps (slug, name, description, base_path, icon, theme_color, category, internal_host, internal_port)
|
||||
VALUES ('tablet-checkin', 'Tablet Check-In', 'Staff-push guest check-in tablet — contact details, car reg, marketing opt-in, T&Cs and signature capture', '/tablet-checkin', 'UserCheck', '#be123c', 'Hotel', '10.10.10.132', 3080)
|
||||
ON CONFLICT (slug) DO UPDATE SET
|
||||
name = EXCLUDED.name,
|
||||
description = EXCLUDED.description,
|
||||
base_path = EXCLUDED.base_path,
|
||||
icon = EXCLUDED.icon,
|
||||
theme_color = EXCLUDED.theme_color,
|
||||
category = EXCLUDED.category,
|
||||
internal_host = EXCLUDED.internal_host,
|
||||
internal_port = EXCLUDED.internal_port
|
||||
`)
|
||||
|
||||
await pool.query(`
|
||||
INSERT INTO app_capabilities (app_id, slug, name, description, sort_order)
|
||||
SELECT a.id, c.slug, c.name, c.description, c.sort_order
|
||||
FROM apps a, (VALUES
|
||||
('push', 'Push to Tablet', 'Push a booking to a check-in tablet (staff push trigger + manual test-push)', 1),
|
||||
('admin', 'Admin', 'View check-in audit history, manage devices, terminals and marketing config', 2),
|
||||
('settings', 'Settings', 'Configure tablet-checkin app settings', 3)
|
||||
) AS c(slug, name, description, sort_order)
|
||||
WHERE a.slug = 'tablet-checkin'
|
||||
ON CONFLICT (app_id, slug) DO UPDATE SET
|
||||
name = EXCLUDED.name,
|
||||
description = EXCLUDED.description,
|
||||
sort_order = EXCLUDED.sort_order
|
||||
`)
|
||||
|
||||
// Seed first admin user if table is empty
|
||||
const { rows } = await pool.query('SELECT COUNT(*) FROM users')
|
||||
if (parseInt(rows[0].count) === 0) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue