mirror of
https://github.com/SyncrowIOT/backend.git
synced 2025-11-26 09:44:55 +00:00
reordering controller
This commit is contained in:
@ -43,6 +43,66 @@ import { Permissions } from 'src/decorators/permissions.decorator';
|
|||||||
})
|
})
|
||||||
export class DeviceController {
|
export class DeviceController {
|
||||||
constructor(private readonly deviceService: DeviceService) {}
|
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()
|
@ApiBearerAuth()
|
||||||
@UseGuards(PermissionsGuard, CheckDeviceGuard)
|
@UseGuards(PermissionsGuard, CheckDeviceGuard)
|
||||||
@Permissions('SPACE_DEVICE_ASSIGN_DEVICE_TO_SPACE')
|
@Permissions('SPACE_DEVICE_ASSIGN_DEVICE_TO_SPACE')
|
||||||
@ -97,6 +157,7 @@ export class DeviceController {
|
|||||||
projectUuid,
|
projectUuid,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ApiBearerAuth()
|
@ApiBearerAuth()
|
||||||
@UseGuards(PermissionsGuard)
|
@UseGuards(PermissionsGuard)
|
||||||
@Permissions('DEVICE_UPDATE')
|
@Permissions('DEVICE_UPDATE')
|
||||||
@ -194,25 +255,6 @@ export class DeviceController {
|
|||||||
projectUuid,
|
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()
|
@ApiBearerAuth()
|
||||||
@UseGuards(PermissionsGuard)
|
@UseGuards(PermissionsGuard)
|
||||||
@ -234,44 +276,6 @@ export class DeviceController {
|
|||||||
projectUuid,
|
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()
|
@ApiBearerAuth()
|
||||||
@UseGuards(PermissionsGuard, CheckFourAndSixSceneDeviceTypeGuard)
|
@UseGuards(PermissionsGuard, CheckFourAndSixSceneDeviceTypeGuard)
|
||||||
|
|||||||
Reference in New Issue
Block a user