feat: implement pricing item model and CRUD API for pricing management
This commit is contained in:
@@ -47,6 +47,26 @@ async function main() {
|
||||
console.log('✓ JWT secret already exists, skipping.');
|
||||
}
|
||||
|
||||
// Seed default pricing items (idempotent — only if table is empty)
|
||||
const pricingCount = await prisma.pricingItem.count();
|
||||
if (pricingCount === 0) {
|
||||
const defaultItems = [
|
||||
{ id: 'base', label: 'G1 Robot Base', price: 250000, sortOrder: 0 },
|
||||
{ id: 'emarati-kandura', label: 'Emarati Kandura', price: 15000, sortOrder: 1 },
|
||||
{ id: 'industrial-vest', label: 'Industrial Vest', price: 8500, sortOrder: 2 },
|
||||
{ id: 'business-suit', label: 'Business Suit', price: 12000, sortOrder: 3 },
|
||||
{ id: 'custom-color', label: 'Custom Color', price: 3500, sortOrder: 4 },
|
||||
{ id: 'robot-doctor', label: 'Robot Doctor', price: 5000, sortOrder: 5 },
|
||||
{ id: 'security-guard', label: 'Security Guard', price: 5000, sortOrder: 6 },
|
||||
];
|
||||
for (const item of defaultItems) {
|
||||
await prisma.pricingItem.create({ data: item });
|
||||
}
|
||||
console.log(`✓ Seeded ${defaultItems.length} default pricing items.`);
|
||||
} else {
|
||||
console.log(`✓ ${pricingCount} pricing items already exist, skipping.`);
|
||||
}
|
||||
|
||||
console.log('Seeding complete!');
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user