|
|
|
@ -1,6 +1,6 @@
|
|
|
|
|
import { HttpException, HttpStatus, Injectable } from '@nestjs/common';
|
|
|
|
|
import { ConfigService } from '@nestjs/config';
|
|
|
|
|
import { Injectable, HttpException, HttpStatus } from '@nestjs/common';
|
|
|
|
|
import { TuyaContext } from '@tuya/tuya-connector-nodejs';
|
|
|
|
|
import { ConfigService } from '@nestjs/config';
|
|
|
|
|
import {
|
|
|
|
|
AddScheduleDto,
|
|
|
|
|
EnableScheduleDto,
|
|
|
|
@ -11,14 +11,14 @@ import {
|
|
|
|
|
getDeviceScheduleInterface,
|
|
|
|
|
} from '../interfaces/get.schedule.interface';
|
|
|
|
|
|
|
|
|
|
import { ProductType } from '@app/common/constants/product-type.enum';
|
|
|
|
|
import { convertKeysToCamelCase } from '@app/common/helper/camelCaseConverter';
|
|
|
|
|
import { DeviceRepository } from '@app/common/modules/device/repositories';
|
|
|
|
|
import { ProductType } from '@app/common/constants/product-type.enum';
|
|
|
|
|
import { convertTimestampToDubaiTime } from '@app/common/helper/convertTimestampToDubaiTime';
|
|
|
|
|
import {
|
|
|
|
|
getEnabledDays,
|
|
|
|
|
getScheduleStatus,
|
|
|
|
|
} from '@app/common/helper/getScheduleStatus';
|
|
|
|
|
import { DeviceRepository } from '@app/common/modules/device/repositories';
|
|
|
|
|
|
|
|
|
|
@Injectable()
|
|
|
|
|
export class ScheduleService {
|
|
|
|
@ -57,8 +57,7 @@ export class ScheduleService {
|
|
|
|
|
deviceDetails.productDevice.prodType !== ProductType.ONE_1TG &&
|
|
|
|
|
deviceDetails.productDevice.prodType !== ProductType.TWO_2TG &&
|
|
|
|
|
deviceDetails.productDevice.prodType !== ProductType.THREE_3TG &&
|
|
|
|
|
deviceDetails.productDevice.prodType !== ProductType.GD &&
|
|
|
|
|
deviceDetails.productDevice.prodType !== ProductType.CUR_2
|
|
|
|
|
deviceDetails.productDevice.prodType !== ProductType.GD
|
|
|
|
|
) {
|
|
|
|
|
throw new HttpException(
|
|
|
|
|
'This device is not supported for schedule',
|
|
|
|
@ -116,8 +115,7 @@ export class ScheduleService {
|
|
|
|
|
deviceDetails.productDevice.prodType !== ProductType.ONE_1TG &&
|
|
|
|
|
deviceDetails.productDevice.prodType !== ProductType.TWO_2TG &&
|
|
|
|
|
deviceDetails.productDevice.prodType !== ProductType.THREE_3TG &&
|
|
|
|
|
deviceDetails.productDevice.prodType !== ProductType.GD &&
|
|
|
|
|
deviceDetails.productDevice.prodType !== ProductType.CUR_2
|
|
|
|
|
deviceDetails.productDevice.prodType !== ProductType.GD
|
|
|
|
|
) {
|
|
|
|
|
throw new HttpException(
|
|
|
|
|
'This device is not supported for schedule',
|
|
|
|
@ -171,8 +169,7 @@ export class ScheduleService {
|
|
|
|
|
deviceDetails.productDevice.prodType !== ProductType.ONE_1TG &&
|
|
|
|
|
deviceDetails.productDevice.prodType !== ProductType.TWO_2TG &&
|
|
|
|
|
deviceDetails.productDevice.prodType !== ProductType.THREE_3TG &&
|
|
|
|
|
deviceDetails.productDevice.prodType !== ProductType.GD &&
|
|
|
|
|
deviceDetails.productDevice.prodType !== ProductType.CUR_2
|
|
|
|
|
deviceDetails.productDevice.prodType !== ProductType.GD
|
|
|
|
|
) {
|
|
|
|
|
throw new HttpException(
|
|
|
|
|
'This device is not supported for schedule',
|
|
|
|
@ -240,8 +237,7 @@ export class ScheduleService {
|
|
|
|
|
deviceDetails.productDevice.prodType !== ProductType.ONE_1TG &&
|
|
|
|
|
deviceDetails.productDevice.prodType !== ProductType.TWO_2TG &&
|
|
|
|
|
deviceDetails.productDevice.prodType !== ProductType.THREE_3TG &&
|
|
|
|
|
deviceDetails.productDevice.prodType !== ProductType.GD &&
|
|
|
|
|
deviceDetails.productDevice.prodType !== ProductType.CUR_2
|
|
|
|
|
deviceDetails.productDevice.prodType !== ProductType.GD
|
|
|
|
|
) {
|
|
|
|
|
throw new HttpException(
|
|
|
|
|
'This device is not supported for schedule',
|
|
|
|
@ -327,8 +323,7 @@ export class ScheduleService {
|
|
|
|
|
deviceDetails.productDevice.prodType !== ProductType.ONE_1TG &&
|
|
|
|
|
deviceDetails.productDevice.prodType !== ProductType.TWO_2TG &&
|
|
|
|
|
deviceDetails.productDevice.prodType !== ProductType.THREE_3TG &&
|
|
|
|
|
deviceDetails.productDevice.prodType !== ProductType.GD &&
|
|
|
|
|
deviceDetails.productDevice.prodType !== ProductType.CUR_2
|
|
|
|
|
deviceDetails.productDevice.prodType !== ProductType.GD
|
|
|
|
|
) {
|
|
|
|
|
throw new HttpException(
|
|
|
|
|
'This device is not supported for schedule',
|
|
|
|
|