feat: Phase 2 Start - Shopping List Database Schema
🚀 PROCEEDING WITH ROADMAP PARITY ✅ Seed Data Updated: - Removed all test users - Kept only 777 Wolfpack team (Travis, Jen, King) - Preserved walkthrough data 📦 Shopping List Feature (Phase 3A): - Added SupplyItem model - Added SupplyCategory enum (FILTER, CLEANING, PPE, OFFICE, BATHROOM, KITCHEN, MAINTENANCE, OTHER) - Fields: name, category, quantity, minThreshold, unit, location, lastOrdered, notes Next Steps: 1. Run migration 2. Create backend API 3. Create frontend UI 4. Deploy Priority: Shopping List → Touch Points → Task Lists
This commit is contained in:
parent
17138b2f80
commit
d42331075d
2 changed files with 63 additions and 65 deletions
|
|
@ -241,3 +241,31 @@ model PlantHealthCheck {
|
||||||
|
|
||||||
@@map("plant_health_checks")
|
@@map("plant_health_checks")
|
||||||
}
|
}
|
||||||
|
// Supply/Shopping List models
|
||||||
|
model SupplyItem {
|
||||||
|
id String @id @default(uuid())
|
||||||
|
name String
|
||||||
|
category SupplyCategory
|
||||||
|
quantity Int @default(0)
|
||||||
|
minThreshold Int @default(0)
|
||||||
|
unit String // "each", "box", "roll", "gallon", etc.
|
||||||
|
location String? // "Storage Room", "Bathroom", etc.
|
||||||
|
lastOrdered DateTime?
|
||||||
|
notes String?
|
||||||
|
|
||||||
|
createdAt DateTime @default(now())
|
||||||
|
updatedAt DateTime @updatedAt
|
||||||
|
|
||||||
|
@@map("supply_items")
|
||||||
|
}
|
||||||
|
|
||||||
|
enum SupplyCategory {
|
||||||
|
FILTER // Air filters, water filters
|
||||||
|
CLEANING // Cleaning supplies
|
||||||
|
PPE // Gloves, masks, suits
|
||||||
|
OFFICE // Paper, pens, etc.
|
||||||
|
BATHROOM // Toilet paper, soap, etc.
|
||||||
|
KITCHEN // Coffee, snacks, etc.
|
||||||
|
MAINTENANCE // Tools, parts, etc.
|
||||||
|
OTHER
|
||||||
|
}
|
||||||
|
|
|
||||||
|
|
@ -3,83 +3,53 @@ const bcrypt = require('bcrypt');
|
||||||
|
|
||||||
const prisma = new PrismaClient();
|
const prisma = new PrismaClient();
|
||||||
|
|
||||||
const Role = {
|
|
||||||
OWNER: 'OWNER',
|
|
||||||
MANAGER: 'MANAGER',
|
|
||||||
GROWER: 'GROWER',
|
|
||||||
STAFF: 'STAFF'
|
|
||||||
};
|
|
||||||
|
|
||||||
const RoomType = {
|
|
||||||
VEG: 'VEG',
|
|
||||||
FLOWER: 'FLOWER',
|
|
||||||
DRY: 'DRY',
|
|
||||||
CURE: 'CURE',
|
|
||||||
MOTHER: 'MOTHER',
|
|
||||||
CLONE: 'CLONE'
|
|
||||||
};
|
|
||||||
|
|
||||||
async function main() {
|
async function main() {
|
||||||
console.log('Seeding database...');
|
console.log('Seeding database...');
|
||||||
|
|
||||||
// Hash password once for all users
|
// Hash password once
|
||||||
const hashedPassword = await bcrypt.hash('password123', 10);
|
const hashedPassword = await bcrypt.hash('password123', 10);
|
||||||
|
|
||||||
// Create test users for each role
|
// 777 Wolfpack Team (Production Users)
|
||||||
const users = [
|
const travis = await prisma.user.upsert({
|
||||||
{
|
where: { email: 'travis@runfoo.run' },
|
||||||
email: 'admin@runfoo.run',
|
update: {},
|
||||||
|
create: {
|
||||||
|
email: 'travis@runfoo.run',
|
||||||
passwordHash: hashedPassword,
|
passwordHash: hashedPassword,
|
||||||
name: 'Facility Owner',
|
name: 'Travis',
|
||||||
role: Role.OWNER,
|
role: 'MANAGER',
|
||||||
rate: 50.00
|
rate: 35.00,
|
||||||
},
|
},
|
||||||
{
|
});
|
||||||
email: 'manager@runfoo.run',
|
|
||||||
|
const jen = await prisma.user.upsert({
|
||||||
|
where: { email: 'jen@runfoo.run' },
|
||||||
|
update: {},
|
||||||
|
create: {
|
||||||
|
email: 'jen@runfoo.run',
|
||||||
passwordHash: hashedPassword,
|
passwordHash: hashedPassword,
|
||||||
name: 'Operations Manager',
|
name: 'Jen',
|
||||||
role: Role.MANAGER,
|
role: 'GROWER',
|
||||||
rate: 35.00
|
rate: 30.00,
|
||||||
},
|
},
|
||||||
{
|
});
|
||||||
email: 'grower@runfoo.run',
|
|
||||||
|
const king = await prisma.user.upsert({
|
||||||
|
where: { email: 'king@runfoo.run' },
|
||||||
|
update: {},
|
||||||
|
create: {
|
||||||
|
email: 'king@runfoo.run',
|
||||||
passwordHash: hashedPassword,
|
passwordHash: hashedPassword,
|
||||||
name: 'Head Grower',
|
name: 'King',
|
||||||
role: Role.GROWER,
|
role: 'GROWER',
|
||||||
rate: 30.00
|
rate: 30.00,
|
||||||
},
|
},
|
||||||
{
|
});
|
||||||
email: 'staff@runfoo.run',
|
|
||||||
passwordHash: hashedPassword,
|
|
||||||
name: 'Floor Staff',
|
|
||||||
role: Role.STAFF,
|
|
||||||
rate: 20.00
|
|
||||||
}
|
|
||||||
];
|
|
||||||
|
|
||||||
for (const userData of users) {
|
console.log('✅ Created 777 Wolfpack team users');
|
||||||
const existing = await prisma.user.findUnique({ where: { email: userData.email } });
|
console.log(' - Travis (Manager)');
|
||||||
if (!existing) {
|
console.log(' - Jen (Grower)');
|
||||||
await prisma.user.create({ data: userData });
|
console.log(' - King (Grower)');
|
||||||
console.log(`Created ${userData.role}: ${userData.email} / password123`);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Create Default Rooms
|
|
||||||
const rooms = [
|
|
||||||
{ name: 'Veg Room 1', type: RoomType.VEG, sqft: 1200 },
|
|
||||||
{ name: 'Flower Room A', type: RoomType.FLOWER, sqft: 2500 },
|
|
||||||
{ name: 'Flower Room B', type: RoomType.FLOWER, sqft: 2500 },
|
|
||||||
{ name: 'Dry Room', type: RoomType.DRY, sqft: 800 },
|
|
||||||
];
|
|
||||||
|
|
||||||
for (const r of rooms) {
|
|
||||||
const existing = await prisma.room.findFirst({ where: { name: r.name } });
|
|
||||||
if (!existing) {
|
|
||||||
await prisma.room.create({ data: r });
|
|
||||||
console.log(`Created Room: ${r.name}`);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
console.log('Seeding complete.');
|
console.log('Seeding complete.');
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue