mirror of
https://github.com/SyncrowIOT/backend.git
synced 2025-11-26 08:14:55 +00:00
26 lines
655 B
TypeScript
26 lines
655 B
TypeScript
import { TimeZoneRepository } from '@app/common/modules/timezone/repositories';
|
|
import {
|
|
BadRequestException,
|
|
HttpException,
|
|
HttpStatus,
|
|
Injectable,
|
|
} from '@nestjs/common';
|
|
|
|
@Injectable()
|
|
export class TimeZoneService {
|
|
constructor(private readonly timeZoneRepository: TimeZoneRepository) {}
|
|
async getAllTimeZones() {
|
|
try {
|
|
const timeZones = await this.timeZoneRepository.find();
|
|
|
|
return timeZones;
|
|
} catch (err) {
|
|
if (err instanceof BadRequestException) {
|
|
throw err; // Re-throw BadRequestException
|
|
} else {
|
|
throw new HttpException('TimeZones found', HttpStatus.NOT_FOUND);
|
|
}
|
|
}
|
|
}
|
|
}
|