mirror of
https://github.com/SyncrowIOT/backend.git
synced 2026-10-26 01:27:54 +00:00
Refactor GroupController to use static route constants and add API operation descriptions
This commit is contained in:
@@ -1,13 +1,14 @@
|
||||
import { GroupService } from '../services/group.service';
|
||||
import { Controller, Get, UseGuards, Param, Req } from '@nestjs/common';
|
||||
import { ApiTags, ApiBearerAuth } from '@nestjs/swagger';
|
||||
import { ApiTags, ApiBearerAuth, ApiOperation } from '@nestjs/swagger';
|
||||
import { JwtAuthGuard } from '@app/common/guards/jwt.auth.guard';
|
||||
import { EnableDisableStatusEnum } from '@app/common/constants/days.enum';
|
||||
import { ControllerRoute } from '@app/common/constants/controller-route'; // Assuming this is where the routes are defined
|
||||
|
||||
@ApiTags('Group Module')
|
||||
@Controller({
|
||||
version: EnableDisableStatusEnum.ENABLED,
|
||||
path: 'group',
|
||||
path: ControllerRoute.GROUP.ROUTE, // use the static route constant
|
||||
})
|
||||
export class GroupController {
|
||||
constructor(private readonly groupService: GroupService) {}
|
||||
@@ -15,6 +16,11 @@ export class GroupController {
|
||||
@ApiBearerAuth()
|
||||
@UseGuards(JwtAuthGuard)
|
||||
@Get(':spaceUuid')
|
||||
@ApiOperation({
|
||||
summary: ControllerRoute.GROUP.ACTIONS.GET_GROUPS_BY_SPACE_UUID_SUMMARY,
|
||||
description:
|
||||
ControllerRoute.GROUP.ACTIONS.GET_GROUPS_BY_SPACE_UUID_DESCRIPTION,
|
||||
})
|
||||
async getGroupsBySpaceUuid(@Param('spaceUuid') spaceUuid: string) {
|
||||
return await this.groupService.getGroupsBySpaceUuid(spaceUuid);
|
||||
}
|
||||
@@ -22,6 +28,12 @@ export class GroupController {
|
||||
@ApiBearerAuth()
|
||||
@UseGuards(JwtAuthGuard)
|
||||
@Get(':spaceUuid/devices/:groupName')
|
||||
@ApiOperation({
|
||||
summary:
|
||||
ControllerRoute.GROUP.ACTIONS.GET_UNIT_DEVICES_BY_GROUP_NAME_SUMMARY,
|
||||
description:
|
||||
ControllerRoute.GROUP.ACTIONS.GET_UNIT_DEVICES_BY_GROUP_NAME_DESCRIPTION,
|
||||
})
|
||||
async getUnitDevicesByGroupName(
|
||||
@Param('spaceUuid') spaceUuid: string,
|
||||
@Param('groupName') groupName: string,
|
||||
|
||||
Reference in New Issue
Block a user