NestJS + Prisma/Postgres API shared by the site, admin and attendee app. Ports the site's D1 application flow and review, stores every inquiry form, sells tickets with discount codes (manual payment confirmation), and runs booth/startup/mystery-investee QR scans with derived points and raffles. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
65 lines
3.4 KiB
TypeScript
65 lines
3.4 KiB
TypeScript
// Idempotent. `pnpm db:seed` = sectors + ticket tiers from the site. `pnpm db:seed --demo` adds sample
|
|
// checkpoints, merch and a raffle so the admin and app have something to show.
|
|
import { PrismaService } from '../src/prisma.service.js';
|
|
import { newToken } from '../src/modules/commerce.js';
|
|
import { DEFAULT_POINTS } from '../src/modules/game.js';
|
|
|
|
const prisma = new PrismaService();
|
|
|
|
const sectors = [
|
|
'Agriculture & Agritech', 'Fintech', 'Health & Healthtech', 'Education & Edtech', 'E-commerce & Retail',
|
|
'Logistics & Mobility', 'Manufacturing', 'Energy & Cleantech', 'Tourism & Hospitality', 'Creative & Media',
|
|
'Construction & Real Estate', 'Software / SaaS', 'Social Impact',
|
|
];
|
|
|
|
// Mirrors GRVSummit/content/tickets.ts; edit prices in the admin afterwards.
|
|
const tiers = [
|
|
{
|
|
code: 'summit-pass', name: 'Summit Pass', priceMinor: 15000, sortOrder: 1,
|
|
description: 'Full access to both days including workshops, panels, exhibitor hall, and pitch finals.',
|
|
features: ['2-day summit access', 'Workshops & panel discussions', 'Exhibitor hall networking', 'Pitch competition attendance'],
|
|
},
|
|
{
|
|
code: 'vip-pass', name: 'VIP Pass', priceMinor: 35000, sortOrder: 2,
|
|
description: 'Premium access with reserved seating and exclusive networking sessions.',
|
|
features: ['Everything in Summit Pass', 'Reserved seating', 'VIP networking reception', 'Priority check-in'],
|
|
},
|
|
{
|
|
code: 'cocktail-pass', name: 'Cocktail Pass', priceMinor: 7500, sortOrder: 3, scheduleLabel: 'Day 2 — 22 Feb 2027',
|
|
description: 'Join the summit cocktail reception and evening networking on the second day at Skylight Hotel.',
|
|
features: ['Day 2 evening cocktail reception', 'Networking with investors & founders', 'Light bites & refreshments', 'Summit program guide'],
|
|
},
|
|
];
|
|
|
|
for (const [i, name] of sectors.entries()) {
|
|
await prisma.sector.upsert({ where: { name }, create: { name, sortOrder: i + 1 }, update: {} });
|
|
}
|
|
await prisma.sector.upsert({ where: { name: 'Other' }, create: { name: 'Other', sortOrder: 99 }, update: {} });
|
|
for (const t of tiers) await prisma.ticketTier.upsert({ where: { code: t.code }, create: t, update: {} });
|
|
|
|
if (process.argv.includes('--demo') && (await prisma.checkpoint.count()) === 0) {
|
|
const cp = (kind: keyof typeof DEFAULT_POINTS, label: string, extra: object = {}) => ({
|
|
kind, label, points: DEFAULT_POINTS[kind], qrToken: newToken(), ...extra,
|
|
});
|
|
await prisma.checkpoint.createMany({
|
|
data: [
|
|
cp('BOOTH', 'Ethiopian Airlines', { organisation: 'Ethiopian Airlines', boothNumber: 'A1' }),
|
|
cp('BOOTH', 'UNDP Ethiopia', { organisation: 'UNDP', boothNumber: 'A2' }),
|
|
cp('BOOTH', 'EDTF', { organisation: 'Ethiopian Diaspora Trust Fund', boothNumber: 'B1' }),
|
|
cp('STARTUP_MEMBER', 'Founder & CEO', { organisation: 'Demo Startup', personName: 'Sample Founder' }),
|
|
cp('STARTUP_MEMBER', 'CTO', { organisation: 'Demo Startup', personName: 'Sample CTO' }),
|
|
cp('MYSTERY_INVESTEE', 'Next investee', { organisation: 'Secret Startup', personName: 'Mystery Founder' }),
|
|
],
|
|
});
|
|
await prisma.merchItem.createMany({
|
|
data: [
|
|
{ name: 'GRV Summit T-shirt', priceMinor: 1500, sizes: ['S', 'M', 'L', 'XL'], stock: 100 },
|
|
{ name: 'GRV Tote bag', priceMinor: 1000, stock: 50 },
|
|
],
|
|
});
|
|
await prisma.raffle.create({ data: { name: 'Grand raffle', prize: 'Round-trip flight', minPoints: 50 } });
|
|
}
|
|
|
|
console.log('Seeded.');
|
|
await prisma.$disconnect();
|