add order for category
This commit is contained in:
@@ -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 { ApiPropertyOptional } from '@nestjs/swagger';
|
||||||
import { Type } from 'class-transformer';
|
import { Type } from 'class-transformer';
|
||||||
|
|
||||||
@@ -17,4 +17,11 @@ export class CreateCategoryDto {
|
|||||||
@IsString()
|
@IsString()
|
||||||
@ApiPropertyOptional({ example: 'https://cdn.example.com/avatar.png' })
|
@ApiPropertyOptional({ example: 'https://cdn.example.com/avatar.png' })
|
||||||
avatarUrl?: string;
|
avatarUrl?: string;
|
||||||
|
|
||||||
|
@IsOptional()
|
||||||
|
@IsInt()
|
||||||
|
@Min(0)
|
||||||
|
@Type(() => Number)
|
||||||
|
@ApiPropertyOptional({ example: 1 })
|
||||||
|
order?: number;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -111,4 +111,12 @@ export class CreateFoodDto {
|
|||||||
@ApiPropertyOptional({ example: false })
|
@ApiPropertyOptional({ example: false })
|
||||||
@Type(() => Boolean)
|
@Type(() => Boolean)
|
||||||
isSpecialOffer?: 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 })
|
@Property({ nullable: true })
|
||||||
avatarUrl?: string;
|
avatarUrl?: string;
|
||||||
|
|
||||||
|
@Property({ type: 'int', nullable: true })
|
||||||
|
order?: number;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -46,6 +46,7 @@ export class FoodService {
|
|||||||
pickupServe: rest.pickupServe ?? false,
|
pickupServe: rest.pickupServe ?? false,
|
||||||
discount: rest.discount ?? 0,
|
discount: rest.discount ?? 0,
|
||||||
isSpecialOffer: rest.isSpecialOffer ?? false,
|
isSpecialOffer: rest.isSpecialOffer ?? false,
|
||||||
|
order: rest.order ?? null,
|
||||||
// map single-title/content DTO to localized fields
|
// map single-title/content DTO to localized fields
|
||||||
title: rest.title,
|
title: rest.title,
|
||||||
content: rest.content,
|
content: rest.content,
|
||||||
|
|||||||
Reference in New Issue
Block a user