40 lines
839 B
TypeScript
40 lines
839 B
TypeScript
import { ApiProperty } from '@nestjs/swagger';
|
|||
|
|
import { Type } from 'class-transformer';
|
||
|
|
import {
|
||
|
|
ArrayMaxSize,
|
||
|
|
IsArray,
|
||
|
|
IsInt,
|
||
|
|
IsString,
|
||
|
|
Matches,
|
||
|
|
Max,
|
||
|
|
Min,
|
||
|
|
ValidateNested,
|
||
|
|
} from 'class-validator';
|
||
|
|
|
||
|
|
export class AvailabilitySlotDto {
|
||
|
|
@ApiProperty({ description: '0=شنبه … 6=جمعه', minimum: 0, maximum: 6 })
|
||
|
|
@IsInt()
|
||
|
|
@Min(0)
|
||
|
|
@Max(6)
|
||
|
|
dayOfWeek!: number;
|
||
|
|
|
||
|
|
@ApiProperty({ example: '09:00' })
|
||
|
|
@IsString()
|
||
|
|
@Matches(/^([01]\d|2[0-3]):[0-5]\d]$/)
|
||
|
|
startTime!: string;
|
||
|
|
|
||
|
|
@ApiProperty({ example: '17:00' })
|
||
|
|
@IsString()
|
||
|
|
@Matches(/^([01]\d|2[0-3]):[0-5]\d]$/)
|
||
|
|
endTime!: string;
|
||
|
|
}
|
||
|
|
|
||
|
|
export class SetAvailabilityDto {
|
||
|
|
@ApiProperty({ type: [AvailabilitySlotDto] })
|
||
|
|
@IsArray()
|
||
|
|
@ArrayMaxSize(70)
|
||
|
|
@ValidateNested({ each: true })
|
||
|
|
@Type(() => AvailabilitySlotDto)
|
||
|
|
slots!: AvailabilitySlotDto[];
|
||
|
|
}
|