You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
sims-hq/apps/hq/src
Thomas Joise 0adce5844b fix(backup): resolve the production database the way the server does
`npm run backup` ran scripts/backup.mjs, which read process.env.DATABASE_URL
directly and exited when it was unset. On the production box DATABASE_URL is NOT
exported -- the connection is resolved (D19) -- so the backup command could never
reach the real data.

The dump now lives in apps/hq (src/backup.ts + a thin scripts/backup.ts CLI, the
same split the other maintenance scripts use, so it is typechecked and unit
tested) and resolves its target through the shared resolveDbUrl. It logs the
resolved host/db -- never the password -- before pg_dump runs, and a SQLite
outcome is a loud error naming backup-hq.sh instead of a dump of nothing.
Behaviour otherwise unchanged: -Fc dump under ./backups (or HQ_BACKUP_DIR),
rotation to the newest HQ_BACKUP_KEEP (default 14), same pg_dump discovery.

The .mjs entry could not import the TS resolver, and duplicating the resolution
would have re-introduced the copy of the production connection string that
6f50799 deliberately removed -- hence the move to TS. `npm run backup` is
unchanged for the operator; prod already runs `npx tsx apps/hq/scripts/...` for
maintenance (see DEPLOY-HQ.md), so tsx is on the box.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
1 day ago
..
api.ts fix(onboarding): APEX-imported projects were invisible on the stalled tile 1 day ago
audit.ts feat(d27): #8 audit-log viewer (owner-only) 3 days ago
auth.ts feat(d36): login history (IP + device) + first-login change nudge 2 days ago
aws-costs.ts feat(db): D19 P1-P3 — async DB interface, dual engines, Postgres adapter 4 days ago
backup.ts fix(backup): resolve the production database the way the server does 1 day ago
bounces.ts feat(db): D19 P1-P3 — async DB interface, dual engines, Postgres adapter 4 days ago
crypto.ts feat(d32): remove the key concept entirely + keyless legacy cleanup 3 days ago
db-pg.ts fix(scripts): document the DATABASE_URL-prefixed invocation, make SQLite an explicit opt-in 1 day ago
db.ts fix(onboarding): APEX-imported projects were invisible on the stalled tile 1 day ago
gmail.ts feat(db): D19 P1-P3 — async DB interface, dual engines, Postgres adapter 4 days ago
import-apex-full.ts fix(onboarding): APEX-imported projects were invisible on the stalled tile 1 day ago
import-apex.ts feat(db): D19 P1-P3 — async DB interface, dual engines, Postgres adapter 4 days ago
migrate-onboarding-templates.ts fix(onboarding-migration): idempotency check must ignore ad-hoc custom_* rows 1 day ago
migrate-plaintext.ts feat(d32): remove the key concept entirely + keyless legacy cleanup 3 days ago
migrations-pg.ts fix(onboarding): APEX-imported projects were invisible on the stalled tile 1 day ago
pdf.ts fix(sec/d24): PDF render hardening — strict CSP + request interception 4 days ago
rate-limit.ts fix(sec/d24): auth hardening — login lockout, rate limits, constant-time, trust proxy 4 days ago
reminder-templates.ts feat(documents): invoice due dates — terms default + override, honest overdue chase (Phase 1, D18) 5 days ago
repos-amc.ts feat(db): D19 P1-P3 — async DB interface, dual engines, Postgres adapter 4 days ago
repos-aws.ts feat(db): D19 P1-P3 — async DB interface, dual engines, Postgres adapter 4 days ago
repos-branches.ts feat(d20): P1 — ticket desk, client branches, per-service data (schema + repos) 4 days ago
repos-clients.ts feat(d37): society category (Kerala co-op directory taxonomy) on clients 2 days ago
repos-dashboard.ts feat(db): D19 P1-P3 — async DB interface, dual engines, Postgres adapter 4 days ago
repos-documents.ts feat(sms): bulk SMS purchase proforma + document source tagging (renewal vs top-up) 2 days ago
repos-email.ts feat(db): D19 P1-P3 — async DB interface, dual engines, Postgres adapter 4 days ago
repos-employees.ts feat(d34): import employee master + invited/pending-login flag 2 days ago
repos-interactions.ts feat(db): D19 P1-P3 — async DB interface, dual engines, Postgres adapter 4 days ago
repos-login-events.ts feat(d36): login history (IP + device) + first-login change nudge 2 days ago
repos-milestones.ts fix(milestones): stamp installed_on/trained_on on every tick, keep links on a re-tick 1 day ago
repos-mis.ts feat(d28): #6 SMS credit review + low-balance upsell 3 days ago
repos-modules.ts fix(milestones): fresh projects false-flagged as stalled, fallback modules stuck at quoted, bulk ops skipped status/link logic (FIX D, E, F) 1 day ago
repos-payments.ts fix(payments): exclude draft proformas from outstanding (owner decision) 2 days ago
repos-pipeline.ts feat(db): D19 P1-P3 — async DB interface, dual engines, Postgres adapter 4 days ago
repos-rate-card.ts feat(d23): SMS volume-band billing (dated rate card, money locked) 4 days ago
repos-recurring.ts feat(db): D19 P1-P3 — async DB interface, dual engines, Postgres adapter 4 days ago
repos-reminders.ts feat(db): D19 P1-P3 — async DB interface, dual engines, Postgres adapter 4 days ago
repos-renewals.ts feat(sms): bulk SMS purchase proforma + document source tagging (renewal vs top-up) 2 days ago
repos-reports.ts feat(d26): functional gaps — GST summary, doc search, bulk ops (backend) 3 days ago
repos-search.ts feat(d28): Portals quick-list + global search (clients/docs/tickets) 3 days ago
repos-shares.ts feat(db): D19 P1-P3 — async DB interface, dual engines, Postgres adapter 4 days ago
repos-sms.ts feat(sms): live-only balance list, no full-row red, mandatory creds on assign 2 days ago
repos-tickets.ts feat(client-detail): quotation-step document link + ticket classification (backend) 1 day ago
scheduler.ts feat(d28): SMS gateway live balance sync (BalAlert API) + daily auto + low alert 3 days ago
seed.ts feat(client-detail): quotation-step document link + ticket classification (backend) 1 day ago
send-reminder.ts feat(db): D19 P1-P3 — async DB interface, dual engines, Postgres adapter 4 days ago
series.ts fix(sec/d24): money-integrity guards — CN cap, atomic doc-no, qty, TDS, markStatus 4 days ago
server.ts fix(deploy): one shared DB-engine resolver so scripts can't silently target a throwaway SQLite file (FIX A) 1 day ago
sms-gateway.ts harden(d28): SSRF guard + no credential-URL leak on SMS gateway fetch 3 days ago
templates.ts feat(d37): society category (Kerala co-op directory taxonomy) on clients 2 days ago