Files
Atlas/prisma/seed-equipment.ts
2025-11-12 20:21:32 +01:00

180 lines
4.0 KiB
TypeScript

import { PrismaClient } from '@prisma/client';
const prisma = new PrismaClient();
async function main() {
console.log('Starting equipment seed...');
const locations = await prisma.location.findMany();
const luebeck = locations.find(l => l.slug === 'luebeck');
const berlin = locations.find(l => l.slug === 'berlin');
const rostock = locations.find(l => l.slug === 'rostock');
let dieFotoboxJungs = await prisma.project.findFirst({
where: { name: 'Die Fotobox Jungs' },
});
if (!dieFotoboxJungs) {
dieFotoboxJungs = await prisma.project.create({
data: {
name: 'Die Fotobox Jungs',
description: 'Aufgekauftes Projekt mit eigenem Equipment',
active: true,
},
});
console.log('Created project: Die Fotobox Jungs');
}
const equipment = [];
for (let i = 1; i <= 10; i++) {
equipment.push({
name: `Citizen CX-02 #${i}`,
type: 'PRINTER',
brand: 'Citizen',
model: 'CX-02',
serialNumber: `CX02-LUE-${String(i).padStart(3, '0')}`,
quantity: 1,
status: 'AVAILABLE',
locationId: luebeck?.id,
});
}
equipment.push({
name: 'Citizen CX-02 Berlin',
type: 'PRINTER',
brand: 'Citizen',
model: 'CX-02',
serialNumber: 'CX02-BER-001',
quantity: 1,
status: 'AVAILABLE',
locationId: berlin?.id,
});
equipment.push({
name: 'Citizen CX-02 Rostock',
type: 'PRINTER',
brand: 'Citizen',
model: 'CX-02',
serialNumber: 'CX02-ROS-001',
quantity: 1,
status: 'AVAILABLE',
locationId: rostock?.id,
});
for (let i = 1; i <= 4; i++) {
equipment.push({
name: `DNP 620 #${i} (Fotobox Jungs)`,
type: 'PRINTER',
brand: 'DNP',
model: '620',
serialNumber: `DNP620-FBJ-${String(i).padStart(3, '0')}`,
quantity: 1,
status: 'AVAILABLE',
projectId: dieFotoboxJungs.id,
});
}
equipment.push({
name: 'DNP DS-RX1 HS Rostock',
type: 'PRINTER',
brand: 'DNP',
model: 'DS-RX1 HS',
serialNumber: 'DSRX1HS-ROS-001',
quantity: 1,
status: 'AVAILABLE',
locationId: rostock?.id,
});
equipment.push({
name: 'Roter Teppich Set 1',
type: 'CARPET',
quantity: 1,
status: 'AVAILABLE',
locationId: luebeck?.id,
notes: '3m x 1m, inkl. Befestigung',
});
equipment.push({
name: 'VIP Absperrbänder Set',
type: 'VIP_BARRIER',
quantity: 2,
status: 'AVAILABLE',
locationId: luebeck?.id,
notes: '2x Ständer mit rotem Samt-Band',
});
equipment.push({
name: 'Accessoires-Koffer Standard',
type: 'ACCESSORIES_KIT',
quantity: 1,
status: 'AVAILABLE',
locationId: luebeck?.id,
notes: 'Hüte, Brillen, Schnurrbärte, Schilder',
});
equipment.push({
name: 'Druckerpapier Citizen 10x15',
type: 'PRINTER_PAPER',
brand: 'Citizen',
model: '10x15cm',
quantity: 1,
currentStock: 50,
minStockLevel: 10,
status: 'AVAILABLE',
locationId: luebeck?.id,
notes: 'Für Citizen CX-02 Drucker',
});
equipment.push({
name: 'Druckerpapier DNP 15x20',
type: 'PRINTER_PAPER',
brand: 'DNP',
model: '15x20cm',
quantity: 1,
currentStock: 8,
minStockLevel: 10,
status: 'AVAILABLE',
locationId: luebeck?.id,
notes: 'Für DNP 620 Drucker',
});
equipment.push({
name: 'Stativ Manfrotto #1',
type: 'TRIPOD',
brand: 'Manfrotto',
model: 'Compact Advanced',
quantity: 1,
status: 'AVAILABLE',
locationId: luebeck?.id,
});
equipment.push({
name: 'Stativ Manfrotto #2',
type: 'TRIPOD',
brand: 'Manfrotto',
model: 'Compact Advanced',
quantity: 1,
status: 'AVAILABLE',
locationId: berlin?.id,
});
for (const item of equipment) {
await prisma.equipment.create({
data: item as any,
});
}
console.log(`Created ${equipment.length} equipment items`);
console.log('Equipment seed completed!');
}
main()
.catch((e) => {
console.error(e);
process.exit(1);
})
.finally(async () => {
await prisma.$disconnect();
});