From a4ea1c141e3644697a849ad90808680987b725cb Mon Sep 17 00:00:00 2001 From: jtricerolph Date: Sun, 5 Jul 2026 12:06:54 +0000 Subject: [PATCH] Add Rate Monitor app registration and 6 capabilities MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 --- src/db.js | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) diff --git a/src/db.js b/src/db.js index 866173c..d6c1f82 100644 --- a/src/db.js +++ b/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), ('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), - ('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) ON CONFLICT (slug) DO UPDATE SET name = EXCLUDED.name, @@ -251,6 +251,26 @@ export async function initDb() { 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 const { rows } = await pool.query('SELECT COUNT(*) FROM users') if (parseInt(rows[0].count) === 0) {