-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
10 changed files
with
165 additions
and
17 deletions.
There are no files selected for viewing
23 changes: 23 additions & 0 deletions
23
weather-service/src/main/java/com/waither/weatherservice/controller/WeatherController.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,27 @@ | ||
package com.waither.weatherservice.controller; | ||
|
||
import org.springframework.web.bind.annotation.PostMapping; | ||
import org.springframework.web.bind.annotation.RequestBody; | ||
import org.springframework.web.bind.annotation.RequestMapping; | ||
import org.springframework.web.bind.annotation.RestController; | ||
|
||
import com.waither.weatherservice.dto.request.GetWeatherRequest; | ||
import com.waither.weatherservice.dto.response.MainWeatherResponse; | ||
import com.waither.weatherservice.response.ApiResponse; | ||
import com.waither.weatherservice.service.WeatherService; | ||
|
||
import lombok.RequiredArgsConstructor; | ||
|
||
@RequiredArgsConstructor | ||
@RestController | ||
@RequestMapping("/api/v1/weather") | ||
public class WeatherController { | ||
|
||
private final WeatherService weatherService; | ||
|
||
@PostMapping("/main") | ||
public ApiResponse<MainWeatherResponse> getMainWeather(@RequestBody GetWeatherRequest getWeatherRequest) { | ||
return ApiResponse.onSuccess( | ||
weatherService.getMainWeather(getWeatherRequest.latitude(), getWeatherRequest.longitude())); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
7 changes: 7 additions & 0 deletions
7
weather-service/src/main/java/com/waither/weatherservice/dto/request/GetWeatherRequest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
package com.waither.weatherservice.dto.request; | ||
|
||
public record GetWeatherRequest( | ||
double latitude, | ||
double longitude | ||
) { | ||
} |
61 changes: 61 additions & 0 deletions
61
...er-service/src/main/java/com/waither/weatherservice/dto/response/MainWeatherResponse.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
package com.waither.weatherservice.dto.response; | ||
|
||
import java.util.List; | ||
|
||
import lombok.Builder; | ||
|
||
@Builder | ||
public record MainWeatherResponse( | ||
|
||
String pop, | ||
String tempMin, | ||
String tempMax, | ||
String humidity, | ||
String windVector, | ||
String windDegree, | ||
// 예상 기온 | ||
List<String> expectedTemp, | ||
|
||
// 예상 강수량 | ||
List<String> expectedRain, | ||
|
||
// 예상 강수 형태 | ||
List<String> expectedPty, | ||
|
||
// 예상 하늘 상태 | ||
List<String> expectedSky | ||
) { | ||
|
||
public static MainWeatherResponse from( | ||
String pop, | ||
String tempMin, | ||
String tempMax, | ||
String humidity, | ||
String windVector, | ||
String windDegree, | ||
// 예상 기온 | ||
List<String> expectedTemp, | ||
|
||
// 예상 강수량 | ||
List<String> expectedRain, | ||
|
||
// 예상 강수 형태 | ||
List<String> expectedPty, | ||
|
||
// 예상 하늘 상태 | ||
List<String> expectedSky | ||
) { | ||
return MainWeatherResponse.builder() | ||
.pop(pop) | ||
.tempMin(tempMin) | ||
.tempMax(tempMax) | ||
.humidity(humidity) | ||
.windVector(windVector) | ||
.windDegree(windDegree) | ||
.expectedTemp(expectedTemp) | ||
.expectedRain(expectedRain) | ||
.expectedPty(expectedPty) | ||
.expectedSky(expectedSky) | ||
.build(); | ||
} | ||
} |
7 changes: 0 additions & 7 deletions
7
weather-service/src/main/java/com/waither/weatherservice/dto/response/WeatherResponse.java
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters