mirror of
https://github.com/SyncrowIOT/backend.git
synced 2025-07-15 18:27:05 +00:00
Merge pull request #86 from SyncrowIOT/swagger-doc
chore: setup initial Swagger documentation
This commit is contained in:
11
libs/common/src/constants/controller-route.ts
Normal file
11
libs/common/src/constants/controller-route.ts
Normal 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.';
|
||||
};
|
||||
};
|
||||
}
|
@ -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();
|
||||
|
Reference in New Issue
Block a user