30 lines
1.3 KiB
TypeScript
Executable File
30 lines
1.3 KiB
TypeScript
Executable File
import { ApiProperty } from "@nestjs/swagger";
|
|
import { IsIn, IsInt, IsNotEmpty, IsString, Length } from "class-validator";
|
|
|
|
import { ServiceMessage } from "../../../common/enums/message.enum";
|
|
|
|
export class AddReviewDto {
|
|
@IsNotEmpty({ message: ServiceMessage.COMMENT_REQUIRED })
|
|
@IsString({ message: ServiceMessage.COMMENT_STRING })
|
|
@Length(1, 400, { message: ServiceMessage.COMMENT_LENGTH })
|
|
@ApiProperty({ description: "comment of review", example: "This is a comment" })
|
|
comment: string;
|
|
|
|
@IsNotEmpty({ message: ServiceMessage.RATING_REQUIRED })
|
|
@IsInt({ message: ServiceMessage.RATING_INT })
|
|
@IsIn([1, 2, 3, 4, 5], { message: ServiceMessage.RATING_RANGE })
|
|
@ApiProperty({ description: "rating of review", example: 5 })
|
|
rating: number;
|
|
|
|
@IsNotEmpty({ message: ServiceMessage.TITLE_REQUIRED })
|
|
@IsString({ message: ServiceMessage.TITLE_STRING })
|
|
@Length(1, 100, { message: ServiceMessage.TITLE_LENGTH })
|
|
@ApiProperty({ description: "title of review", example: "This is a title" })
|
|
title: string;
|
|
|
|
// @IsNotEmpty({ message: ServiceMessage.SERVICE_ID_REQUIRED })
|
|
// @IsUUID("4", { message: ServiceMessage.SERVICE_ID_SHOULD_BE_A_UUID })
|
|
// @ApiProperty({ description: "Service ID", example: "d290f1ee-6c54-4b01-90e6-d701748f0851" })
|
|
// serviceId: string;
|
|
}
|