From a020d13c000a9ba71ba749bdcf054d5c5659307d Mon Sep 17 00:00:00 2001 From: Matt Date: Fri, 30 Jan 2026 16:40:07 +0100 Subject: [PATCH] Update seed: real admin accounts, remove all dummy data - Add matt@monaco-opc.com and admin@monaco-opc.com as SUPER_ADMIN with passwords - Remove dummy jury members (jury1-3@example.com) - Remove dummy sample projects - Keep system settings, program, round, and evaluation form Co-Authored-By: Claude Opus 4.5 --- prisma/seed.ts | 130 +++++++++++++++---------------------------------- 1 file changed, 38 insertions(+), 92 deletions(-) diff --git a/prisma/seed.ts b/prisma/seed.ts index c1249bc..b643b5c 100644 --- a/prisma/seed.ts +++ b/prisma/seed.ts @@ -7,6 +7,7 @@ import { SettingType, SettingCategory, } from '@prisma/client' +import bcrypt from 'bcryptjs' const prisma = new PrismaClient() @@ -244,22 +245,41 @@ async function main() { } // ========================================================================== - // Create Super Admin + // Create Admin Users // ========================================================================== - console.log('👤 Creating super admin...') + console.log('👤 Creating admin users...') - const admin = await prisma.user.upsert({ - where: { email: 'matt.ciaccio@gmail.com' }, - update: {}, - create: { - email: 'matt.ciaccio@gmail.com', - name: 'Matt Ciaccio', - role: UserRole.SUPER_ADMIN, - status: UserStatus.ACTIVE, + const adminAccounts = [ + { + email: 'matt@monaco-opc.com', + name: 'Matt', + password: '195260Mp!', }, - }) + { + email: 'admin@monaco-opc.com', + name: 'Admin', + password: 'XDvVSDkPJKDXozlx', + }, + ] - console.log(` Created admin: ${admin.email}`) + for (const account of adminAccounts) { + const passwordHash = await bcrypt.hash(account.password, 12) + const user = await prisma.user.upsert({ + where: { email: account.email }, + update: { passwordHash }, + create: { + email: account.email, + name: account.name, + role: UserRole.SUPER_ADMIN, + status: UserStatus.ACTIVE, + passwordHash, + mustSetPassword: false, + passwordSetAt: new Date(), + onboardingCompletedAt: new Date(), + }, + }) + console.log(` Created admin: ${user.email}`) + } // ========================================================================== // Create Sample Program @@ -393,89 +413,15 @@ async function main() { console.log(' Created evaluation form v1') - // ========================================================================== - // Create Sample Jury Members - // ========================================================================== - console.log('👥 Creating sample jury members...') - - const juryMembers = [ - { - email: 'jury1@example.com', - name: 'Dr. Marine Expert', - expertiseTags: ['marine_biology', 'conservation', 'policy'], - }, - { - email: 'jury2@example.com', - name: 'Tech Innovator', - expertiseTags: ['technology', 'innovation', 'startups'], - }, - { - email: 'jury3@example.com', - name: 'Ocean Advocate', - expertiseTags: ['conservation', 'sustainability', 'education'], - }, - ] - - for (const jury of juryMembers) { - await prisma.user.upsert({ - where: { email: jury.email }, - update: {}, - create: { - email: jury.email, - name: jury.name, - role: UserRole.JURY_MEMBER, - status: UserStatus.INVITED, - expertiseTags: jury.expertiseTags, - maxAssignments: 15, - }, - }) - console.log(` Created jury member: ${jury.email}`) - } - - // ========================================================================== - // Create Sample Projects - // ========================================================================== - console.log('📦 Creating sample projects...') - - const sampleProjects = [ - { - title: 'OceanAI - Plastic Detection System', - teamName: 'BlueWave Tech', - description: 'AI-powered system using satellite imagery and drones to detect and map ocean plastic concentrations for targeted cleanup operations.', - tags: ['technology', 'ai', 'plastic_pollution'], - }, - { - title: 'Coral Restoration Network', - teamName: 'ReefGuard Foundation', - description: 'Community-driven coral nursery and transplantation program using innovative 3D-printed substrates.', - tags: ['conservation', 'coral', 'community'], - }, - { - title: 'SeaTrack - Sustainable Fishing Tracker', - teamName: 'FishRight Solutions', - description: 'Blockchain-based supply chain tracking system ensuring sustainable fishing practices from ocean to table.', - tags: ['technology', 'sustainable_fishing', 'blockchain'], - }, - ] - - for (const project of sampleProjects) { - await prisma.project.create({ - data: { - roundId: round1.id, - title: project.title, - teamName: project.teamName, - description: project.description, - tags: project.tags, - }, - }) - console.log(` Created project: ${project.title}`) - } - console.log('') console.log('✅ Seeding completed successfully!') console.log('') - console.log('📧 Admin login: matt.ciaccio@gmail.com') - console.log(' (Use magic link authentication)') + console.log('Admin accounts:') + for (const account of adminAccounts) { + console.log(` ${account.email}`) + } + console.log('') + console.log('Next: run seed-candidatures.ts to import real participant data') } main()