Skip to content

Commit

Permalink
fix: read weather station by its id
Browse files Browse the repository at this point in the history
  • Loading branch information
lihini committed Jan 18, 2024
1 parent 04efda3 commit 499c4dd
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 11 deletions.
11 changes: 2 additions & 9 deletions src/modules/weather-stations/weather-stations.controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand All @@ -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,
);

Expand Down
4 changes: 2 additions & 2 deletions src/modules/weather-stations/weather-stations.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down

0 comments on commit 499c4dd

Please sign in to comment.