feat: 10/20 회의 반영 — 이야기 탭을 오늘 피드로 합침(글쓰기 칸·사진 올리기·위치 정보 삭제), 오늘의 각 카드와 히어로·각 공유 템플릿, 나만의 각을 이름+날씨 조건 저장으로, 로그인 없이 좋아요(IP 해시), 피드 순서·불쾌지수 상시·포스트 그림 배경, 새 각 아이콘
This commit is contained in:
1 parent
017022a0b0
commit
d0213f41a6
81 files changed
+3503
-593
No files matched your search
@@ -1,23 +1,62 @@
|
||||
from typing import Optional
|
||||
from typing import Literal, Optional
|
||||
|
||||
from pydantic import Field
|
||||
from pydantic import Field, model_validator
|
||||
|
||||
from common.models.gmodel import Req_WebPacketProtocol, Res_WebPacketProtocol, WebPacketProtocol
|
||||
|
||||
Slot = Literal["morning", "day", "evening", "night"]
|
||||
|
||||
|
||||
class MyGakRule(WebPacketProtocol):
|
||||
temp: Optional[list[float]] = Field(None, min_length=2, max_length=2, description="체감온도 범위 [최저, 최고]° (-20~40)")
|
||||
rain: Optional[Literal["dry", "wet"]] = Field(None, description="dry: 비 안 와야 / wet: 비 와야 / 없으면 상관없음")
|
||||
wind_max: Optional[float] = Field(None, ge=1, le=20, description="바람 상한 m/s")
|
||||
air: Optional[Literal["good", "normal"]] = Field(None, description="미세먼지 허용 단계: good 좋음까지 / normal 보통까지")
|
||||
humidity: Optional[list[int]] = Field(None, min_length=2, max_length=2, description="습도 범위 [최저, 최고]%")
|
||||
slots: list[Slot] = Field(default=["morning", "day", "evening", "night"], min_length=1, max_length=4, description="볼 시간대")
|
||||
|
||||
@model_validator(mode="after")
|
||||
def _check(self) -> "MyGakRule":
|
||||
if self.temp and not (-20 <= self.temp[0] < self.temp[1] <= 40):
|
||||
raise ValueError("temp 는 -20~40 안에서 최저 < 최고")
|
||||
if self.humidity and not (0 <= self.humidity[0] < self.humidity[1] <= 100):
|
||||
raise ValueError("humidity 는 0~100 안에서 최저 < 최고")
|
||||
if not (self.temp or self.rain or self.wind_max is not None or self.air or self.humidity):
|
||||
raise ValueError("조건을 하나 이상 정해야 함")
|
||||
return self
|
||||
|
||||
|
||||
class MyGakData(WebPacketProtocol):
|
||||
my_gak_id: int
|
||||
index_ids: list[int] = Field(description="섞은 공식 각 두 개. 점수는 두 각의 오늘 점수 중 낮은 쪽")
|
||||
name: str
|
||||
rule: MyGakRule
|
||||
|
||||
|
||||
class Req_MyGak(Req_WebPacketProtocol):
|
||||
index_ids: list[int] = Field(min_length=2, max_length=2, description="섞을 공식 각 두 개")
|
||||
name: str = Field(min_length=1, max_length=12, description="내 각 이름 (끝에 '각'이 없으면 붙인다)")
|
||||
rule: MyGakRule
|
||||
|
||||
|
||||
class Res_MyGakList(Res_WebPacketProtocol):
|
||||
mixable: list[int] = Field(default=[], description="섞을 수 있는 공식 각 index_id")
|
||||
items: list[MyGakData] = Field(default=[], description="내 각. 로그인하지 않았으면 비어 있음")
|
||||
|
||||
|
||||
class Res_MyGak(Res_WebPacketProtocol):
|
||||
item: Optional[MyGakData] = None
|
||||
|
||||
|
||||
class Req_MyGakScore(Req_WebPacketProtocol):
|
||||
region_code: str = Field(min_length=10, max_length=10)
|
||||
rules: list[MyGakRule] = Field(min_length=1, max_length=21)
|
||||
|
||||
|
||||
class MyGakScore(WebPacketProtocol):
|
||||
score: Optional[int] = Field(None, description="지금 시간대 점수. 지금이 고른 시간대가 아니면 고른 시간대 중 가장 좋은 점수. 예보가 없으면 null")
|
||||
slot: Optional[Slot] = Field(None, description="score 가 어느 시간대 점수인지")
|
||||
slots: dict[str, int] = Field(default={}, description="고른 시간대별 점수 (아침·낮·저녁·밤 순)")
|
||||
reasons: list[str] = Field(default=[], description="score 근거: 조건마다 그 시간대 실제 값")
|
||||
|
||||
|
||||
class Res_MyGakScore(Res_WebPacketProtocol):
|
||||
now_slot: Optional[Slot] = None
|
||||
scores: list[MyGakScore] = []
|
||||
Reference in new issue
Block a user