mirror of
https://github.com/SyncrowIOT/backend.git
synced 2025-11-27 15:14:54 +00:00
Add Weather module with controller, service, and DTO for fetching weather details
This commit is contained in:
28
src/weather/controllers/weather.controller.ts
Normal file
28
src/weather/controllers/weather.controller.ts
Normal file
@ -0,0 +1,28 @@
|
||||
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);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user