- FastAPI + PostgreSQL + Redis, web·worker 분리, compose 에 backend·worker·postgres·redis 추가 - 기상청 단기·초단기·중기·특보, 에어코리아, Open-Meteo, TourAPI, 특일정보 연동 (첫 조회 때 받고 캐시) - 매일 03:00 worker 가 전국 공통 피드 칸을 정하고 지난 데이터를 정리 - 시드: 시군구 256곳, 지수 23개, 노을 대표 지점·명소, 데이트 명소, 읽을거리 - pytest 66개 (테스트 전용 DB·Redis 사용) Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
54 lines
1.1 KiB
Python
54 lines
1.1 KiB
Python
from datetime import date, datetime
|
|
from typing import Optional
|
|
|
|
from common.enums import Confidence, SkyGrade, SkyType
|
|
from common.models.gmodel import Res_WebPacketProtocol, WebPacketProtocol
|
|
|
|
|
|
class BestTime(WebPacketProtocol):
|
|
at: datetime
|
|
kind: str
|
|
label: str
|
|
|
|
|
|
class SkyScoreData(WebPacketProtocol):
|
|
day: date
|
|
sky_type: SkyType
|
|
score: int
|
|
grade: SkyGrade
|
|
grade_label: str
|
|
confidence: Confidence
|
|
best_times: list[BestTime] = []
|
|
|
|
|
|
class SpotData(WebPacketProtocol):
|
|
no: int
|
|
name: str
|
|
description: str
|
|
lat: float
|
|
lon: float
|
|
distance_km: float
|
|
|
|
|
|
class Res_Sky(Res_WebPacketProtocol):
|
|
region_code: Optional[str] = None
|
|
sunset_azimuth: Optional[int] = None
|
|
sunset: Optional[SkyScoreData] = None
|
|
sunrise: Optional[SkyScoreData] = None
|
|
days: list[SkyScoreData] = []
|
|
spots: list[SpotData] = []
|
|
|
|
|
|
class RankData(WebPacketProtocol):
|
|
rank: int
|
|
region_code: str
|
|
name: str
|
|
note: Optional[str] = None
|
|
score: int
|
|
grade: SkyGrade
|
|
|
|
|
|
class Res_SkyRanking(Res_WebPacketProtocol):
|
|
day: Optional[date] = None
|
|
items: list[RankData] = []
|