Merge pull request #86 from SyncrowIOT/swagger-doc

chore: setup initial Swagger documentation
This commit is contained in:
hannathkadher
2024-09-16 12:08:28 +04:00
committed by GitHub
2 changed files with 18 additions and 2 deletions

View File

@ -0,0 +1,11 @@
export class ControllerRoute {
static REGION = class {
public static readonly ROUTE = 'region';
static ACTIONS = class {
public static readonly GET_REGIONS_SUMMARY = 'Get list of all regions';
public static readonly GET_REGIONS_DESCRIPTION =
'Retrieve the list of all regions registered in Syncrow.';
};
};
}

View File

@ -1,16 +1,21 @@
import { Controller, Get, HttpException, HttpStatus } from '@nestjs/common';
import { RegionService } from '../services/region.service';
import { ApiTags } from '@nestjs/swagger';
import { ApiTags, ApiOperation } from '@nestjs/swagger';
import { ControllerRoute } from '@app/common/constants/controller-route';
@ApiTags('Region Module')
@Controller({
version: '1',
path: 'region',
path: ControllerRoute.REGION.ROUTE,
})
export class RegionController {
constructor(private readonly regionService: RegionService) {}
@Get()
@ApiOperation({
summary: ControllerRoute.REGION.ACTIONS.GET_REGIONS_SUMMARY,
description: ControllerRoute.REGION.ACTIONS.GET_REGIONS_DESCRIPTION,
})
async getAllRegions() {
try {
return await this.regionService.getAllRegions();