mirror of
https://github.com/SyncrowIOT/backend.git
synced 2025-07-10 15:17:41 +00:00
reordering controller
This commit is contained in:
@ -43,6 +43,66 @@ import { Permissions } from 'src/decorators/permissions.decorator';
|
||||
})
|
||||
export class DeviceController {
|
||||
constructor(private readonly deviceService: DeviceService) {}
|
||||
|
||||
@ApiBearerAuth()
|
||||
@UseGuards(PermissionsGuard)
|
||||
@Permissions('DEVICE_BATCH_CONTROL')
|
||||
@Post('batch')
|
||||
@ApiOperation({
|
||||
summary: ControllerRoute.DEVICE.ACTIONS.BATCH_CONTROL_DEVICES_SUMMARY,
|
||||
description:
|
||||
ControllerRoute.DEVICE.ACTIONS.BATCH_CONTROL_DEVICES_DESCRIPTION,
|
||||
})
|
||||
async batchControlDevices(
|
||||
@Body() batchControlDevicesDto: BatchControlDevicesDto,
|
||||
@Req() req: any,
|
||||
) {
|
||||
const projectUuid = req.user.project.uuid;
|
||||
return await this.deviceService.batchControlDevices(
|
||||
batchControlDevicesDto,
|
||||
projectUuid,
|
||||
);
|
||||
}
|
||||
@ApiBearerAuth()
|
||||
@UseGuards(PermissionsGuard)
|
||||
@Permissions('DEVICE_BATCH_CONTROL')
|
||||
@Get('batch')
|
||||
@ApiOperation({
|
||||
summary: ControllerRoute.DEVICE.ACTIONS.BATCH_STATUS_DEVICES_SUMMARY,
|
||||
description:
|
||||
ControllerRoute.DEVICE.ACTIONS.BATCH_STATUS_DEVICES_DESCRIPTION,
|
||||
})
|
||||
async batchStatusDevices(
|
||||
@Query() batchStatusDevicesDto: BatchStatusDevicesDto,
|
||||
@Req() req: any,
|
||||
): Promise<BaseResponseDto> {
|
||||
const projectUuid = req.user.project.uuid;
|
||||
return await this.deviceService.batchStatusDevices(
|
||||
batchStatusDevicesDto,
|
||||
projectUuid,
|
||||
);
|
||||
}
|
||||
|
||||
@ApiBearerAuth()
|
||||
@UseGuards(PermissionsGuard)
|
||||
@Permissions('DEVICE_VIEW')
|
||||
@Get('gateway/:gatewayUuid/devices')
|
||||
@ApiOperation({
|
||||
summary: ControllerRoute.DEVICE.ACTIONS.GET_DEVICES_IN_GATEWAY_SUMMARY,
|
||||
description:
|
||||
ControllerRoute.DEVICE.ACTIONS.GET_DEVICES_IN_GATEWAY_DESCRIPTION,
|
||||
})
|
||||
async getDevicesInGateway(
|
||||
@Param('gatewayUuid') gatewayUuid: string,
|
||||
@Req() req: any,
|
||||
): Promise<BaseResponseDto> {
|
||||
const projectUuid = req.user.project.uuid;
|
||||
return await this.deviceService.getDevicesInGateway(
|
||||
gatewayUuid,
|
||||
projectUuid,
|
||||
);
|
||||
}
|
||||
|
||||
@ApiBearerAuth()
|
||||
@UseGuards(PermissionsGuard, CheckDeviceGuard)
|
||||
@Permissions('SPACE_DEVICE_ASSIGN_DEVICE_TO_SPACE')
|
||||
@ -97,6 +157,7 @@ export class DeviceController {
|
||||
projectUuid,
|
||||
);
|
||||
}
|
||||
|
||||
@ApiBearerAuth()
|
||||
@UseGuards(PermissionsGuard)
|
||||
@Permissions('DEVICE_UPDATE')
|
||||
@ -194,25 +255,6 @@ export class DeviceController {
|
||||
projectUuid,
|
||||
);
|
||||
}
|
||||
@ApiBearerAuth()
|
||||
@UseGuards(PermissionsGuard)
|
||||
@Permissions('DEVICE_VIEW')
|
||||
@Get('gateway/:gatewayUuid/devices')
|
||||
@ApiOperation({
|
||||
summary: ControllerRoute.DEVICE.ACTIONS.GET_DEVICES_IN_GATEWAY_SUMMARY,
|
||||
description:
|
||||
ControllerRoute.DEVICE.ACTIONS.GET_DEVICES_IN_GATEWAY_DESCRIPTION,
|
||||
})
|
||||
async getDevicesInGateway(
|
||||
@Param('gatewayUuid') gatewayUuid: string,
|
||||
@Req() req: any,
|
||||
): Promise<BaseResponseDto> {
|
||||
const projectUuid = req.user.project.uuid;
|
||||
return await this.deviceService.getDevicesInGateway(
|
||||
gatewayUuid,
|
||||
projectUuid,
|
||||
);
|
||||
}
|
||||
|
||||
@ApiBearerAuth()
|
||||
@UseGuards(PermissionsGuard)
|
||||
@ -234,44 +276,6 @@ export class DeviceController {
|
||||
projectUuid,
|
||||
);
|
||||
}
|
||||
@ApiBearerAuth()
|
||||
@UseGuards(PermissionsGuard)
|
||||
@Permissions('DEVICE_BATCH_CONTROL')
|
||||
@Post('batch')
|
||||
@ApiOperation({
|
||||
summary: ControllerRoute.DEVICE.ACTIONS.BATCH_CONTROL_DEVICES_SUMMARY,
|
||||
description:
|
||||
ControllerRoute.DEVICE.ACTIONS.BATCH_CONTROL_DEVICES_DESCRIPTION,
|
||||
})
|
||||
async batchControlDevices(
|
||||
@Body() batchControlDevicesDto: BatchControlDevicesDto,
|
||||
@Req() req: any,
|
||||
) {
|
||||
const projectUuid = req.user.project.uuid;
|
||||
return await this.deviceService.batchControlDevices(
|
||||
batchControlDevicesDto,
|
||||
projectUuid,
|
||||
);
|
||||
}
|
||||
@ApiBearerAuth()
|
||||
@UseGuards(PermissionsGuard)
|
||||
@Permissions('DEVICE_BATCH_CONTROL')
|
||||
@Get('batch')
|
||||
@ApiOperation({
|
||||
summary: ControllerRoute.DEVICE.ACTIONS.BATCH_STATUS_DEVICES_SUMMARY,
|
||||
description:
|
||||
ControllerRoute.DEVICE.ACTIONS.BATCH_STATUS_DEVICES_DESCRIPTION,
|
||||
})
|
||||
async batchStatusDevices(
|
||||
@Query() batchStatusDevicesDto: BatchStatusDevicesDto,
|
||||
@Req() req: any,
|
||||
): Promise<BaseResponseDto> {
|
||||
const projectUuid = req.user.project.uuid;
|
||||
return await this.deviceService.batchStatusDevices(
|
||||
batchStatusDevicesDto,
|
||||
projectUuid,
|
||||
);
|
||||
}
|
||||
|
||||
@ApiBearerAuth()
|
||||
@UseGuards(PermissionsGuard, CheckFourAndSixSceneDeviceTypeGuard)
|
||||
|
Reference in New Issue
Block a user