Skip to content

Commit

Permalink
chore: include dong info in weather
Browse files Browse the repository at this point in the history
  • Loading branch information
PleahMaCaka committed Nov 2, 2023
1 parent 79f674d commit 7998fcf
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
5 changes: 4 additions & 1 deletion routers/weather.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,8 @@ async def weather_detail(
data = find_near_dong(lat, lon)
if data is None:
return dict()
return get_single_weather(data.code, data.lat, data.lon)

return get_single_weather(data.code, data.lat, data.lon, dong=data.name)


@router.get("/list")
Expand Down Expand Up @@ -108,6 +109,7 @@ def get_single_weather(
code: str,
lat: float,
lon: float,
dong: str | None = None,
) -> WeatherDetail:
body = requests.get(
_SINGLE_WEATHER_DATA_URL
Expand Down Expand Up @@ -154,6 +156,7 @@ def get_single_weather(
wd=wd,
fdst=fdst,
ffdst=ffdst,
dong=dong,
)


Expand Down
2 changes: 2 additions & 0 deletions service/weather/dto/weather_dto.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ def __init__(
wd: str, # 풍향 (한국어)
fdst: float, # 미세먼지 (ug/m)
ffdst: float, # 초미세먼지 (ug/m)
dong: str
):
self.temp = temp
self.tmin = tmin
Expand All @@ -25,6 +26,7 @@ def __init__(
self.wd = wd
self.fdst = fdst
self.ffdst = ffdst
self.dong = dong


class WeatherData:
Expand Down

0 comments on commit 7998fcf

Please sign in to comment.