prisma/seed-dow.ts — idempotent seed for the Dow Jones tenant: - Organization "Dow Jones" (dowjones.com) - 6 ClientTeams: Brand, Events, B2B, Content, Briefing Team, Performance - 3 placeholder Pods (Sergio, Deborah, Shared) — replace with real roster when it's available - Dow Pipeline Template "Dow Jones Standard" with 11 stages: Pipeline → New → Copywriter → Client Review (Copy) → In Progress Creative → Internal Review → Client Feedback → Final Approval → Completed (+ On Hold, Canceled as terminal parking) - Stage dependencies wired (optional stages bypass cleanly so In Progress Creative reaches from New when Copywriter is skipped) - Automation rule "Client Feedback → reopen In Progress Creative": trigger on stage.status_changed where stageSlug=client-feedback and newStatus=CHANGES_REQUESTED. Actions: reopen sibling stage + increment revisionRound, send notification to assignee+producer. - Initial admin user (DOW_ADMIN_EMAIL, default admin@dowjones.com) with bcrypt password and mustChangePassword=true. If DOW_ADMIN_PASSWORD env is unset a secure random is generated and logged once for handoff. - RBAC defaults seeded per role including CLIENT_VIEWER. - Legacy global PipelineStageTemplate rows seeded as FK scaffolding. New action type "reopen_sibling_stage" in action-executor.ts: - Given event.payload.deliverableId + params.siblingSlug, finds the sibling stage (matching either stageDefinition.slug or template.slug) and sets it to params.reopenStatus (default IN_PROGRESS). If params.incrementRound=true, bumps the stage's revisionRound counter and clears completedDate. Added to validateActions' allow-list. Wiring: - package.json db:seed → tsx prisma/seed-dow.ts (HP seed kept at db:seed-legacy for reference until deleted) - prisma.config.ts migrations.seed → seed-dow.ts - bcryptjs + @types/bcryptjs added Verified: tsc --noEmit ✓ zero errors. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
15 lines
410 B
TypeScript
15 lines
410 B
TypeScript
// This file was generated by Prisma, and assumes you have installed the following:
|
|
// npm install --save-dev prisma dotenv
|
|
import "dotenv/config";
|
|
import { defineConfig } from "prisma/config";
|
|
|
|
export default defineConfig({
|
|
schema: "prisma/schema.prisma",
|
|
migrations: {
|
|
path: "prisma/migrations",
|
|
seed: "tsx prisma/seed-dow.ts",
|
|
},
|
|
datasource: {
|
|
url: process.env["DATABASE_URL"],
|
|
},
|
|
});
|