feat: 오늘 탭 아이콘 줄에 날씨 게임(/game) 연결, 오늘 코디 빼기, 오늘 타로는 잠시 숨김

- feat/weather-game(구름 합치기) 브랜치를 합쳐 아이콘에서 바로 열림
- 오늘 코디 아이콘·창과 그걸 위해 넣은 GET /v1/card/latest 를 걷어냄
- 오늘 타로는 features.ts HIDDEN 으로 숨김 (아이콘 줄·각 모으는 법에서 빠짐, 안내 문구에서도 타로를 뺌)
This commit is contained in:
minaChoi committed 2026-10-28 15:55:00 +09:00
1 parent 4cfcbcf7ea
commit e4834fd24e
15 files changed
+18 -183

No files matched your search

-7
View File
@@ -26,13 +26,6 @@ class CardCRUD:
"""만든 순서 역순. 올린 것·승인 대기·반려 모두."""
return list((await s.scalars(select(CardSet).order_by(CardSet.card_id.desc()).limit(limit))).all())
async def latest_published(self, s: AsyncSession, template: str) -> Optional[CardSet]:
"""그 틀로 가장 최근에 피드에 올린 카드뉴스"""
return await s.scalar(
select(CardSet).where(CardSet.template == template, CardSet.status == CardStatus.PUBLISHED.value, CardSet.post_id.is_not(None))
.order_by(CardSet.published_at.desc()).limit(1)
)
async def many(self, s: AsyncSession, card_ids: list[int]) -> list[CardSet]:
if not card_ids:
return []
+1 -11
View File
@@ -14,7 +14,7 @@ from common.models.errors import error_info
from common.utils.kma_time import KST, kst_midnight, now_kst
from crud.card_crud import CardCRUD
from crud.feed_crud import FeedCRUD
from router.v1.card.protocol import CardItem, Req_CardCreate, Res_Card, Res_CardList, Res_LatestCard
from router.v1.card.protocol import CardItem, Req_CardCreate, Res_Card, Res_CardList
from services.bot_comment import fill_bot_comments
from services.external import instagram
from services.feed_service import _FEED_DAY_START, clear_feed_cache, feed_day
@@ -82,16 +82,6 @@ async def list_cards(limit: int = Query(50, ge=1, le=200)) -> Res_CardList:
])
@router.get("/latest", response_model=Res_LatestCard, response_model_exclude_none=True, summary="그 틀로 가장 최근에 피드에 올린 카드뉴스의 포스트 (오늘 탭 '오늘 코디' 아이콘)")
async def latest_card(template: str = Query(..., pattern=r"^[a-z_]{1,20}$")) -> Res_LatestCard:
err, card = await DB_SESSION_MNG.execute_lambda(lambda s: _crud.latest_published(s, template))
if err is not ErrorType.SUCCESS:
return Res_LatestCard(result=error_info(err))
if card is None:
return Res_LatestCard()
return Res_LatestCard(post_id=card.post_id, published_at=card.published_at.astimezone(KST) if card.published_at else None)
@router.post("", response_model=Res_Card, response_model_exclude_none=True, summary="카드뉴스 저장 (관리자). publish 면 바로 그날 피드에 올린다", dependencies=[Depends(require_admin)])
async def create_card(req: Req_CardCreate) -> Res_Card:
images = _jpegs(req.images)
-5
View File
@@ -18,11 +18,6 @@ class Req_CardCreate(WebPacketProtocol):
publish: bool = Field(default=False, description="true 면 만들자마자 그날 피드에 올린다. false 면 승인 대기")
class Res_LatestCard(Res_WebPacketProtocol):
post_id: Optional[int] = None
published_at: Optional[datetime] = None
class Res_Card(Res_WebPacketProtocol):
card_id: Optional[int] = None
status: Optional[CardStatus] = None
-12
View File
@@ -143,15 +143,3 @@ async def test_instagram_requires_token(offline, admin_key, monkeypatch):
res = (await c.post(f"/v1/card/{made['card_id']}/instagram", headers=admin_key)).json()
assert res["result"]["success"] is False and "INSTAGRAM" in res["msg"]
@pytest.mark.anyio
async def test_latest_card_by_template_is_public(offline, admin_key):
async with client() as c:
assert "post_id" not in (await c.get("/v1/card/latest", params={"template": "ootd"})).json()
ootd = (await c.post("/v1/card", json=body(template="ootd", title="오늘 코디", publish=True), headers=admin_key)).json()
await c.post("/v1/card", json=body(template="ootd", title="승인 대기 코디"), headers=admin_key)
await c.post("/v1/card", json=body(publish=True), headers=admin_key)
# 그 틀로 피드에 올린 것 중 가장 최근 (승인 대기·다른 틀은 빼고)
latest = (await c.get("/v1/card/latest", params={"template": "ootd"})).json()
assert latest["post_id"] == ootd["post_id"] and latest["published_at"]
assert (await c.get("/v1/card/latest", params={"template": "../x"})).status_code == 422