mirror of
https://github.com/SyncrowIOT/backend.git
synced 2025-11-27 13:04:54 +00:00
Add TimeZone module with controller and service
This commit is contained in:
1
src/timezone/controllers/index.ts
Normal file
1
src/timezone/controllers/index.ts
Normal file
@ -0,0 +1 @@
|
||||
export * from './timezone.controller';
|
||||
33
src/timezone/controllers/timezone.controller.ts
Normal file
33
src/timezone/controllers/timezone.controller.ts
Normal file
@ -0,0 +1,33 @@
|
||||
import {
|
||||
Controller,
|
||||
Get,
|
||||
HttpException,
|
||||
HttpStatus,
|
||||
UseGuards,
|
||||
} from '@nestjs/common';
|
||||
import { TimeZoneService } from '../services/timezone.service';
|
||||
import { ApiTags, ApiBearerAuth } from '@nestjs/swagger';
|
||||
import { JwtAuthGuard } from '../../../libs/common/src/guards/jwt.auth.guard';
|
||||
|
||||
@ApiTags('TimeZone Module')
|
||||
@Controller({
|
||||
version: '1',
|
||||
path: 'timezone',
|
||||
})
|
||||
export class TimeZoneController {
|
||||
constructor(private readonly timeZoneService: TimeZoneService) {}
|
||||
|
||||
@ApiBearerAuth()
|
||||
@UseGuards(JwtAuthGuard)
|
||||
@Get()
|
||||
async getAllTimeZones() {
|
||||
try {
|
||||
return await this.timeZoneService.getAllTimeZones();
|
||||
} catch (error) {
|
||||
throw new HttpException(
|
||||
error.message || 'Internal server error',
|
||||
error.status || HttpStatus.INTERNAL_SERVER_ERROR,
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user