This commit is contained in:
2025-12-08 10:35:11 +03:30
parent a1255f173d
commit aededf6da9
4 changed files with 40 additions and 18 deletions
+12 -9
View File
@@ -1,6 +1,7 @@
import { IsNotEmpty, IsNumber, IsOptional, IsString, Max, Min, IsArray } from 'class-validator';
import { IsNotEmpty, IsNumber, IsOptional, IsString, Max, Min, IsArray, IsEnum } from 'class-validator';
import { ApiProperty, ApiPropertyOptional } from '@nestjs/swagger';
import { Type } from 'class-transformer';
import { PositivePoint, NegativePoint } from '../enums/review-point.enum';
export class CreateReviewDto {
@IsNotEmpty()
@@ -28,22 +29,24 @@ export class CreateReviewDto {
@IsOptional()
@IsArray()
@IsString({ each: true })
@IsEnum(PositivePoint, { each: true })
@ApiPropertyOptional({
description: 'Positive points about the food',
example: ['Great taste', 'Fast delivery'],
type: [String]
example: [PositivePoint.GREAT_TASTE, PositivePoint.FAST_DELIVERY],
enum: PositivePoint,
isArray: true
})
positivePoints?: string[];
positivePoints?: PositivePoint[];
@IsOptional()
@IsArray()
@IsString({ each: true })
@IsEnum(NegativePoint, { each: true })
@ApiPropertyOptional({
description: 'Negative points about the food',
example: ['Too spicy', 'Small portion'],
type: [String]
example: [NegativePoint.TOO_SPICY, NegativePoint.SMALL_PORTION],
enum: NegativePoint,
isArray: true
})
negativePoints?: string[];
negativePoints?: NegativePoint[];
}
+10 -7
View File
@@ -1,6 +1,7 @@
import { IsBoolean, IsNumber, IsOptional, IsString, Max, Min, IsArray } from 'class-validator';
import { IsBoolean, IsNumber, IsOptional, IsString, Max, Min, IsArray, IsEnum } from 'class-validator';
import { ApiPropertyOptional } from '@nestjs/swagger';
import { Type } from 'class-transformer';
import { PositivePoint, NegativePoint } from '../enums/review-point.enum';
export class UpdateReviewDto {
@IsOptional()
@@ -18,21 +19,23 @@ export class UpdateReviewDto {
@IsOptional()
@IsArray()
@IsString({ each: true })
@IsEnum(PositivePoint, { each: true })
@ApiPropertyOptional({
description: 'Positive points about the food',
type: [String]
enum: PositivePoint,
isArray: true
})
positivePoints?: string[];
positivePoints?: PositivePoint[];
@IsOptional()
@IsArray()
@IsString({ each: true })
@IsEnum(NegativePoint, { each: true })
@ApiPropertyOptional({
description: 'Negative points about the food',
type: [String]
enum: NegativePoint,
isArray: true
})
negativePoints?: string[];
negativePoints?: NegativePoint[];
@IsOptional()
@IsBoolean()