add curtain module device (#440)

This commit is contained in:
ZaydSkaff
2025-06-29 10:10:19 +03:00
committed by GitHub
parent 5381a949bc
commit 90ab291d83
2 changed files with 15 additions and 9 deletions

View File

@ -15,6 +15,7 @@ export enum ProductType {
WL = 'WL', WL = 'WL',
GD = 'GD', GD = 'GD',
CUR = 'CUR', CUR = 'CUR',
CUR_2 = 'CUR_2',
PC = 'PC', PC = 'PC',
FOUR_S = '4S', FOUR_S = '4S',
SIX_S = '6S', SIX_S = '6S',

View File

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