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 a1759864bf feat(hq): shareable document link backend (mint/validate/revoke/list)
Add document_share table (CREATE TABLE IF NOT EXISTS; opaque token, optional
expiry, revoke flag) and repos-shares.ts:

- mintShare: 256-bit randomBytes hex token (64 hex, unique), default +30d expiry,
  audited — the token itself is never written to the audit trail or any log.
- validateShare: resolves a live token to its one document; null on
  unknown / revoked / expired (ISO-8601 UTC lexical compare).
- revokeShare: flips revoked=1, audited.
- listShares: a document's shares, scoped and newest-first.

Wire POST /api/documents/:id/share and
POST /api/documents/:id/share/:shareId/revoke (requireAuth, document-scoped
share guard) and surface shares on GET /api/documents/:id. TDD: 14 tests cover
token shape/uniqueness, validate rejections, revoke, and audit-without-token.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
1 week ago
..
api.ts feat(hq): shareable document link backend (mint/validate/revoke/list) 1 week ago
audit.ts feat(hq): sqlite schema + audit log (HQ-1 task 2) 2 weeks ago
auth.ts feat(hq): staff auth with sessions and owner gate (HQ-1 task 3) 2 weeks ago
aws-costs.ts feat(hq): aws cost explorer ingestion — sigv4 signer and monthly tag-grouped pull 2 weeks ago
bounces.ts feat(hq): mailbox bounce detection with email_bounced reminders 2 weeks ago
crypto.ts feat(hq): gmail send with token-death handling and email log (HQ-1 task 11) 2 weeks ago
db.ts feat(hq): shareable document link backend (mint/validate/revoke/list) 1 week ago
gmail.ts feat(hq): reminder email send reusing gmail, plus manual-queue routes 2 weeks ago
import-apex.ts feat(hq): seed + apex csv importer with verification and series seeding (HQ-1 task 13) 2 weeks ago
pdf.ts feat(hq): letterhead HTML templates and puppeteer PDF (HQ-1 task 10) 2 weeks ago
reminder-templates.ts feat(hq): reminder templates and idempotent reminder repo 2 weeks ago
repos-amc.ts feat(hq): amc contracts with renewal invoice and derived paid state 2 weeks ago
repos-aws.ts feat(hq): aws usage repo — upsert/list, cross-client cost ranking, routes 2 weeks ago
repos-clients.ts feat(hq): client registry with GSTIN validation (HQ-1 task 4) 2 weeks ago
repos-dashboard.ts feat(hq): dashboard money view and 6-hourly scheduler wiring 2 weeks ago
repos-documents.ts feat(hq): extract pure prepareDraft from createDraft (permissive preview path) 1 week ago
repos-email.ts feat(hq): gmail send with token-death handling and email log (HQ-1 task 11) 2 weeks ago
repos-interactions.ts feat(hq): interaction log with types, follow-ups and routes 2 weeks ago
repos-modules.ts feat(hq): HQ-1.5 — module quote content, pack pick-lists, bundle isolation check 2 weeks ago
repos-payments.ts feat(hq): payment receipts — own RCT/ series, zero-GST acknowledgment PDF 2 weeks ago
repos-recurring.ts feat(hq): recurring plan repo and owner-gated routes 2 weeks ago
repos-reminders.ts feat(hq): reminder templates and idempotent reminder repo 2 weeks ago
repos-reports.ts feat(hq): reports — dues aging, module revenue, client profitability with margin 2 weeks ago
repos-shares.ts feat(hq): shareable document link backend (mint/validate/revoke/list) 1 week ago
scheduler.ts feat(hq): recurring invoice generation with at-most-once auto-send 2 weeks ago
seed.ts feat(hq): hq-2 schema — recurring/amc/interaction/reminder tables + bounce column + seeds 2 weeks ago
send-reminder.ts feat(hq): GET /reminders/:id/preview — exact email via shared reminderContext 1 week ago
series.ts docs(hq): comment ON CONFLICT portability quirk in doc series (D12 guardrail) 2 weeks ago
server.ts feat(hq): schedule monthly aws cost pull and owner-gated manual pull route 2 weeks ago
templates.ts feat(hq): beautify document template — "Slate Ledger" visual system + template.accent 1 week ago