feat: 계절 지도 자리에 첫눈 지도·해돋이 지도 — 단풍 지도가 끝나면 첫눈 지도(~12/20, 지점 42곳 평년 첫눈 날짜 + 앞으로 7일 눈 예보, GET /v1/season/first-snow), 12/21부터 해돋이 지도(~2월, 명소 50곳 해 뜨는 시각, 12월엔 새해 첫날 기준). 오늘 탭 아이콘·피드 맨 앞 카드(foliage_post 좋아요·댓글 자리를 이어받음)·/first-snow·/sunrise 페이지·공유 이미지. 지도 확대·이동은 mapView.ts 로 꺼내 단풍 지도와 같이 씀 (GA first_snow_open·first_snow_spot·sunrise_open·sunrise_spot·sunrise_day)
This commit is contained in:
1 parent
4e69c4ac44
commit
d7dfc1ba82
30 files changed
+1973
-255
No files matched your search
@@ -42,3 +42,19 @@ class Res_ArticleList(Res_WebPacketProtocol):
|
||||
class Res_Article(Res_WebPacketProtocol):
|
||||
article: Optional[ArticleSummary] = None
|
||||
body: list[str] = []
|
||||
|
||||
|
||||
class FirstSnowSpot(WebPacketProtocol):
|
||||
name: str
|
||||
region: str # 시·도
|
||||
lat: float
|
||||
lon: float
|
||||
normal: str # 평년 첫눈 날짜 "MM-DD" (1991~2020 평균)
|
||||
top: bool = False # 처음 화면에 이름까지 보이는 대표 지점
|
||||
snow_date: Optional[date] = None # 앞으로 7일 안에 눈 예보가 있는 첫 날. 없으면 비움
|
||||
snow_cm: Optional[float] = None # 그날 눈 오는 양(cm)
|
||||
|
||||
|
||||
class Res_FirstSnow(Res_WebPacketProtocol):
|
||||
forecast: bool = False # 눈 예보를 받았는지. False 면 snow_date 는 모두 비어 있다(평년 날짜만)
|
||||
spots: list[FirstSnowSpot] = []
|
||||
@@ -5,7 +5,9 @@ from fastapi import APIRouter, Depends, Path, Query
|
||||
from common.database.model.models import Article
|
||||
from common.enums import ArticleCategory, ErrorType
|
||||
from common.models.errors import error_info
|
||||
from router.v1.season.protocol import ArticleSummary, Res_Article, Res_ArticleList, Res_SeasonWeek, TermData
|
||||
from common.utils.kma_time import now_kst
|
||||
from router.v1.season.protocol import ArticleSummary, FirstSnowSpot, Res_Article, Res_ArticleList, Res_FirstSnow, Res_SeasonWeek, TermData
|
||||
from services.first_snow_service import FirstSnowService
|
||||
from services.season_service import SeasonService
|
||||
|
||||
router = APIRouter(prefix="/v1/season", tags=["season"])
|
||||
@@ -44,3 +46,9 @@ async def get_article(article_id: int = Path(...), service: SeasonService = Depe
|
||||
if err is not ErrorType.SUCCESS:
|
||||
return Res_Article(result=error_info(err))
|
||||
return Res_Article(article=_summary(a), body=a.body)
|
||||
|
||||
|
||||
@router.get("/first-snow", response_model=Res_FirstSnow, response_model_exclude_none=True, summary="첫눈 지도: 지점별 평년 첫눈 날짜와 앞으로 7일 눈 예보")
|
||||
async def get_first_snow(service: FirstSnowService = Depends()) -> Res_FirstSnow:
|
||||
forecast, spots = await service.spots(now_kst())
|
||||
return Res_FirstSnow(forecast=forecast, spots=[FirstSnowSpot(**s.__dict__) for s in spots])
|
||||
Reference in new issue
Block a user