mirror of
https://github.com/SyncrowIOT/backend.git
synced 2026-10-27 02:57:55 +00:00
Add Region module
This commit is contained in:
@@ -0,0 +1 @@
|
||||
export * from './region.controller';
|
||||
@@ -0,0 +1,33 @@
|
||||
import {
|
||||
Controller,
|
||||
Get,
|
||||
HttpException,
|
||||
HttpStatus,
|
||||
UseGuards,
|
||||
} from '@nestjs/common';
|
||||
import { RegionService } from '../services/region.service';
|
||||
import { ApiTags, ApiBearerAuth } from '@nestjs/swagger';
|
||||
import { JwtAuthGuard } from '../../../libs/common/src/guards/jwt.auth.guard';
|
||||
|
||||
@ApiTags('Region Module')
|
||||
@Controller({
|
||||
version: '1',
|
||||
path: 'region',
|
||||
})
|
||||
export class RegionController {
|
||||
constructor(private readonly regionService: RegionService) {}
|
||||
|
||||
@ApiBearerAuth()
|
||||
@UseGuards(JwtAuthGuard)
|
||||
@Get()
|
||||
async getAllRegions() {
|
||||
try {
|
||||
return await this.regionService.getAllRegions();
|
||||
} catch (error) {
|
||||
throw new HttpException(
|
||||
error.message || 'Internal server error',
|
||||
error.status || HttpStatus.INTERNAL_SERVER_ERROR,
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user