fix: cleanup seed and fetch latest restaurant

This commit is contained in:
AyrisAI
2026-05-15 20:40:23 +03:00
parent 4fbfd39736
commit 6169742476
2 changed files with 21 additions and 5 deletions

View File

@@ -15,8 +15,11 @@ async function main() {
const menuPath = path.join(__dirname, '../menu/menu.json');
const menuData = JSON.parse(fs.readFileSync(menuPath, 'utf-8'));
// 1. Create Restaurant
const restaurant = await prisma.restaurant.create({
console.log('Cleaning up existing data...');
await (prisma as any).item.deleteMany();
await (prisma as any).category.deleteMany();
await (prisma as any).restaurant.deleteMany();
const restaurant = await (prisma as any).restaurant.create({
data: {
name: menuData.restaurant_name,
footerNote: menuData.footer_note,
@@ -40,7 +43,7 @@ async function main() {
console.log(`Created admin user: ${adminUsername}`);
}
for (const cat of menuData.categories) {
const category = await prisma.category.create({
const category = await (prisma as any).category.create({
data: {
title: cat.title,
externalId: cat.id,
@@ -51,7 +54,7 @@ async function main() {
console.log(`Created category: ${category.title}`);
for (const item of cat.items) {
await prisma.item.create({
await (prisma as any).item.create({
data: {
name: item.name,
ingredients: item.ingredients || null,