From 9188d12475221e87c9fab24388f3635eae5846a6 Mon Sep 17 00:00:00 2001 From: fullsizemalt <106900403+fullsizemalt@users.noreply.github.com> Date: Thu, 11 Dec 2025 11:51:00 -0800 Subject: [PATCH] fix(seed): Update seed.js with correct Role Enum values (GROWER, STAFF) --- backend/prisma/seed.js | 43 +++++++++++++++++++++--------------------- 1 file changed, 21 insertions(+), 22 deletions(-) diff --git a/backend/prisma/seed.js b/backend/prisma/seed.js index 0580c75..b7ae554 100644 --- a/backend/prisma/seed.js +++ b/backend/prisma/seed.js @@ -36,7 +36,7 @@ async function main() { isSystem: true }, { - name: 'Cultivator', + name: 'Grower', description: 'Plant care and daily operations', permissions: { tasks: { view: true, complete: true }, @@ -76,7 +76,7 @@ async function main() { const ownerRole = await prisma.role.findUnique({ where: { name: 'Facility Owner' } }); const managerRole = await prisma.role.findUnique({ where: { name: 'Manager' } }); - const cultivatorRole = await prisma.role.findUnique({ where: { name: 'Cultivator' } }); + const cultivatorRole = await prisma.role.findUnique({ where: { name: 'Grower' } }); const workerRole = await prisma.role.findUnique({ where: { name: 'Worker' } }); // ==================== USERS ==================== @@ -102,7 +102,7 @@ async function main() { email: 'cultivator@demo.local', password: 'demo1234', name: `${DEMO_PREFIX} Mike Thompson`, - role: 'CULTIVATOR', + role: 'GROWER', roleId: cultivatorRole?.id, rate: 28.00 }, @@ -110,7 +110,7 @@ async function main() { email: 'worker@demo.local', password: 'demo1234', name: `${DEMO_PREFIX} Alex Rivera`, - role: 'WORKER', + role: 'STAFF', roleId: workerRole?.id, rate: 22.00 } @@ -158,38 +158,36 @@ async function main() { } // ==================== BATCHES ==================== - console.log('\n🌿 Creating Demo Batches...'); - const cultivator = await prisma.user.findFirst({ where: { email: 'cultivator@demo.local' } }); - + console.log('\n🌱 Creating Demo Batches...'); const batchesData = [ { - name: `${DEMO_PREFIX} OG Kush - Batch 001`, - strain: 'OG Kush', + name: `${DEMO_PREFIX} Gorilla Glue #4 - Batch 001`, + strain: 'Gorilla Glue #4', status: 'ACTIVE', - stage: 'VEGETATIVE', + stage: 'FLOWERING', source: 'CLONE', - plantCount: 48, - startDate: new Date(Date.now() - 14 * 24 * 60 * 60 * 1000), // 14 days ago - roomId: createdRooms.find(r => r.name.includes('Veg Room 1'))?.id + plantCount: 450, + startDate: new Date(Date.now() - 45 * 24 * 60 * 60 * 1000), // 45 days ago + roomId: createdRooms.find(r => r.name.includes('Flower Room A'))?.id }, { name: `${DEMO_PREFIX} Blue Dream - Batch 002`, strain: 'Blue Dream', status: 'ACTIVE', - stage: 'FLOWERING', + stage: 'VEGETATIVE', source: 'CLONE', - plantCount: 36, - startDate: new Date(Date.now() - 45 * 24 * 60 * 60 * 1000), // 45 days ago - roomId: createdRooms.find(r => r.name.includes('Flower Room A'))?.id + plantCount: 300, + startDate: new Date(Date.now() - 20 * 24 * 60 * 60 * 1000), // 20 days ago + roomId: createdRooms.find(r => r.name.includes('Veg Room 1'))?.id }, { - name: `${DEMO_PREFIX} Girl Scout Cookies - Batch 003`, - strain: 'Girl Scout Cookies', + name: `${DEMO_PREFIX} Wedding Cake - Batch 003`, + strain: 'Wedding Cake', status: 'ACTIVE', stage: 'FLOWERING', - source: 'SEED', - plantCount: 24, - startDate: new Date(Date.now() - 52 * 24 * 60 * 60 * 1000), // 52 days ago + source: 'CLONE', + plantCount: 400, + startDate: new Date(Date.now() - 10 * 24 * 60 * 60 * 1000), // 10 days ago (Just flipped) roomId: createdRooms.find(r => r.name.includes('Flower Room B'))?.id }, { @@ -272,6 +270,7 @@ async function main() { // ==================== TASKS ==================== console.log('\n✅ Creating Demo Tasks...'); const manager = await prisma.user.findFirst({ where: { email: 'manager@demo.local' } }); + const cultivator = await prisma.user.findFirst({ where: { email: 'cultivator@demo.local' } }); const tasksData = [ {