mirror of
https://github.com/SyncrowIOT/backend.git
synced 2025-07-15 10:25:23 +00:00
Add ApiOperation
decorators to AutomationController endpoints
This commit is contained in:
@ -10,7 +10,7 @@ import {
|
|||||||
Put,
|
Put,
|
||||||
UseGuards,
|
UseGuards,
|
||||||
} from '@nestjs/common';
|
} from '@nestjs/common';
|
||||||
import { ApiTags, ApiBearerAuth } from '@nestjs/swagger';
|
import { ApiTags, ApiBearerAuth, ApiOperation } from '@nestjs/swagger';
|
||||||
import {
|
import {
|
||||||
AddAutomationDto,
|
AddAutomationDto,
|
||||||
UpdateAutomationDto,
|
UpdateAutomationDto,
|
||||||
@ -19,11 +19,12 @@ import {
|
|||||||
import { JwtAuthGuard } from '@app/common/guards/jwt.auth.guard';
|
import { JwtAuthGuard } from '@app/common/guards/jwt.auth.guard';
|
||||||
import { EnableDisableStatusEnum } from '@app/common/constants/days.enum';
|
import { EnableDisableStatusEnum } from '@app/common/constants/days.enum';
|
||||||
import { AutomationParamDto, SpaceParamDto } from '../dtos';
|
import { AutomationParamDto, SpaceParamDto } from '../dtos';
|
||||||
|
import { ControllerRoute } from '@app/common/constants/controller-route';
|
||||||
|
|
||||||
@ApiTags('Automation Module')
|
@ApiTags('Automation Module')
|
||||||
@Controller({
|
@Controller({
|
||||||
version: EnableDisableStatusEnum.ENABLED,
|
version: EnableDisableStatusEnum.ENABLED,
|
||||||
path: 'automation',
|
path: ControllerRoute.AUTOMATION.ROUTE,
|
||||||
})
|
})
|
||||||
export class AutomationController {
|
export class AutomationController {
|
||||||
constructor(private readonly automationService: AutomationService) {}
|
constructor(private readonly automationService: AutomationService) {}
|
||||||
@ -31,6 +32,10 @@ export class AutomationController {
|
|||||||
@ApiBearerAuth()
|
@ApiBearerAuth()
|
||||||
@UseGuards(JwtAuthGuard)
|
@UseGuards(JwtAuthGuard)
|
||||||
@Post()
|
@Post()
|
||||||
|
@ApiOperation({
|
||||||
|
summary: ControllerRoute.AUTOMATION.ACTIONS.ADD_AUTOMATION_SUMMARY,
|
||||||
|
description: ControllerRoute.AUTOMATION.ACTIONS.ADD_AUTOMATION_DESCRIPTION,
|
||||||
|
})
|
||||||
async addAutomation(@Body() addAutomationDto: AddAutomationDto) {
|
async addAutomation(@Body() addAutomationDto: AddAutomationDto) {
|
||||||
const automation =
|
const automation =
|
||||||
await this.automationService.addAutomation(addAutomationDto);
|
await this.automationService.addAutomation(addAutomationDto);
|
||||||
@ -45,6 +50,11 @@ export class AutomationController {
|
|||||||
@ApiBearerAuth()
|
@ApiBearerAuth()
|
||||||
@UseGuards(JwtAuthGuard)
|
@UseGuards(JwtAuthGuard)
|
||||||
@Get(':spaceUuid')
|
@Get(':spaceUuid')
|
||||||
|
@ApiOperation({
|
||||||
|
summary: ControllerRoute.AUTOMATION.ACTIONS.GET_AUTOMATION_BY_SPACE_SUMMARY,
|
||||||
|
description:
|
||||||
|
ControllerRoute.AUTOMATION.ACTIONS.GET_AUTOMATION_BY_SPACE_DESCRIPTION,
|
||||||
|
})
|
||||||
async getAutomationBySpace(@Param() param: SpaceParamDto) {
|
async getAutomationBySpace(@Param() param: SpaceParamDto) {
|
||||||
const automation = await this.automationService.getAutomationBySpace(
|
const automation = await this.automationService.getAutomationBySpace(
|
||||||
param.spaceUuid,
|
param.spaceUuid,
|
||||||
@ -55,6 +65,11 @@ export class AutomationController {
|
|||||||
@ApiBearerAuth()
|
@ApiBearerAuth()
|
||||||
@UseGuards(JwtAuthGuard)
|
@UseGuards(JwtAuthGuard)
|
||||||
@Get('details/:automationUuid')
|
@Get('details/:automationUuid')
|
||||||
|
@ApiOperation({
|
||||||
|
summary: ControllerRoute.AUTOMATION.ACTIONS.GET_AUTOMATION_DETAILS_SUMMARY,
|
||||||
|
description:
|
||||||
|
ControllerRoute.AUTOMATION.ACTIONS.GET_AUTOMATION_DETAILS_DESCRIPTION,
|
||||||
|
})
|
||||||
async getAutomationDetails(@Param() param: AutomationParamDto) {
|
async getAutomationDetails(@Param() param: AutomationParamDto) {
|
||||||
const automation = await this.automationService.getAutomationDetails(
|
const automation = await this.automationService.getAutomationDetails(
|
||||||
param.automationUuid,
|
param.automationUuid,
|
||||||
@ -65,6 +80,11 @@ export class AutomationController {
|
|||||||
@ApiBearerAuth()
|
@ApiBearerAuth()
|
||||||
@UseGuards(JwtAuthGuard)
|
@UseGuards(JwtAuthGuard)
|
||||||
@Delete(':automationUuid')
|
@Delete(':automationUuid')
|
||||||
|
@ApiOperation({
|
||||||
|
summary: ControllerRoute.AUTOMATION.ACTIONS.DELETE_AUTOMATION_SUMMARY,
|
||||||
|
description:
|
||||||
|
ControllerRoute.AUTOMATION.ACTIONS.DELETE_AUTOMATION_DESCRIPTION,
|
||||||
|
})
|
||||||
async deleteAutomation(@Param() param: AutomationParamDto) {
|
async deleteAutomation(@Param() param: AutomationParamDto) {
|
||||||
await this.automationService.deleteAutomation(param);
|
await this.automationService.deleteAutomation(param);
|
||||||
return {
|
return {
|
||||||
@ -76,6 +96,11 @@ export class AutomationController {
|
|||||||
@ApiBearerAuth()
|
@ApiBearerAuth()
|
||||||
@UseGuards(JwtAuthGuard)
|
@UseGuards(JwtAuthGuard)
|
||||||
@Put(':automationUuid')
|
@Put(':automationUuid')
|
||||||
|
@ApiOperation({
|
||||||
|
summary: ControllerRoute.AUTOMATION.ACTIONS.UPDATE_AUTOMATION_SUMMARY,
|
||||||
|
description:
|
||||||
|
ControllerRoute.AUTOMATION.ACTIONS.UPDATE_AUTOMATION_DESCRIPTION,
|
||||||
|
})
|
||||||
async updateAutomation(
|
async updateAutomation(
|
||||||
@Body() updateAutomationDto: UpdateAutomationDto,
|
@Body() updateAutomationDto: UpdateAutomationDto,
|
||||||
@Param() param: AutomationParamDto,
|
@Param() param: AutomationParamDto,
|
||||||
@ -95,6 +120,12 @@ export class AutomationController {
|
|||||||
@ApiBearerAuth()
|
@ApiBearerAuth()
|
||||||
@UseGuards(JwtAuthGuard)
|
@UseGuards(JwtAuthGuard)
|
||||||
@Put('status/:automationUuid')
|
@Put('status/:automationUuid')
|
||||||
|
@ApiOperation({
|
||||||
|
summary:
|
||||||
|
ControllerRoute.AUTOMATION.ACTIONS.UPDATE_AUTOMATION_STATUS_SUMMARY,
|
||||||
|
description:
|
||||||
|
ControllerRoute.AUTOMATION.ACTIONS.UPDATE_AUTOMATION_STATUS_DESCRIPTION,
|
||||||
|
})
|
||||||
async updateAutomationStatus(
|
async updateAutomationStatus(
|
||||||
@Body() updateAutomationStatusDto: UpdateAutomationStatusDto,
|
@Body() updateAutomationStatusDto: UpdateAutomationStatusDto,
|
||||||
@Param() param: AutomationParamDto,
|
@Param() param: AutomationParamDto,
|
||||||
|
Reference in New Issue
Block a user