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/test
Thomas Joise 7838ced6c2 feat(client-detail): quotation-step document link + ticket classification (backend)
Backend half of the Client Detail redesign follow-ups (#7, #6, #4).

#7 — quotation step links its document
- project_milestone gains a nullable `document_id`, landed on BOTH engines:
  a PRAGMA-guarded ALTER in db.ts migrate() and pg migration 016.
- setMilestone(..., doneOn?, paymentId?, documentId?) validates the document
  belongs to the same client as the project (mirroring the paymentId check),
  stores it on tick and clears it on untick; Milestone gains `documentId`.
- POST /client-modules/:id/milestones accepts `documentId`.
- migrateOnboardingTemplates carries document_id across the template swap so a
  linked quotation is not lost.

#6 — ticket classification
- ticket gains `type TEXT NOT NULL DEFAULT 'service'` (db.ts SCHEMA + guarded
  ALTER, pg migration 017); imported APEX rows fall to the default.
- Config over code: the list is the `ticket.types` setting (seeded on first
  boot) resolved by ticketTypes(), with TICKET_TYPE_FALLBACK in code.
- GET /tickets/types; create/update accept + validate `type`; list rows carry
  it and GET /tickets?type= filters (blank/omitted = every type).

#4 — cleanup
- Refreshed the stale file comment atop repos-milestones.ts and the
  project_milestone comment in db.ts: both now describe the composed
  front + per-module tail model (they still described the old flat template).
- Migration tests for the interim keys advance_payment / balance_payment ->
  payment_received, plus the document-link carry.

npm run typecheck clean; npm test 473 passed / 5 skipped (was 453/5).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
1 day ago
..
fixtures feat(hq): seed + apex csv importer with verification and series seeding (HQ-1 task 13) 2 weeks ago
amc.test.ts feat(db): D19 P1-P3 — async DB interface, dual engines, Postgres adapter 4 days ago
audit-viewer.test.ts feat(d27): #8 audit-log viewer (owner-only) 3 days ago
auth.test.ts chore: remove all 'Tecnostac' references — everything is SiMS 2 days ago
authz-gates.test.ts fix(sec/d24): gate destructive/sensitive ops to managerial 4 days ago
aws-costs.test.ts feat(db): D19 P1-P3 — async DB interface, dual engines, Postgres adapter 4 days ago
aws-pull-route.test.ts feat(db): D19 P1-P3 — async DB interface, dual engines, Postgres adapter 4 days ago
aws-repo.test.ts feat(db): D19 P1-P3 — async DB interface, dual engines, Postgres adapter 4 days ago
bounces.test.ts chore: remove all 'Tecnostac' references — everything is SiMS 2 days ago
bulk-sms-purchase.test.ts feat(sms): bulk SMS purchase proforma + document source tagging (renewal vs top-up) 2 days ago
client-modules.test.ts feat(db): D19 P1-P3 — async DB interface, dual engines, Postgres adapter 4 days ago
client-owner.test.ts chore: remove all 'Tecnostac' references — everything is SiMS 2 days ago
client-support.test.ts feat(d31): store credentials in the clear (owner decision) + one-time migration 3 days ago
clients.test.ts feat(db): D19 P1-P3 — async DB interface, dual engines, Postgres adapter 4 days ago
concurrency.test.ts fix(sec/d24): concurrency + workflow isolation 4 days ago
convert-and-send.test.ts chore: remove all 'Tecnostac' references — everything is SiMS 2 days ago
dashboard.test.ts chore: remove all 'Tecnostac' references — everything is SiMS 2 days ago
db.test.ts feat(db): D19 P1-P3 — async DB interface, dual engines, Postgres adapter 4 days ago
documents-page.test.ts feat(db): D19 P1-P3 — async DB interface, dual engines, Postgres adapter 4 days ago
documents.test.ts feat(docs): require a reason when cancelling a document 2 days ago
due-dates.test.ts chore: remove all 'Tecnostac' references — everything is SiMS 2 days ago
e2e.test.ts feat(db): D19 P1-P3 — async DB interface, dual engines, Postgres adapter 4 days ago
employees-routes.test.ts fix(sec/d24): auth hardening — login lockout, rate limits, constant-time, trust proxy 4 days ago
employees.test.ts chore: remove all 'Tecnostac' references — everything is SiMS 2 days ago
functional-d26.test.ts feat(d26): functional gaps — GST summary, doc search, bulk ops (backend) 3 days ago
gmail-connect.test.ts feat(hq): one-time gmail oauth connect script (HQ-1 task 12) 2 weeks ago
gmail.test.ts feat(hq): gmail send with token-death handling and email log (HQ-1 task 11) 2 weeks ago
health.test.ts feat(db): D19 P1-P3 — async DB interface, dual engines, Postgres adapter 4 days ago
hq2-schema.test.ts feat(db): D19 P1-P3 — async DB interface, dual engines, Postgres adapter 4 days ago
hq3-schema.test.ts feat(db): D19 P1-P3 — async DB interface, dual engines, Postgres adapter 4 days ago
import-apex-full.test.ts feat(d21): P4 — importer seeds module field_spec + writes field_values 4 days ago
import-routes.test.ts feat(db): D19 P1-P3 — async DB interface, dual engines, Postgres adapter 4 days ago
import.test.ts feat(db): D19 P1-P3 — async DB interface, dual engines, Postgres adapter 4 days ago
interactions.test.ts feat(db): D19 P1-P3 — async DB interface, dual engines, Postgres adapter 4 days ago
isolation.test.ts feat(hq): HQ-1.5 — module quote content, pack pick-lists, bundle isolation check 2 weeks ago
ledger-outstanding.test.ts fix(payments): exclude draft proformas from outstanding (owner decision) 2 days ago
migrate-onboarding-templates.test.ts feat(client-detail): quotation-step document link + ticket classification (backend) 1 day ago
migrate-plaintext.test.ts feat(d32): remove the key concept entirely + keyless legacy cleanup 3 days ago
milestone-document.test.ts feat(client-detail): quotation-step document link + ticket classification (backend) 1 day ago
milestone-payment.test.ts feat(onboarding): composed milestone templates (shared front + per-module tail) 2 days ago
milestone-status.test.ts feat(onboarding): composed milestone templates (shared front + per-module tail) 2 days ago
milestones-templates.test.ts feat(onboarding): composed milestone templates (shared front + per-module tail) 2 days ago
milestones.test.ts feat(onboarding): composed milestone templates (shared front + per-module tail) 2 days ago
mis.test.ts feat(d27): #5 owner MIS cockpit 3 days ago
module-access.test.ts test(d28): lock module directory + portals (fieldSpec, login-only, no secret leak) 3 days ago
module-fields.test.ts feat(d31): store credentials in the clear (owner decision) + one-time migration 3 days ago
module-roster.test.ts chore: remove all 'Tecnostac' references — everything is SiMS 2 days ago
modules.test.ts feat(db): D19 P1-P3 — async DB interface, dual engines, Postgres adapter 4 days ago
money-guards.test.ts fix(sec/d24): money-integrity guards — CN cap, atomic doc-no, qty, TDS, markStatus 4 days ago
payments.test.ts feat(db): D19 P1-P3 — async DB interface, dual engines, Postgres adapter 4 days ago
pdf-download.test.ts feat(db): D19 P1-P3 — async DB interface, dual engines, Postgres adapter 4 days ago
pg-engine.test.ts feat(db): D19 P4 — DATABASE_URL engine selection + Postgres integration suite 4 days ago
pipeline.test.ts feat(db): D19 P1-P3 — async DB interface, dual engines, Postgres adapter 4 days ago
prepare-draft.test.ts feat(db): D19 P1-P3 — async DB interface, dual engines, Postgres adapter 4 days ago
preview-fidelity.test.ts feat(db): D19 P1-P3 — async DB interface, dual engines, Postgres adapter 4 days ago
preview-route.test.ts feat(db): D19 P1-P3 — async DB interface, dual engines, Postgres adapter 4 days ago
preview-sample.test.ts chore: remove all 'Tecnostac' references — everything is SiMS 2 days ago
profile-me.test.ts feat(db): D19 P1-P3 — async DB interface, dual engines, Postgres adapter 4 days ago
public-share.test.ts feat(db): D19 P1-P3 — async DB interface, dual engines, Postgres adapter 4 days ago
quote-followup.test.ts feat(docs): require a reason when cancelling a document 2 days ago
receipt.test.ts chore: remove all 'Tecnostac' references — everything is SiMS 2 days ago
recurring.test.ts feat(db): D19 P1-P3 — async DB interface, dual engines, Postgres adapter 4 days ago
reminder-preview.test.ts chore: remove all 'Tecnostac' references — everything is SiMS 2 days ago
reminder-schedule.test.ts feat(db): D19 P1-P3 — async DB interface, dual engines, Postgres adapter 4 days ago
reminders-page.test.ts chore: remove all 'Tecnostac' references — everything is SiMS 2 days ago
reminders.test.ts chore: remove all 'Tecnostac' references — everything is SiMS 2 days ago
renewals.test.ts feat(d27): #1 renewals command center + one-click module renewal quote (backend) 3 days ago
reports.test.ts feat(db): D19 P1-P3 — async DB interface, dual engines, Postgres adapter 4 days ago
scheduler-recurring.test.ts chore: remove all 'Tecnostac' references — everything is SiMS 2 days ago
scheduler-scan.test.ts chore: remove all 'Tecnostac' references — everything is SiMS 2 days ago
seed-templates.test.ts feat(onboarding): composed milestone templates (shared front + per-module tail) 2 days ago
send-reminder.test.ts chore: remove all 'Tecnostac' references — everything is SiMS 2 days ago
series.test.ts feat(db): D19 P1-P3 — async DB interface, dual engines, Postgres adapter 4 days ago
settings-company.test.ts chore: remove all 'Tecnostac' references — everything is SiMS 2 days ago
settings-reminders.test.ts feat(db): D19 P1-P3 — async DB interface, dual engines, Postgres adapter 4 days ago
settings-sharing.test.ts feat(db): D19 P1-P3 — async DB interface, dual engines, Postgres adapter 4 days ago
settings-template.test.ts chore: remove all 'Tecnostac' references — everything is SiMS 2 days ago
shares.test.ts feat(db): D19 P1-P3 — async DB interface, dual engines, Postgres adapter 4 days ago
sms-balances.test.ts feat(sms): live-only balance list, no full-row red, mandatory creds on assign 2 days ago
sms-gateway.test.ts harden(d28): SSRF guard + no credential-URL leak on SMS gateway fetch 3 days ago
sms-rate-card.test.ts feat(d23): SMS volume-band billing (dated rate card, money locked) 4 days ago
stalled-onboarding.test.ts feat(onboarding): stalled-project query for the dashboard/MIS tile 2 days ago
template-accent.test.ts chore: remove all 'Tecnostac' references — everything is SiMS 2 days ago
template-render.test.ts chore: remove all 'Tecnostac' references — everything is SiMS 2 days ago
templates.test.ts chore: remove all 'Tecnostac' references — everything is SiMS 2 days ago
ticket-sla.test.ts feat(d28): #3 ticket desk — SLA aging + overdue filter + bill-from-ticket 3 days ago
ticket-types.test.ts feat(client-detail): quotation-step document link + ticket classification (backend) 1 day ago
tickets.test.ts feat(d31): store credentials in the clear (owner decision) + one-time migration 3 days ago