Add Rate Monitor app registration and 6 capabilities
Renames 'Rate Scraper' → 'Rate Monitor', seeds view_own_rates, view_competitors, view_direct_rates, rate_analysis, manage_scraper, manage_hotels caps for the rates app (LXC 115). Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
parent
42c1a33c4b
commit
a4ea1c141e
1 changed files with 21 additions and 1 deletions
22
src/db.js
22
src/db.js
|
|
@ -125,7 +125,7 @@ export async function initDb() {
|
||||||
('hk-planner', 'Rota Check', 'Housekeeping workload and hours planning', '/hk-planner', 'CalendarClock', '#2d6a4f', 'Housekeeping', '10.10.10.118', 3080),
|
('hk-planner', 'Rota Check', 'Housekeeping workload and hours planning', '/hk-planner', 'CalendarClock', '#2d6a4f', 'Housekeeping', '10.10.10.118', 3080),
|
||||||
('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 Scraper', 'Competitor rate monitoring', '/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)
|
||||||
ON CONFLICT (slug) DO UPDATE SET
|
ON CONFLICT (slug) DO UPDATE SET
|
||||||
name = EXCLUDED.name,
|
name = EXCLUDED.name,
|
||||||
|
|
@ -251,6 +251,26 @@ export async function initDb() {
|
||||||
sort_order = EXCLUDED.sort_order
|
sort_order = EXCLUDED.sort_order
|
||||||
`)
|
`)
|
||||||
|
|
||||||
|
// Seed rates 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_own_rates', 'View Bookability', 'View own hotel rate and tariff availability', 1),
|
||||||
|
('view_competitors', 'View Market View', 'View competitor Booking.com rates', 2),
|
||||||
|
('view_direct_rates', 'View Direct Rates', 'View competitor direct booking engine rates', 3),
|
||||||
|
('rate_analysis', 'Rate Analysis', 'Drill into competitor pricing structure', 4),
|
||||||
|
('manage_scraper', 'Manage Scraper', 'Configure scraper, trigger manual scrapes', 5),
|
||||||
|
('manage_hotels', 'Manage Competitors', 'Classify and configure competitor hotels', 6)
|
||||||
|
) AS c(slug, name, description, sort_order)
|
||||||
|
WHERE a.slug = 'rates'
|
||||||
|
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