reordering controller

This commit is contained in:
hannathkadher
2025-04-11 11:50:57 +04:00
parent de09624db8
commit f9eee8e266

View File

@ -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)