/** * Realistic seed (the "production-shaped" fixture). * * Bootstraps ports + roles + super-admin profile, then runs * `seedPortData()` per port to load the NocoDB-shaped multi-cardinality * fixture (117 berths, 8 clients, 3 companies, 12 yachts, 15 interests, * 8 reservations). * * For a focused test fixture covering every pipeline stage + archive * variants, use `pnpm db:seed:synthetic` instead. * * Run with: pnpm db:seed */ import 'dotenv/config'; import { seedBootstrap } from './seed-bootstrap'; import { seedPortData, type SeedSummary } from './seed-data'; async function seed() { console.log('Seeding Port Nimara CRM (realistic fixture)...'); const portIds = await seedBootstrap(); console.log(''); console.log('Seeding per-port fixtures...'); const summaries: Array<{ name: string; summary: SeedSummary | null }> = []; for (const p of portIds) { console.log(` [${p.slug}] seeding fixture data...`); const summary = await seedPortData(p.id, p.slug); summaries.push({ name: p.name, summary }); } console.log(''); console.log('─── Summary ───────────────────────────────────────────────'); for (const s of summaries) { if (s.summary === null) { console.log(` ✓ Port "${s.name}" - already seeded (skipped)`); } else { const x = s.summary; console.log( ` ✓ Port "${s.name}" - ${x.berths} berths, ${x.clients} clients, ${x.companies} companies, ${x.yachts} yachts, ${x.interests} interests, ${x.tenancies} tenancies`, ); } } console.log(''); console.log('Seed complete!'); process.exit(0); } seed().catch((err) => { console.error('Seed failed:', err); process.exit(1); });