feat: redigeringsformulär för produkter i admin med namn, canonical name, kategori och mjukradering
This commit is contained in:
@@ -6,4 +6,14 @@ export class UpdateProductDto {
|
||||
@IsNotEmpty()
|
||||
@MaxLength(191)
|
||||
name?: string;
|
||||
|
||||
@IsOptional()
|
||||
@IsString()
|
||||
@MaxLength(191)
|
||||
canonicalName?: string;
|
||||
|
||||
@IsOptional()
|
||||
@IsString()
|
||||
@MaxLength(191)
|
||||
category?: string;
|
||||
}
|
||||
|
||||
@@ -104,6 +104,7 @@ export class ProductsService {
|
||||
name?: string;
|
||||
normalizedName?: string;
|
||||
canonicalName?: string;
|
||||
category?: string | null;
|
||||
} = {};
|
||||
|
||||
if (typeof data.name === 'string') {
|
||||
@@ -132,7 +133,14 @@ export class ProductsService {
|
||||
|
||||
updateData.name = name;
|
||||
updateData.normalizedName = normalizedName;
|
||||
updateData.canonicalName = name;
|
||||
}
|
||||
|
||||
if (typeof data.canonicalName === 'string') {
|
||||
updateData.canonicalName = data.canonicalName.trim() || null;
|
||||
}
|
||||
|
||||
if (typeof data.category === 'string') {
|
||||
updateData.category = data.category.trim() || null;
|
||||
}
|
||||
|
||||
return this.prisma.product.update({
|
||||
|
||||
Reference in New Issue
Block a user