feat: implement DEV_TICKETS including product categories seeding, SEO metaTitle/metaDescription, scientificTagline, requiresRx notice, and suitableFor normalization
This commit is contained in:
1 parent
913e6acd3d
commit
d6d4158cbe
7 files changed
+116
-24
No files matched your search
@@ -508,6 +508,14 @@ export class AdminService {
|
||||
: {}),
|
||||
};
|
||||
|
||||
let resolvedCategorySlug = data.categorySlug;
|
||||
if (data.categoryId && (!resolvedCategorySlug || resolvedCategorySlug === 'general')) {
|
||||
const cat = await this.prisma.category.findUnique({ where: { id: data.categoryId } });
|
||||
if (cat) {
|
||||
resolvedCategorySlug = cat.slug;
|
||||
}
|
||||
}
|
||||
|
||||
const product = await this.prisma.product.create({
|
||||
data: {
|
||||
artNo: data.artNo || `ART-${Date.now()}`,
|
||||
@@ -518,7 +526,7 @@ export class AdminService {
|
||||
shortDescription: data.shortDescription || '',
|
||||
ingredients: data.ingredients || null,
|
||||
categoryId: data.categoryId || '',
|
||||
categorySlug: data.categorySlug || 'general',
|
||||
categorySlug: resolvedCategorySlug || 'general',
|
||||
buyPrice: data.buyPrice !== undefined ? data.buyPrice : 0,
|
||||
marginRetailPercent:
|
||||
marginRetail !== undefined ? marginRetail : undefined,
|
||||
@@ -662,6 +670,14 @@ export class AdminService {
|
||||
: {}),
|
||||
};
|
||||
|
||||
let resolvedCategorySlug = data.categorySlug;
|
||||
if (data.categoryId && !resolvedCategorySlug) {
|
||||
const cat = await this.prisma.category.findUnique({ where: { id: data.categoryId } });
|
||||
if (cat) {
|
||||
resolvedCategorySlug = cat.slug;
|
||||
}
|
||||
}
|
||||
|
||||
const product = await this.prisma.product.update({
|
||||
where: { id },
|
||||
data: {
|
||||
@@ -673,7 +689,7 @@ export class AdminService {
|
||||
shortDescription: data.shortDescription,
|
||||
ingredients: data.ingredients !== undefined ? data.ingredients : undefined,
|
||||
categoryId: data.categoryId,
|
||||
categorySlug: data.categorySlug,
|
||||
categorySlug: resolvedCategorySlug !== undefined ? resolvedCategorySlug : undefined,
|
||||
buyPrice: data.buyPrice !== undefined ? data.buyPrice : undefined,
|
||||
marginRetailPercent:
|
||||
marginRetail !== undefined ? marginRetail : undefined,
|
||||
|
||||
Reference in new issue
Block a user