Compare commits

..

2 commits

Author SHA1 Message Date
fe0e5f5e71 Add forecasting_db grants + FORECAST_DATABASE_URL to reports deploy
Reports LXC now gets SELECT grants on forecasting_db tables (bookings
stats, net revenue, forecasts, budgets) and the FORECAST_DATABASE_URL
env var so the Directors Forecast section can cross-query the forecasting
DB. Also adds 'edit' capability to the auth seeding block.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-07-20 10:24:59 +00:00
c2454b493d Add deploy_directors_report function (LXC 123)
Creates directors_report_db, grants SELECT on forecasting_db tables
(newbook_bookings_stats, newbook_net_revenue_data, forecasts, monthly_budgets,
daily_budgets), wires FORECAST_DATABASE_URL env var.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-07-20 10:10:17 +00:00

View file

@ -1446,8 +1446,10 @@ deploy_reports() {
\"CREATE DATABASE reports_db OWNER reports;\" 2>/dev/null || true \"CREATE DATABASE reports_db OWNER reports;\" 2>/dev/null || true
docker exec hotel-manage-postgres psql -U postgres -d reports_db -c \ docker exec hotel-manage-postgres psql -U postgres -d reports_db -c \
\"GRANT ALL ON SCHEMA public TO reports;\" 2>/dev/null || true \"GRANT ALL ON SCHEMA public TO reports;\" 2>/dev/null || true
docker exec hotel-manage-postgres psql -U postgres -d forecasting_db -c \
\"GRANT SELECT ON newbook_bookings_stats, newbook_net_revenue_data, forecasts, monthly_budgets, daily_budgets TO reports;\" 2>/dev/null || true
" &>/dev/null " &>/dev/null
msg_ok "Database reports_db ready" msg_ok "Database reports_db ready + read access to forecasting_db"
msg_info "Deploying reports" msg_info "Deploying reports"
deploy_service 122 "reports" "${REPO_ROOT}/reports" /opt/reports deploy_service 122 "reports" "${REPO_ROOT}/reports" /opt/reports
@ -1456,6 +1458,7 @@ deploy_reports() {
NODE_ENV=production NODE_ENV=production
APP_SLUG=reports APP_SLUG=reports
DATABASE_URL=postgresql://reports:${REPORTS_DB_PASS}@10.10.10.100:5432/reports_db DATABASE_URL=postgresql://reports:${REPORTS_DB_PASS}@10.10.10.100:5432/reports_db
FORECAST_DATABASE_URL=postgresql://reports:${REPORTS_DB_PASS}@10.10.10.100:5432/forecasting_db
CENTRAL_AUTH_SECRET=${CENTRAL_AUTH_SECRET} CENTRAL_AUTH_SECRET=${CENTRAL_AUTH_SECRET}
SETTINGS_URL=http://10.10.10.116:3080 SETTINGS_URL=http://10.10.10.116:3080
SETTINGS_SECRET=${SETTINGS_SECRET} SETTINGS_SECRET=${SETTINGS_SECRET}
@ -1487,8 +1490,9 @@ ${build_out}"
INSERT INTO app_capabilities (app_id, slug, name, description, sort_order) INSERT INTO app_capabilities (app_id, slug, name, description, sort_order)
SELECT a.id, c.slug, c.name, c.description, c.sort_order SELECT a.id, c.slug, c.name, c.description, c.sort_order
FROM apps a, (VALUES FROM apps a, (VALUES
('view', 'View & Run Reports', 'Browse and run all custom reports', 1), ('view', 'View & Run Reports', 'Browse and run all custom reports', 1),
('export', 'Export to CSV', 'Download report results as a CSV file', 2) ('export', 'Export to CSV', 'Download report results as a CSV file', 2),
('edit', 'Edit Directors Forecast','Edit pickup/dry/wet overrides and save forecast snapshots', 3)
) AS c(slug, name, description, sort_order) ) AS c(slug, name, description, sort_order)
WHERE a.slug = 'reports' WHERE a.slug = 'reports'
ON CONFLICT (app_id, slug) DO NOTHING; ON CONFLICT (app_id, slug) DO NOTHING;