mirror of
https://github.com/SyncrowIOT/backend.git
synced 2025-07-16 02:36:19 +00:00
53 lines
1.6 KiB
TypeScript
53 lines
1.6 KiB
TypeScript
import { DeviceService } from '../services/device.service';
|
|
import { Controller, Get, Query, UseGuards } from '@nestjs/common';
|
|
import {
|
|
ApiTags,
|
|
ApiBearerAuth,
|
|
ApiOperation,
|
|
ApiQuery,
|
|
} from '@nestjs/swagger';
|
|
import { EnableDisableStatusEnum } from '@app/common/constants/days.enum';
|
|
import { ControllerRoute } from '@app/common/constants/controller-route';
|
|
import { PermissionsGuard } from 'src/guards/permissions.guard';
|
|
import { Permissions } from 'src/decorators/permissions.decorator';
|
|
import { GetDevicesBySpaceOrCommunityDto } from '../dtos';
|
|
|
|
@ApiTags('Device Module')
|
|
@Controller({
|
|
version: EnableDisableStatusEnum.ENABLED,
|
|
path: ControllerRoute.DEVICE_SPACE_COMMUNITY.ROUTE,
|
|
})
|
|
export class DeviceSpaceOrCommunityController {
|
|
constructor(private readonly deviceService: DeviceService) {}
|
|
|
|
@ApiBearerAuth()
|
|
@UseGuards(PermissionsGuard)
|
|
@Permissions('DEVICE_VIEW')
|
|
@Get('recursive-child')
|
|
@ApiOperation({
|
|
summary:
|
|
ControllerRoute.DEVICE_SPACE_COMMUNITY.ACTIONS
|
|
.GET_ALL_DEVICES_BY_SPACE_OR_COMMUNITY_WITH_RECURSIVE_CHILD_SUMMARY,
|
|
description:
|
|
ControllerRoute.DEVICE_SPACE_COMMUNITY.ACTIONS
|
|
.GET_ALL_DEVICES_BY_SPACE_OR_COMMUNITY_WITH_RECURSIVE_CHILD_DESCRIPTION,
|
|
})
|
|
@ApiQuery({
|
|
name: 'spaceUuid',
|
|
description: 'UUID of the Space',
|
|
required: false,
|
|
})
|
|
@ApiQuery({
|
|
name: 'communityUuid',
|
|
description: 'UUID of the Community',
|
|
required: false,
|
|
})
|
|
async getAllDevicesBySpaceOrCommunityWithChild(
|
|
@Query() query: GetDevicesBySpaceOrCommunityDto,
|
|
) {
|
|
return await this.deviceService.getAllDevicesBySpaceOrCommunityWithChild(
|
|
query,
|
|
);
|
|
}
|
|
}
|