fix(seed): remove duplicate out-of-scope code in seed-products.ts
Some checks failed
Deploy Canina / deploy (push) Has been cancelled

This commit is contained in:
parsa aghaei 2026-07-29 15:23:14 +03:30
parent 7fd7140c9c
commit 8a6afa10d8

View File

@ -283,30 +283,6 @@ export async function main() {
console.warn(`[Seed] Warning upserting product ${artNo}:`, err.message || err);
}
// Seed ingredients
await prisma.productIngredient.deleteMany({ where: { productId: product.id } });
if (cleanIngredients) {
const parts = cleanIngredients.split(/[،,]/).map((s: string) => s.trim()).filter(Boolean);
const meaningful = parts.slice(0, 20);
for (const ing of meaningful) {
const truncated = ing.substring(0, 150);
if (truncated.length > 0) {
await prisma.productIngredient.create({
data: { productId: product.id, ingredient: truncated }
});
}
}
}
// Seed symptoms
await prisma.productSymptom.deleteMany({ where: { productId: product.id } });
const symptomsList = PRODUCT_SYMPTOMS_MAP[baseSlug] || [];
for (const sym of symptomsList) {
await prisma.productSymptom.create({
data: { productId: product.id, symptom: sym }
});
}
variantCount++;
}
}