2023-09-17 07:05:52 +00:00
|
|
|
import { Controller, Get, Query, UseInterceptors } from '@nestjs/common';
|
2023-09-16 19:45:26 +00:00
|
|
|
import { AppService } from './app.service';
|
|
|
|
import { CacheInterceptor, CacheTTL } from '@nestjs/cache-manager';
|
2023-09-17 07:05:52 +00:00
|
|
|
import { HistoryQueryDto } from './dtos/history-query.dto';
|
2023-09-16 19:45:26 +00:00
|
|
|
|
|
|
|
@Controller()
|
|
|
|
export class AppController {
|
|
|
|
constructor(private readonly appService: AppService) {}
|
|
|
|
|
|
|
|
@Get()
|
|
|
|
@UseInterceptors(CacheInterceptor)
|
|
|
|
@CacheTTL(60000)
|
|
|
|
getWeather() {
|
|
|
|
return this.appService.getWeather();
|
|
|
|
}
|
2023-09-17 07:05:52 +00:00
|
|
|
|
|
|
|
@Get('history')
|
|
|
|
getWeatherHistory(@Query() query: HistoryQueryDto) {
|
|
|
|
return this.appService.getWeatherHistory(query);
|
|
|
|
}
|
2023-09-16 19:45:26 +00:00
|
|
|
}
|