finished 4scene configration endpoints

This commit is contained in:
faris Aljohari
2024-11-16 23:05:06 -06:00
parent 4bb598d8b0
commit eb916b79b4
25 changed files with 429 additions and 15 deletions

View File

@ -12,13 +12,18 @@ import {
Put,
} from '@nestjs/common';
import { ApiTags, ApiBearerAuth } from '@nestjs/swagger';
import { AddDeviceDto, UpdateDeviceInSpaceDto } from '../dtos/add.device.dto';
import {
AddDeviceDto,
AddSceneToFourSceneDeviceDto,
UpdateDeviceInSpaceDto,
} from '../dtos/add.device.dto';
import { GetDeviceLogsDto } from '../dtos/get.device.dto';
import {
ControlDeviceDto,
BatchControlDevicesDto,
BatchStatusDevicesDto,
BatchFactoryResetDevicesDto,
GetSceneFourSceneDeviceDto,
} from '../dtos/control.device.dto';
import { CheckRoomGuard } from 'src/guards/room.guard';
import { JwtAuthGuard } from '@app/common/guards/jwt.auth.guard';
@ -184,4 +189,35 @@ export class DeviceController {
powerClampUuid,
);
}
@ApiBearerAuth()
@UseGuards(JwtAuthGuard)
@Post('four-scene/:deviceUuid')
async addSceneToFourSceneDevice(
@Param('deviceUuid') deviceUuid: string,
@Body() addSceneToFourSceneDeviceDto: AddSceneToFourSceneDeviceDto,
) {
const device = await this.deviceService.addSceneToFourSceneDevice(
deviceUuid,
addSceneToFourSceneDeviceDto,
);
return {
statusCode: HttpStatus.CREATED,
success: true,
message: `scene added successfully to device ${deviceUuid}`,
data: device,
};
}
@ApiBearerAuth()
@UseGuards(JwtAuthGuard)
@Get('four-scene/:deviceUuid')
async getSceneFourSceneDevice(
@Param('deviceUuid') deviceUuid: string,
@Query() getSceneFourSceneDeviceDto: GetSceneFourSceneDeviceDto,
) {
return await this.deviceService.getSceneFourSceneDevice(
deviceUuid,
getSceneFourSceneDeviceDto,
);
}
}