Files
dpage-api/src/modules/review/dto/update-review.dto.ts
T
2026-03-09 11:38:43 +03:30

46 lines
1.2 KiB
TypeScript

import { 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';
import { ReviewStatus } from '../enums/review-status.enum';
export class UpdateReviewDto {
@IsOptional()
@IsNumber()
@Min(1)
@Max(5)
@Type(() => Number)
@ApiPropertyOptional({ description: 'Rating from 1 to 5', minimum: 1, maximum: 5 })
rating?: number;
@IsOptional()
@IsString()
@ApiPropertyOptional({ description: 'Comment text' })
comment?: string;
@IsOptional()
@IsArray()
@IsEnum(PositivePoint, { each: true })
@ApiPropertyOptional({
description: 'Positive points about the food',
enum: PositivePoint,
isArray: true,
})
positivePoints?: PositivePoint[];
@IsOptional()
@IsArray()
@IsEnum(NegativePoint, { each: true })
@ApiPropertyOptional({
description: 'Negative points about the food',
enum: NegativePoint,
isArray: true,
})
negativePoints?: NegativePoint[];
@IsOptional()
@IsEnum(ReviewStatus)
@ApiPropertyOptional({ description: 'Review status (admin only)', enum: ReviewStatus })
status?: ReviewStatus;
}