diff --git a/src/modules/weather-stations/weather-stations.controller.ts b/src/modules/weather-stations/weather-stations.controller.ts index 719da4c..6757953 100644 --- a/src/modules/weather-stations/weather-stations.controller.ts +++ b/src/modules/weather-stations/weather-stations.controller.ts @@ -50,7 +50,7 @@ export class WeatherStationsController { @Get(':id') findOne(@Param('id') id: string) { - return this.weatherStationsService.findOne(+id); + return this.weatherStationsService.findOne(id); } // TODO: refactor to weather-data module. @@ -76,14 +76,7 @@ export class WeatherStationsController { } // Get points of the user of the weather station. - let pointsOfUser = null; - if (!weatherData) { - return { - weatherData, - pointsOfUser, - }; - } - pointsOfUser = await this.pointsService.findByUserId( + const pointsOfUser = await this.pointsService.findByUserId( weatherData.author_user_id, ); diff --git a/src/modules/weather-stations/weather-stations.service.ts b/src/modules/weather-stations/weather-stations.service.ts index c0d597e..95759fa 100644 --- a/src/modules/weather-stations/weather-stations.service.ts +++ b/src/modules/weather-stations/weather-stations.service.ts @@ -99,8 +99,8 @@ export class WeatherStationsService { return this.weatherStationModel.find(); } - findOne(id: number) { - return `This action returns a #${id} weatherStation`; + findOne(id: string) { + return this.weatherStationModel.findOne({ _id: id }); } async update(_id: string, updateWeatherStationDto: UpdateWeatherStationDto) {