56 lines
1.5 KiB
TypeScript
56 lines
1.5 KiB
TypeScript
import { IsEnum, IsNumber, IsOptional, IsString } from 'class-validator';
|
|
import { ApiPropertyOptional } from '@nestjs/swagger';
|
|
import { Type } from 'class-transformer';
|
|
import { ReviewStatus } from '../enums/review-status.enum';
|
|
|
|
export class FindReviewsDto {
|
|
@IsOptional()
|
|
@IsNumber()
|
|
@Type(() => Number)
|
|
@ApiPropertyOptional({ description: 'Page number', example: 1 })
|
|
page?: number;
|
|
|
|
@IsOptional()
|
|
@IsNumber()
|
|
@Type(() => Number)
|
|
@ApiPropertyOptional({ description: 'Items per page', example: 10 })
|
|
limit?: number;
|
|
|
|
@IsOptional()
|
|
@IsString()
|
|
@ApiPropertyOptional({ description: 'Food ID to filter comments' })
|
|
foodId?: string;
|
|
|
|
@IsOptional()
|
|
@IsString()
|
|
@ApiPropertyOptional({ description: 'Restaurant ID to filter comments' })
|
|
restId?: string;
|
|
|
|
@IsOptional()
|
|
@IsString()
|
|
@ApiPropertyOptional({ description: 'User ID to filter comments' })
|
|
userId?: string;
|
|
|
|
@IsOptional()
|
|
@IsEnum(ReviewStatus)
|
|
@ApiPropertyOptional({ description: 'Filter by review status', enum: ReviewStatus })
|
|
status?: ReviewStatus;
|
|
|
|
@IsOptional()
|
|
@IsString()
|
|
@ApiPropertyOptional({ description: 'Order by field', example: 'createdAt' })
|
|
orderBy?: string;
|
|
|
|
@IsOptional()
|
|
@IsString()
|
|
@ApiPropertyOptional({ description: 'Order direction', enum: ['asc', 'desc'], example: 'desc' })
|
|
order?: 'asc' | 'desc';
|
|
}
|
|
|
|
export class FindRestuarantReviewsDto extends FindReviewsDto {
|
|
@IsOptional()
|
|
@IsString()
|
|
@ApiPropertyOptional({ description: 'Restaurant slug to filter comments' })
|
|
restuarantSlug?: string;
|
|
}
|