feat: 날씨각 워치 스킨(WFF) — 1~7위 링, 구름·비·눈 애니메이션, 귀여운 해
- watchface 모듈: 큰 원 1위 + 둘레 링 2~7위, 시간대 하늘, 구름 흐름, 비·눈 오버레이 - 앱: 순위별 컴플리케이션(1~7위), 비·눈 컴플리케이션, 히어로 장 비·눈·해 광선 - 백엔드: /v1/watch/summary top 을 7개로 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
3f806f9955
commit
8c7fbdaac7
47 files changed
+1119
-32
No files matched your search
@@ -20,6 +20,8 @@ from services.weather_service import WeatherService
|
||||
router = APIRouter(prefix="/v1/watch", tags=["watch"])
|
||||
|
||||
MAX_PICKS = 3
|
||||
# 워치 스킨이 큰 원(1위) + 둘레 링 6개(2~7위)를 채운다
|
||||
TOP_N = 7
|
||||
|
||||
|
||||
def _best(score: SkyScore, kind: str) -> datetime:
|
||||
@@ -37,7 +39,7 @@ def timeline(now: datetime, sunset: Optional[SkyScore], is_today: bool) -> list[
|
||||
return items + [WatchTimeline(start_at=max(start, now), kind="sunset"), WatchTimeline(start_at=end, kind="gak")]
|
||||
|
||||
|
||||
@router.get("/summary", response_model=Res_WatchSummary, response_model_exclude_none=True, summary="워치 한 번에: 지금 날씨, 각 1~3위·내 각, 노을, 남은 3시간 칸, 컴플리케이션 시간표")
|
||||
@router.get("/summary", response_model=Res_WatchSummary, response_model_exclude_none=True, summary="워치 한 번에: 지금 날씨, 각 1~7위·내 각, 노을, 남은 3시간 칸, 컴플리케이션 시간표")
|
||||
async def get_watch_summary(
|
||||
region: str = Query(..., description="구 행정코드"),
|
||||
pick: Optional[str] = Query(None, description="내 각 코드, 쉼표로 최대 3개 (예: running,laundry)"),
|
||||
@@ -78,7 +80,7 @@ async def get_watch_summary(
|
||||
res.warning = now_w.warnings[0].text if now_w.warnings else None
|
||||
|
||||
if board is not None:
|
||||
res.top = [_top(i) for i in board.items[:3]]
|
||||
res.top = [_top(i) for i in board.items[:TOP_N]]
|
||||
codes = [c.strip() for c in (pick or "").split(",") if c.strip()][:MAX_PICKS]
|
||||
by_code = {i.definition.code: i for i in board.items}
|
||||
res.picks = [_top(by_code[c]) for c in codes if c in by_code]
|
||||
|
||||
@@ -48,7 +48,7 @@ async def test_watch_summary_bundles_now_top_picks_sunset(offline):
|
||||
assert body["region_code"] == REGION and body["mode"] in ("morning", "day", "evening", "night")
|
||||
assert body["refresh_at"] > body["issued_at"]
|
||||
assert body["now"]["rain_2h"] is False and body["now"]["temp_c"] == 20.0
|
||||
assert len(body["top"]) == 3
|
||||
assert [t["rank"] for t in body["top"]] == list(range(1, 8))
|
||||
assert [p["code"] for p in body["picks"]] == ["laundry", "running"]
|
||||
assert body["sunset"]["best_at"] > body["sunset"]["sunset_at"]
|
||||
assert all(s["at"] > body["issued_at"] for s in body["slots"])
|
||||
|
||||
Reference in new issue
Block a user