feat: enhance product model with subcategory, brand, tags, and nutrition; update related DTOs and services

This commit is contained in:
Nils-Johan Gynther
2026-04-17 18:11:06 +02:00
parent a05d907608
commit a4ea9be7a1
10 changed files with 517 additions and 33 deletions
+8
View File
@@ -0,0 +1,8 @@
import { IsArray, IsString, MaxLength } from 'class-validator';
export class SetTagsDto {
@IsArray()
@IsString({ each: true })
@MaxLength(100, { each: true })
tags!: string[];
}
@@ -16,4 +16,14 @@ export class UpdateProductDto {
@IsString()
@MaxLength(191)
category?: string;
@IsOptional()
@IsString()
@MaxLength(191)
subcategory?: string;
@IsOptional()
@IsString()
@MaxLength(191)
brand?: string;
}
@@ -0,0 +1,38 @@
import { IsNumber, IsOptional, Min } from 'class-validator';
export class UpsertNutritionDto {
@IsOptional()
@IsNumber()
@Min(0)
calories?: number;
@IsOptional()
@IsNumber()
@Min(0)
protein?: number;
@IsOptional()
@IsNumber()
@Min(0)
fat?: number;
@IsOptional()
@IsNumber()
@Min(0)
carbohydrates?: number;
@IsOptional()
@IsNumber()
@Min(0)
salt?: number;
@IsOptional()
@IsNumber()
@Min(0)
sugar?: number;
@IsOptional()
@IsNumber()
@Min(0)
fiber?: number;
}