review
This commit is contained in:
@@ -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[];
|
||||
}
|
||||
|
||||
|
||||
@@ -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()
|
||||
|
||||
Reference in New Issue
Block a user