chore: add service review add and get in service page and also approve and reject for admin

This commit is contained in:
mahyargdz
2025-02-17 15:08:22 +03:30
parent 763b6b49d9
commit b7cfaf95b2
12 changed files with 186 additions and 47 deletions
@@ -0,0 +1,29 @@
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;
}
@@ -12,10 +12,16 @@ export class CreateServiceDto {
@IsNotEmpty({ message: ServiceMessage.NAME_REQUIRED })
@IsString({ message: ServiceMessage.NAME_STRING })
@Length(3, 50, { message: ServiceMessage.NAME_LENGTH })
@Length(3, 150, { message: ServiceMessage.NAME_LENGTH })
@ApiProperty({ description: "The name of the service", example: "Service Name" })
name: string;
@IsNotEmpty({ message: ServiceMessage.TITLE_REQUIRED })
@IsString({ message: ServiceMessage.TITLE_STRING })
@Length(3, 150, { message: ServiceMessage.TITLE_LENGTH })
@ApiProperty({ description: "The TITLE of the service", example: "Service TITLE" })
title: string;
@IsNotEmpty({ message: ServiceMessage.DESCRIPTION_REQUIRED })
@IsString({ message: ServiceMessage.DESCRIPTION_STRING })
@Length(10, 500, { message: ServiceMessage.DESCRIPTION_LENGTH })