mirror of
https://github.com/SyncrowIOT/backend.git
synced 2025-07-16 02:36:19 +00:00
edit category from param to query
This commit is contained in:
@ -10,9 +10,14 @@ import {
|
||||
UseGuards,
|
||||
Put,
|
||||
Delete,
|
||||
Query,
|
||||
} from '@nestjs/common';
|
||||
import { ApiTags, ApiBearerAuth } from '@nestjs/swagger';
|
||||
import { AddScheduleDto, EnableScheduleDto } from '../dtos/add.schedule.dto';
|
||||
import {
|
||||
AddScheduleDto,
|
||||
EnableScheduleDto,
|
||||
GetScheduleDeviceDto,
|
||||
} from '../dtos/schedule.dto';
|
||||
|
||||
import { JwtAuthGuard } from '@app/common/guards/jwt.auth.guard';
|
||||
|
||||
@ -51,15 +56,15 @@ export class ScheduleController {
|
||||
}
|
||||
@ApiBearerAuth()
|
||||
@UseGuards(JwtAuthGuard)
|
||||
@Get(':deviceUuid/category/:category')
|
||||
@Get(':deviceUuid')
|
||||
async getDeviceScheduleByCategory(
|
||||
@Param('deviceUuid') deviceUuid: string,
|
||||
@Param('category') category: string,
|
||||
@Query() query: GetScheduleDeviceDto,
|
||||
) {
|
||||
try {
|
||||
return await this.scheduleService.getDeviceScheduleByCategory(
|
||||
deviceUuid,
|
||||
category,
|
||||
query.category,
|
||||
);
|
||||
} catch (error) {
|
||||
throw new HttpException(
|
||||
|
@ -1 +1 @@
|
||||
export * from './add.schedule.dto';
|
||||
export * from './schedule.dto';
|
||||
|
@ -82,3 +82,12 @@ export class EnableScheduleDto {
|
||||
@IsNotEmpty()
|
||||
public enable: boolean;
|
||||
}
|
||||
export class GetScheduleDeviceDto {
|
||||
@ApiProperty({
|
||||
description: 'category',
|
||||
required: true,
|
||||
})
|
||||
@IsString()
|
||||
@IsNotEmpty()
|
||||
public category: string;
|
||||
}
|
@ -1,7 +1,7 @@
|
||||
import { Injectable, HttpException, HttpStatus } from '@nestjs/common';
|
||||
import { TuyaContext } from '@tuya/tuya-connector-nodejs';
|
||||
import { ConfigService } from '@nestjs/config';
|
||||
import { AddScheduleDto, EnableScheduleDto } from '../dtos/add.schedule.dto';
|
||||
import { AddScheduleDto, EnableScheduleDto } from '../dtos/schedule.dto';
|
||||
import {
|
||||
addScheduleDeviceInterface,
|
||||
getDeviceScheduleInterface,
|
||||
|
Reference in New Issue
Block a user