add order for category

This commit is contained in:
2026-01-05 11:28:36 +03:30
parent 2f4356e8da
commit f4dd09f7a6
4 changed files with 20 additions and 1 deletions
+8 -1
View File
@@ -1,4 +1,4 @@
import { IsString, IsOptional, IsBoolean } from 'class-validator';
import { IsString, IsOptional, IsBoolean, IsInt, Min } from 'class-validator';
import { ApiPropertyOptional } from '@nestjs/swagger';
import { Type } from 'class-transformer';
@@ -17,4 +17,11 @@ export class CreateCategoryDto {
@IsString()
@ApiPropertyOptional({ example: 'https://cdn.example.com/avatar.png' })
avatarUrl?: string;
@IsOptional()
@IsInt()
@Min(0)
@Type(() => Number)
@ApiPropertyOptional({ example: 1 })
order?: number;
}
+8
View File
@@ -111,4 +111,12 @@ export class CreateFoodDto {
@ApiPropertyOptional({ example: false })
@Type(() => Boolean)
isSpecialOffer?: boolean;
@IsOptional()
@IsInt()
@Min(0)
@Type(() => Number)
@ApiPropertyOptional({ example: 1 })
order?: number;
}
@@ -21,4 +21,7 @@ export class Category extends BaseEntity {
@Property({ nullable: true })
avatarUrl?: string;
@Property({ type: 'int', nullable: true })
order?: number;
}
@@ -46,6 +46,7 @@ export class FoodService {
pickupServe: rest.pickupServe ?? false,
discount: rest.discount ?? 0,
isSpecialOffer: rest.isSpecialOffer ?? false,
order: rest.order ?? null,
// map single-title/content DTO to localized fields
title: rest.title,
content: rest.content,