Add door lock DTOs for adding offline and online temporary passwords

This commit is contained in:
faris Aljohari
2024-06-28 20:47:20 +03:00
parent 09074f83e2
commit 062eb7660b
3 changed files with 121 additions and 0 deletions

View File

@ -0,0 +1,36 @@
import { ApiProperty } from '@nestjs/swagger';
import { IsNotEmpty, IsString, Length } from 'class-validator';
export class AddDoorLockOfflineTempDto {
@ApiProperty({
description: 'name',
required: true,
})
@IsString()
@IsNotEmpty()
public name: string;
@ApiProperty({
description: 'password',
required: true,
})
@IsString()
@IsNotEmpty()
@Length(7, 7)
public password: string;
@ApiProperty({
description: 'effectiveTime',
required: true,
})
@IsString()
@IsNotEmpty()
public effectiveTime: string;
@ApiProperty({
description: 'invalidTime',
required: true,
})
@IsString()
@IsNotEmpty()
public invalidTime: string;
}

View File

@ -0,0 +1,84 @@
import { ApiProperty } from '@nestjs/swagger';
import {
IsNotEmpty,
IsString,
IsArray,
ValidateNested,
IsEnum,
Length,
} from 'class-validator';
import { Type } from 'class-transformer';
import { WorkingDays } from '@app/common/constants/working-days';
class ScheduleDto {
@ApiProperty({
description: 'effectiveTime',
required: true,
})
@IsString()
@IsNotEmpty()
public effectiveTime: string;
@ApiProperty({
description: 'invalidTime',
required: true,
})
@IsString()
@IsNotEmpty()
public invalidTime: string;
@ApiProperty({
description: 'workingDay',
enum: WorkingDays,
isArray: true,
required: true,
})
@IsArray()
@IsEnum(WorkingDays, { each: true })
@IsNotEmpty()
public workingDay: WorkingDays[];
}
export class AddDoorLockOnlineDto {
@ApiProperty({
description: 'name',
required: true,
})
@IsString()
@IsNotEmpty()
public name: string;
@ApiProperty({
description: 'password',
required: true,
})
@IsString()
@IsNotEmpty()
@Length(7, 7)
public password: string;
@ApiProperty({
description: 'effectiveTime',
required: true,
})
@IsString()
@IsNotEmpty()
public effectiveTime: string;
@ApiProperty({
description: 'invalidTime',
required: true,
})
@IsString()
@IsNotEmpty()
public invalidTime: string;
@ApiProperty({
description: 'scheduleList',
type: [ScheduleDto],
required: false,
})
@IsArray()
@ValidateNested({ each: true })
@Type(() => ScheduleDto)
public scheduleList: ScheduleDto[];
}

View File

@ -0,0 +1 @@
export * from './add.online-temp.dto';