- 로그인 안 하면 기기에, 로그인하면 계정에 남기고 로그인할 때 기기 기록을 옮긴다 (표 fortune_draw·day_log) - 행운 시간은 오늘 남은 구간 중 날씨 점수가 가장 높은 때, 장소는 날씨 맞춤 데이트 명소, 1위 각은 지금 순위 - 체크인은 해 지기 2시간 전부터: 기분·다녀온 곳(명소·노을 명소·지금 하는 행사에서 찾거나 직접)·카드 맞았나 - GA4 fortune_draw·day_log
84 lines
3.1 KiB
Python
84 lines
3.1 KiB
Python
from datetime import date
|
|
from typing import Optional
|
|
|
|
from pydantic import Field
|
|
|
|
from common.models.gmodel import Req_WebPacketProtocol, Res_WebPacketProtocol, WebPacketProtocol
|
|
|
|
|
|
class FortuneCard(WebPacketProtocol):
|
|
code: str = Field(description="각 코드 (카드 그림은 /fortune/<code>.webp)")
|
|
name: str
|
|
icon: str
|
|
reading: str = Field(description="리딩 한 문장")
|
|
color: str = Field(description="행운 색 이름")
|
|
hex: str = Field(description="행운 색 #rrggbb")
|
|
|
|
|
|
class FortuneLuck(WebPacketProtocol):
|
|
time: Optional[str] = Field(None, description="행운 시간: 오늘 남은 구간 중 날씨가 가장 좋은 때 (예: 오후 4~7시)")
|
|
place: Optional[str] = Field(None, description="행운 장소: 날씨 맞춤 데이트 명소")
|
|
place_id: Optional[int] = None
|
|
top_gak: Optional[str] = Field(None, description="지금 1위 각 이름")
|
|
top_icon: Optional[str] = None
|
|
|
|
|
|
class DayLogData(WebPacketProtocol):
|
|
day: date
|
|
mood: int = Field(ge=1, le=5, description="1(가장 좋음)~5")
|
|
went_out: bool
|
|
place_name: Optional[str] = None
|
|
place_ref: Optional[str] = Field(None, description="목록에서 고른 곳: place:<id> · spot:<id> · event:<id>")
|
|
card_hit: Optional[bool] = Field(None, description="오늘 카드 맞았나")
|
|
|
|
|
|
class Res_FortuneToday(Res_WebPacketProtocol):
|
|
day: Optional[date] = None
|
|
card: Optional[FortuneCard] = Field(None, description="오늘 뽑은 카드. 아직 안 뽑았으면 없음")
|
|
luck: Optional[FortuneLuck] = None
|
|
streak: int = Field(0, description="이어 뽑은 날 수 (7일에 한 번 쉬는 날은 봐준다)")
|
|
checkin_open: bool = Field(False, description="저녁(해 지기 2시간 전)부터 체크인")
|
|
log: Optional[DayLogData] = Field(None, description="오늘 체크인 (로그인했을 때)")
|
|
|
|
|
|
class Req_FortuneDraw(Req_WebPacketProtocol):
|
|
region_code: str = Field(min_length=10, max_length=10)
|
|
card_code: Optional[str] = Field(None, max_length=32, description="로그인 안 했을 때 기기에 있는 오늘 카드 (없으면 새로 뽑음)")
|
|
days: list[date] = Field(default=[], max_length=60, description="로그인 안 했을 때 기기에 남은 뽑은 날 (연속 기록용)")
|
|
|
|
|
|
class Req_DayLog(Req_WebPacketProtocol):
|
|
region_code: str = Field(min_length=10, max_length=10)
|
|
mood: int = Field(ge=1, le=5)
|
|
went_out: bool
|
|
place_name: Optional[str] = Field(None, max_length=40)
|
|
place_ref: Optional[str] = Field(None, max_length=40)
|
|
card_hit: Optional[bool] = None
|
|
|
|
|
|
class Res_DayLog(Res_WebPacketProtocol):
|
|
log: Optional[DayLogData] = None
|
|
|
|
|
|
class LocalDraw(WebPacketProtocol):
|
|
day: date
|
|
card_code: str = Field(max_length=32)
|
|
|
|
|
|
class LocalLog(Req_DayLog):
|
|
day: date
|
|
|
|
|
|
class Req_FortuneImport(Req_WebPacketProtocol):
|
|
draws: list[LocalDraw] = Field(default=[], max_length=60)
|
|
logs: list[LocalLog] = Field(default=[], max_length=60)
|
|
|
|
|
|
class FortunePlace(WebPacketProtocol):
|
|
ref: str = Field(description="place:<id> · spot:<id> · event:<id>")
|
|
name: str
|
|
|
|
|
|
class Res_FortunePlaces(Res_WebPacketProtocol):
|
|
items: list[FortunePlace] = []
|