mirror of
https://github.com/SyncrowIOT/backend.git
synced 2025-11-26 08:54:54 +00:00
Merge pull request #54 from SyncrowIOT/fix-issue-door-lock
Fix issue door lock
This commit is contained in:
@ -6,6 +6,7 @@ import {
|
|||||||
ValidateNested,
|
ValidateNested,
|
||||||
IsEnum,
|
IsEnum,
|
||||||
Length,
|
Length,
|
||||||
|
IsOptional,
|
||||||
} from 'class-validator';
|
} from 'class-validator';
|
||||||
import { Type } from 'class-transformer';
|
import { Type } from 'class-transformer';
|
||||||
import { WorkingDays } from '@app/common/constants/working-days';
|
import { WorkingDays } from '@app/common/constants/working-days';
|
||||||
@ -79,6 +80,7 @@ export class AddDoorLockOnlineDto {
|
|||||||
})
|
})
|
||||||
@IsArray()
|
@IsArray()
|
||||||
@ValidateNested({ each: true })
|
@ValidateNested({ each: true })
|
||||||
|
@IsOptional()
|
||||||
@Type(() => ScheduleDto)
|
@Type(() => ScheduleDto)
|
||||||
public scheduleList: ScheduleDto[];
|
public scheduleList: ScheduleDto[];
|
||||||
}
|
}
|
||||||
|
|||||||
@ -168,18 +168,24 @@ export class DoorLockService {
|
|||||||
|
|
||||||
if (passwords.result.length > 0) {
|
if (passwords.result.length > 0) {
|
||||||
const passwordFiltered = passwords.result
|
const passwordFiltered = passwords.result
|
||||||
.filter((item) => item.schedule_list && item.schedule_list.length > 0)
|
.filter((item) => item.type === 1)
|
||||||
.map((password: any) => {
|
.map((password: any) => {
|
||||||
password.schedule_list = password.schedule_list.map((schedule) => {
|
if (password.schedule_list?.length > 0) {
|
||||||
schedule.working_day = this.getDaysFromWorkingDayValue(
|
password.schedule_list = password.schedule_list.map(
|
||||||
schedule.working_day,
|
(schedule) => {
|
||||||
|
schedule.working_day = this.getDaysFromWorkingDayValue(
|
||||||
|
schedule.working_day,
|
||||||
|
);
|
||||||
|
schedule.effective_time = this.minutesToTime(
|
||||||
|
schedule.effective_time,
|
||||||
|
);
|
||||||
|
schedule.invalid_time = this.minutesToTime(
|
||||||
|
schedule.invalid_time,
|
||||||
|
);
|
||||||
|
return schedule;
|
||||||
|
},
|
||||||
);
|
);
|
||||||
schedule.effective_time = this.minutesToTime(
|
}
|
||||||
schedule.effective_time,
|
|
||||||
);
|
|
||||||
schedule.invalid_time = this.minutesToTime(schedule.invalid_time);
|
|
||||||
return schedule;
|
|
||||||
});
|
|
||||||
return password;
|
return password;
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -343,7 +349,7 @@ export class DoorLockService {
|
|||||||
addDeviceObj,
|
addDeviceObj,
|
||||||
passwordData.deviceTuyaUuid,
|
passwordData.deviceTuyaUuid,
|
||||||
type,
|
type,
|
||||||
isOnline,
|
addDeviceObj.scheduleList ? isOnline : false,
|
||||||
);
|
);
|
||||||
|
|
||||||
if (!createPass.success) {
|
if (!createPass.success) {
|
||||||
|
|||||||
Reference in New Issue
Block a user