- 화면 전체 스켈레톤, 로딩·완료·실패 사이 레이아웃 고정, 값 없음은 '?' - 행사 사진·출처 표시, 문화정보 API 전시 연결, 행사 30km 거리 기준 - 각 상세 점수 칸 오늘/내일/토/일, 단기예보 밖 주말은 중기예보 예상 점수 - 6각 차트 축 이름을 좋은 방향으로, 계산 근거 문구 정리 - 아이콘 오용·뜻 모를 표시·빈 데이터·포스트 본문 반복 수정 - 미세먼지 별도 포스트, 노을 명소 전국 155곳 거리 기준, 노을 탭 결론 중심 재구성 - 밤 다크 테마·별똥별, 댓글·좋아요 대기·실패 표시 - 주말 전국 랭킹·당일치기 카드, 계절 이야기 사진 수집 - 문서: 포스트 타입별 내용, 각 데이터 정리, TODO 진행 순서
182 lines
4.0 KiB
Python
182 lines
4.0 KiB
Python
from datetime import date, datetime
|
|
from typing import Annotated, Literal, Optional, Union
|
|
|
|
from pydantic import Field
|
|
|
|
from common.enums import PostType, SlotTone
|
|
from common.models.gmodel import Res_WebPacketProtocol, WebPacketProtocol
|
|
|
|
|
|
class Row(WebPacketProtocol):
|
|
label: str
|
|
value: str
|
|
|
|
|
|
class HourCell(WebPacketProtocol):
|
|
label: str
|
|
icon: str
|
|
temp_c: Optional[float] = None
|
|
tone: SlotTone
|
|
|
|
|
|
class HoursSlide(WebPacketProtocol):
|
|
kind: Literal["hours"]
|
|
eyebrow: str
|
|
line: str
|
|
hours: list[HourCell]
|
|
|
|
|
|
class RowsSlide(WebPacketProtocol):
|
|
"""우산·미세먼지·계절 소식·행사·상식처럼 '한 줄 + 표' 모양."""
|
|
|
|
kind: Literal["rows"]
|
|
eyebrow: str
|
|
line: str
|
|
icon: str
|
|
rows: list[Row] = []
|
|
image: Optional[str] = None # 있으면 아이콘 대신 카드 전체에 사진
|
|
image_credit: Optional[str] = None # 사진 출처 표기 ("ⓒ한국관광공사")
|
|
|
|
|
|
class GakSlide(WebPacketProtocol):
|
|
kind: Literal["gak"]
|
|
index_id: int
|
|
code: str
|
|
name: str
|
|
rank: int
|
|
score: int
|
|
line: str
|
|
summary: str
|
|
|
|
|
|
class Cut(WebPacketProtocol):
|
|
at: datetime
|
|
kind: str
|
|
label: str
|
|
|
|
|
|
class SunsetSlide(WebPacketProtocol):
|
|
kind: Literal["sunset"]
|
|
eyebrow: str
|
|
line: str
|
|
score: int
|
|
grade_label: str
|
|
cuts: list[Cut]
|
|
|
|
|
|
class WeekDay(WebPacketProtocol):
|
|
day: date
|
|
weekday: str
|
|
icon: str
|
|
text: str
|
|
temp_min_c: Optional[float] = None
|
|
temp_max_c: Optional[float] = None
|
|
rain_prob: Optional[int] = None
|
|
|
|
|
|
class WeekSlide(WebPacketProtocol):
|
|
"""주말 예보: 토·일 비교 + 옷차림·우산 팁."""
|
|
|
|
kind: Literal["week"]
|
|
eyebrow: str
|
|
line: str
|
|
days: list[WeekDay]
|
|
tip: Optional[str] = None
|
|
|
|
|
|
class PlanStep(WebPacketProtocol):
|
|
time: str
|
|
icon: str
|
|
title: str
|
|
sub: str
|
|
image: Optional[str] = None # 행사 사진
|
|
image_credit: Optional[str] = None
|
|
|
|
|
|
class PlanSlide(WebPacketProtocol):
|
|
"""주말 플랜: 그날 시간대별 동선."""
|
|
|
|
kind: Literal["plan"]
|
|
eyebrow: str
|
|
line: str
|
|
steps: list[PlanStep]
|
|
|
|
|
|
Slide = Annotated[Union[HoursSlide, RowsSlide, GakSlide, SunsetSlide, WeekSlide, PlanSlide], Field(discriminator="kind")]
|
|
|
|
|
|
class PostData(WebPacketProtocol):
|
|
post_id: int
|
|
post_type: PostType
|
|
title: str
|
|
icon: str
|
|
caption: str
|
|
slides: list[Slide]
|
|
share_messages: list[str] = []
|
|
like_count: int
|
|
comment_count: int
|
|
published_at: datetime
|
|
size: Literal["full", "line"] = "full" # line: 한 줄 카드 (흐린 날 노을)
|
|
liked: Optional[bool] = None
|
|
saved: Optional[bool] = None
|
|
|
|
|
|
class TopIndex(WebPacketProtocol):
|
|
index_id: int
|
|
code: str
|
|
name: str
|
|
icon: str
|
|
score: int
|
|
rank: int
|
|
summary: Optional[str] = None
|
|
|
|
|
|
class Hero(WebPacketProtocol):
|
|
now_at: datetime
|
|
sky_mode: Literal["morning", "day", "sunset", "night"]
|
|
temp_c: Optional[float] = None
|
|
feels_c: Optional[float] = None
|
|
discomfort: Optional[int] = None
|
|
discomfort_label: Optional[str] = None
|
|
rain_2h_text: Optional[str] = None
|
|
will_rain_2h: Optional[bool] = None
|
|
weather_score: Optional[int] = None
|
|
top1: Optional[TopIndex] = None
|
|
bubble: Optional[str] = None
|
|
|
|
|
|
class BandEvent(WebPacketProtocol):
|
|
event_id: int
|
|
name: str
|
|
status_label: str
|
|
icon: str
|
|
image: Optional[str] = None
|
|
image_credit: Optional[str] = None
|
|
|
|
|
|
class BandArticle(WebPacketProtocol):
|
|
article_id: int
|
|
title: str
|
|
meta: str
|
|
icon: str
|
|
|
|
|
|
class Bands(WebPacketProtocol):
|
|
events: list[BandEvent] = []
|
|
top5: list[TopIndex] = []
|
|
season: list[BandArticle] = []
|
|
|
|
|
|
class Res_Feed(Res_WebPacketProtocol):
|
|
region_code: Optional[str] = None
|
|
region_name: Optional[str] = None
|
|
slot: Optional[Literal["morning", "day", "evening", "night"]] = None # 피드 순서를 정한 시간대
|
|
hero: Optional[Hero] = None
|
|
stories: list[TopIndex] = []
|
|
posts: list[PostData] = []
|
|
bands: Optional[Bands] = None
|
|
|
|
|
|
class Res_Post(Res_WebPacketProtocol):
|
|
post: Optional[PostData] = None
|