Add reports app registration and capabilities
Registers reports app (LXC 122, /reports, BarChart2, #1d4ed8, Management category) with two capabilities: view (run reports) and export (CSV download). Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
parent
2f0c9a1b34
commit
8d6fd71800
1 changed files with 18 additions and 1 deletions
19
src/db.js
19
src/db.js
|
|
@ -126,7 +126,8 @@ export async function initDb() {
|
||||||
('twin-optimiser', 'Twin Optimiser', 'Identify twin room opportunities from booking grid', '/twin-optimiser', 'LayoutGrid', '#c9841a', 'Housekeeping', '10.10.10.119', 3080),
|
('twin-optimiser', 'Twin Optimiser', 'Identify twin room opportunities from booking grid', '/twin-optimiser', 'LayoutGrid', '#c9841a', 'Housekeeping', '10.10.10.119', 3080),
|
||||||
('forecasting', 'Forecasting', 'Revenue forecasting and reporting', '/forecasting', 'TrendingUp', '#0077b6', 'Finance', '10.10.10.113', 3080),
|
('forecasting', 'Forecasting', 'Revenue forecasting and reporting', '/forecasting', 'TrendingUp', '#0077b6', 'Finance', '10.10.10.113', 3080),
|
||||||
('rates', 'Rate Monitor', 'Competitor rate monitoring and direct booking engine rates', '/rates', 'Tag', '#7b4f00', 'Finance', '10.10.10.115', 3080),
|
('rates', 'Rate Monitor', 'Competitor rate monitoring and direct booking engine rates', '/rates', 'Tag', '#7b4f00', 'Finance', '10.10.10.115', 3080),
|
||||||
('maintenance', 'Maintenance', 'Maintenance log book — faults, recurring tasks, assets and contractors', '/maintenance', 'Wrench', '#b45309', 'Operations', '10.10.10.121', 3080)
|
('maintenance', 'Maintenance', 'Maintenance log book — faults, recurring tasks, assets and contractors', '/maintenance', 'Wrench', '#b45309', 'Operations', '10.10.10.121', 3080),
|
||||||
|
('reports', 'Reports', 'Custom reports for NewBook, ResOS, SambaPOS and internal data', '/reports', 'BarChart2', '#1d4ed8', 'Management', '10.10.10.122', 3080)
|
||||||
ON CONFLICT (slug) DO UPDATE SET
|
ON CONFLICT (slug) DO UPDATE SET
|
||||||
name = EXCLUDED.name,
|
name = EXCLUDED.name,
|
||||||
icon = EXCLUDED.icon,
|
icon = EXCLUDED.icon,
|
||||||
|
|
@ -269,6 +270,22 @@ export async function initDb() {
|
||||||
sort_order = EXCLUDED.sort_order
|
sort_order = EXCLUDED.sort_order
|
||||||
`)
|
`)
|
||||||
|
|
||||||
|
// Seed reports capabilities
|
||||||
|
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
|
||||||
|
CROSS JOIN (VALUES
|
||||||
|
('view', 'View & Run Reports', 'Browse and run all custom reports', 1),
|
||||||
|
('export', 'Export to CSV', 'Download report results as a CSV file', 2)
|
||||||
|
) AS c(slug, name, description, sort_order)
|
||||||
|
WHERE a.slug = 'reports'
|
||||||
|
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
|
// Seed first admin user if table is empty
|
||||||
const { rows } = await pool.query('SELECT COUNT(*) FROM users')
|
const { rows } = await pool.query('SELECT COUNT(*) FROM users')
|
||||||
if (parseInt(rows[0].count) === 0) {
|
if (parseInt(rows[0].count) === 0) {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue