mirror of
https://github.com/SyncrowIOT/backend.git
synced 2025-11-26 10:54:55 +00:00
removed guards
This commit is contained in:
@ -569,13 +569,12 @@ export class DeviceService {
|
||||
async getDeviceInstructionByDeviceId(
|
||||
deviceUuid: string,
|
||||
): Promise<DeviceInstructionResponse> {
|
||||
const deviceDetails = await this.getDeviceByDeviceUuid(deviceUuid);
|
||||
|
||||
if (!deviceDetails) {
|
||||
throw new NotFoundException('Device Not Found');
|
||||
}
|
||||
try {
|
||||
const deviceDetails = await this.getDeviceByDeviceUuid(deviceUuid);
|
||||
|
||||
if (!deviceDetails) {
|
||||
throw new NotFoundException('Device Not Found');
|
||||
}
|
||||
|
||||
const response = await this.getDeviceInstructionByDeviceIdTuya(
|
||||
deviceDetails.deviceTuyaUuid,
|
||||
);
|
||||
@ -614,12 +613,12 @@ export class DeviceService {
|
||||
}
|
||||
}
|
||||
async getDevicesInstructionStatus(deviceUuid: string) {
|
||||
try {
|
||||
const deviceDetails = await this.getDeviceByDeviceUuid(deviceUuid);
|
||||
const deviceDetails = await this.getDeviceByDeviceUuid(deviceUuid);
|
||||
|
||||
if (!deviceDetails) {
|
||||
throw new NotFoundException('Device Not Found');
|
||||
}
|
||||
if (!deviceDetails) {
|
||||
throw new NotFoundException('Device Not Found');
|
||||
}
|
||||
try {
|
||||
const deviceStatus = await this.getDevicesInstructionStatusTuya(
|
||||
deviceDetails.deviceTuyaUuid,
|
||||
);
|
||||
@ -630,6 +629,7 @@ export class DeviceService {
|
||||
status: deviceStatus.result[0].status,
|
||||
};
|
||||
} catch (error) {
|
||||
console.log(error);
|
||||
throw new HttpException(
|
||||
'Error fetching device functions status',
|
||||
HttpStatus.INTERNAL_SERVER_ERROR,
|
||||
@ -887,7 +887,6 @@ export class DeviceService {
|
||||
const spaceHierarchy = await this.getFullSpaceHierarchy(
|
||||
device?.spaceDevice,
|
||||
);
|
||||
console.log(device.spaceDevice.community);
|
||||
const orderedHierarchy = spaceHierarchy.reverse();
|
||||
|
||||
return {
|
||||
@ -986,7 +985,6 @@ export class DeviceService {
|
||||
space: SpaceEntity,
|
||||
): Promise<{ uuid: string; spaceName: string }[]> {
|
||||
try {
|
||||
console.log('Fetching hierarchy for space:', space.uuid);
|
||||
|
||||
// Fetch only the relevant spaces, starting with the target space
|
||||
const targetSpace = await this.spaceRepository.findOne({
|
||||
|
||||
Reference in New Issue
Block a user