dow-prod-tracker/prisma
DJP 958de5f3a9 Add Briefs intake + all three upstream webhooks
Briefs are pre-project requests. Three intake paths land in one place:
  1. Manual  — "New Brief" dialog on /briefs
  2. REST    — POST /api/briefs (auth'd)
  3. Webhook — POST /api/webhooks/briefs (HMAC-signed)

Once triaged, "Promote to Project" flips Brief.status → CONVERTED,
creates the Project, and links them via convertedProjectId so the
audit trail stays intact.

Schema:
- New BriefStatus enum + Brief model, indexed on org/status/team
- Unique on (organizationId, externalId) so webhook replays are
  idempotent — same upstream id = update, not insert
- Migration 20260422000000_briefs, hand-written SQL

Webhooks — now three total, each with its own secret and header:
- /api/webhooks/omg           (projects — existing, unchanged)
- /api/webhooks/deliverables  (NEW — keyed on project OMG # + name)
- /api/webhooks/briefs        (NEW — keyed on externalId)

Extracted a shared HMAC verifier at src/lib/webhooks/hmac.ts so the
two new routes don't copy-paste the crypto code from the OMG route.
Deliverables webhook looks up the parent project by OMG job number
(the canonical key from the projects webhook); returns 404 with a
hint if the project hasn't been created yet. Brief webhook source
records "webhook:<system>" so we can tell where briefs come from.

UI:
- /briefs page: filterable/searchable table, inline status dropdown
  per row, New Brief dialog, Promote to Project dialog
- Sidebar nav entry for Briefs above Projects

Env: added DELIVERABLE_WEBHOOK_SECRET / ALLOW_INSECURE and
BRIEF_WEBHOOK_SECRET / ALLOW_INSECURE alongside the existing OMG
pair in .env.example.
2026-04-21 12:05:47 -04:00
..
migrations Add Briefs intake + all three upstream webhooks 2026-04-21 12:05:47 -04:00
schema.prisma Add Briefs intake + all three upstream webhooks 2026-04-21 12:05:47 -04:00
seed-dow.ts Seed: real Dow/Oliver roster (20 users) replaces placeholders 2026-04-21 09:46:45 -04:00
seed-tracker-data.ts feat: enhance UI components and add assignment feature to deliverables 2026-03-02 13:46:55 -06:00
seed.ts Database cleanup pre rollout 2026-04-06 14:35:56 -05:00