import { BooleanValues } from '@app/common/constants/boolean-values.enum'; import { ApiProperty } from '@nestjs/swagger'; import { Transform } from 'class-transformer'; import { IsBoolean, IsInt, IsNotEmpty, IsOptional, IsString, Min, } from 'class-validator'; export class GetCommunityDto { @ApiProperty({ description: 'communityUuid', required: true, }) @IsString() @IsNotEmpty() public communityUuid: string; } export class GetCommunityChildDto { @ApiProperty({ example: 1, description: 'Page number', required: true }) @IsInt({ message: 'Page must be a number' }) @Min(1, { message: 'Page must not be less than 1' }) @IsNotEmpty() public page: number; @ApiProperty({ example: 10, description: 'Number of items per page', required: true, }) @IsInt({ message: 'Page size must be a number' }) @Min(1, { message: 'Page size must not be less than 1' }) @IsNotEmpty() public pageSize: number; @ApiProperty({ example: true, description: 'Flag to determine whether to fetch full hierarchy', required: false, default: false, }) @IsOptional() @IsBoolean() @Transform((value) => { return value.obj.includeSubSpaces === BooleanValues.TRUE; }) public includeSubSpaces: boolean = false; }