Compare commits
No commits in common. "8a6afa10d81634d647c7e7441525ba654fbfbc9c" and "e1fb300b8714e3823384f55fbe5f025ef25e43cc" have entirely different histories.
8a6afa10d8
...
e1fb300b87
@ -283,6 +283,30 @@ export async function main() {
|
|||||||
console.warn(`[Seed] Warning upserting product ${artNo}:`, err.message || err);
|
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++;
|
variantCount++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user