Files
backend/src/weather/controllers/weather.controller.ts

29 lines
1.1 KiB
TypeScript

import { Controller, Get, Query } from '@nestjs/common';
import { ApiOperation, ApiTags } from '@nestjs/swagger';
import { EnableDisableStatusEnum } from '@app/common/constants/days.enum';
import { ControllerRoute } from '@app/common/constants/controller-route'; // Assuming this is where the routes are defined
import { WeatherService } from '../services';
import { BaseResponseDto } from '@app/common/dto/base.response.dto';
import { GetWeatherDetailsDto } from '../dto/get.weather.dto';
@ApiTags('Weather Module')
@Controller({
version: EnableDisableStatusEnum.ENABLED,
path: ControllerRoute.WEATHER.ROUTE, // use the static route constant
})
export class WeatherController {
constructor(private readonly weatherService: WeatherService) {}
@Get()
@ApiOperation({
summary: ControllerRoute.WEATHER.ACTIONS.FETCH_WEATHER_DETAILS_SUMMARY,
description:
ControllerRoute.WEATHER.ACTIONS.FETCH_WEATHER_DETAILS_DESCRIPTION,
})
async fetchWeatherDetails(
@Query() query: GetWeatherDetailsDto,
): Promise<BaseResponseDto> {
return await this.weatherService.fetchWeatherDetails(query);
}
}