mirror of
https://github.com/SyncrowIOT/backend.git
synced 2025-11-26 11:04:55 +00:00
Add door lock DTOs for adding offline and online temporary passwords
This commit is contained in:
36
src/door-lock/dtos/add.offline-temp.dto.ts
Normal file
36
src/door-lock/dtos/add.offline-temp.dto.ts
Normal 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;
|
||||||
|
}
|
||||||
84
src/door-lock/dtos/add.online-temp.dto.ts
Normal file
84
src/door-lock/dtos/add.online-temp.dto.ts
Normal 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[];
|
||||||
|
}
|
||||||
1
src/door-lock/dtos/index.ts
Normal file
1
src/door-lock/dtos/index.ts
Normal file
@ -0,0 +1 @@
|
|||||||
|
export * from './add.online-temp.dto';
|
||||||
Reference in New Issue
Block a user