fix(seed): remove duplicate out-of-scope code in seed-products.ts
Some checks failed
Deploy Canina / deploy (push) Has been cancelled
Some checks failed
Deploy Canina / deploy (push) Has been cancelled
This commit is contained in:
parent
7fd7140c9c
commit
8a6afa10d8
@ -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++;
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user