Add Region module

This commit is contained in:
faris Aljohari
2024-07-15 15:46:32 +03:00
parent 8c2647c1f0
commit 31a6377fa6
5 changed files with 73 additions and 0 deletions
+1
View File
@@ -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,
);
}
}
}