mirror of
https://github.com/SyncrowIOT/backend.git
synced 2025-07-16 02:36:19 +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 { Controller, Get, HttpException, HttpStatus } from '@nestjs/common';
|
||||||
import { RegionService } from '../services/region.service';
|
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')
|
@ApiTags('Region Module')
|
||||||
@Controller({
|
@Controller({
|
||||||
version: '1',
|
version: '1',
|
||||||
path: 'region',
|
path: ControllerRoute.REGION.ROUTE,
|
||||||
})
|
})
|
||||||
export class RegionController {
|
export class RegionController {
|
||||||
constructor(private readonly regionService: RegionService) {}
|
constructor(private readonly regionService: RegionService) {}
|
||||||
|
|
||||||
@Get()
|
@Get()
|
||||||
|
@ApiOperation({
|
||||||
|
summary: ControllerRoute.REGION.ACTIONS.GET_REGIONS_SUMMARY,
|
||||||
|
description: ControllerRoute.REGION.ACTIONS.GET_REGIONS_DESCRIPTION,
|
||||||
|
})
|
||||||
async getAllRegions() {
|
async getAllRegions() {
|
||||||
try {
|
try {
|
||||||
return await this.regionService.getAllRegions();
|
return await this.regionService.getAllRegions();
|
||||||
|
Reference in New Issue
Block a user