From e4834fd24e7a8f962e54dc8ff50a274e26048d94 Mon Sep 17 00:00:00 2001 From: Mina Choi Date: Wed, 28 Oct 2026 15:55:00 +0900 Subject: [PATCH] =?UTF-8?q?feat:=20=EC=98=A4=EB=8A=98=20=ED=83=AD=20?= =?UTF-8?q?=EC=95=84=EC=9D=B4=EC=BD=98=20=EC=A4=84=EC=97=90=20=EB=82=A0?= =?UTF-8?q?=EC=94=A8=20=EA=B2=8C=EC=9E=84(/game)=20=EC=97=B0=EA=B2=B0,=20?= =?UTF-8?q?=EC=98=A4=EB=8A=98=20=EC=BD=94=EB=94=94=20=EB=B9=BC=EA=B8=B0,?= =?UTF-8?q?=20=EC=98=A4=EB=8A=98=20=ED=83=80=EB=A1=9C=EB=8A=94=20=EC=9E=A0?= =?UTF-8?q?=EC=8B=9C=20=EC=88=A8=EA=B9=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - feat/weather-game(구름 합치기) 브랜치를 합쳐 아이콘에서 바로 열림 - 오늘 코디 아이콘·창과 그걸 위해 넣은 GET /v1/card/latest 를 걷어냄 - 오늘 타로는 features.ts HIDDEN 으로 숨김 (아이콘 줄·각 모으는 법에서 빠짐, 안내 문구에서도 타로를 뺌) --- backend/crud/card_crud.py | 7 -- backend/router/v1/card/card.py | 12 +--- backend/router/v1/card/protocol.py | 5 -- backend/tests/test_card.py | 12 ---- docs/이벤트_추적.md | 2 +- frontend/src/b/SajuPage.tsx | 2 +- frontend/src/b/Sheets.tsx | 6 +- frontend/src/b/features.ts | 2 + frontend/src/b/level.tsx | 3 +- frontend/src/b/sheetContext.ts | 1 - frontend/src/b/todayIcons.tsx | 67 ++----------------- .../api/client/@tanstack/react-query.gen.ts | 22 +----- shared/api/client/index.ts | 4 +- shared/api/client/sdk.gen.ts | 7 +- shared/api/client/types.gen.ts | 49 -------------- 15 files changed, 18 insertions(+), 183 deletions(-) create mode 100644 frontend/src/b/features.ts diff --git a/backend/crud/card_crud.py b/backend/crud/card_crud.py index 8f39440..887481c 100644 --- a/backend/crud/card_crud.py +++ b/backend/crud/card_crud.py @@ -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 [] diff --git a/backend/router/v1/card/card.py b/backend/router/v1/card/card.py index 8f2dccc..5f0ccd8 100644 --- a/backend/router/v1/card/card.py +++ b/backend/router/v1/card/card.py @@ -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) diff --git a/backend/router/v1/card/protocol.py b/backend/router/v1/card/protocol.py index 0a6b9e5..431f5a3 100644 --- a/backend/router/v1/card/protocol.py +++ b/backend/router/v1/card/protocol.py @@ -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 diff --git a/backend/tests/test_card.py b/backend/tests/test_card.py index bb1cb2e..e660080 100644 --- a/backend/tests/test_card.py +++ b/backend/tests/test_card.py @@ -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 diff --git a/docs/이벤트_추적.md b/docs/이벤트_추적.md index 78e506b..6d13d9b 100644 --- a/docs/이벤트_추적.md +++ b/docs/이벤트_추적.md @@ -52,7 +52,7 @@ GA4 태그(`gtag.js`, 측정 ID `G-D378J4X373`)를 `index.html`에 심고, 화 | `install_banner_close` | '홈 화면에 추가' 띠를 × 로 닫음 | 없음 | `installBanner.tsx` | | `fortune_draw` | 오늘 한 장에서 카드를 뽑음 (하루 한 번, 다시 열 때는 안 보냄) | `card`(각 코드) | `fortune.tsx` `useTodayCard` | | `day_log` | 저녁 체크인을 적어 둠 (고쳐 적어도 보냄). 다녀온 곳 이름은 보내지 않음 | `mood`(1~5), `went_out`, `card_hit`(맞았어요 true·글쎄요 false·안 고름 null) | `fortune.tsx` `useTodayCard` | -| `today_icon` | 오늘 탭 아이콘 줄에서 아이콘을 누름 | `icon`(`tarot`·`saju`·`ootd`·`foliage`·`shorts`·`myGak`·`talk`) | `todayIcons.tsx` `TodayIcons` | +| `today_icon` | 오늘 탭 아이콘 줄에서 아이콘을 누름 | `icon`(`tarot`·`saju`·`game`·`foliage`·`shorts`·`myGak`·`talk`) | `todayIcons.tsx` `TodayIcons` | | `saju_input` | 날씨 사주 생년월일을 넣음 (생년월일 값은 보내지 않음) | `with_time` | `SajuPage.tsx` `BirthForm` | | `saju_view` | 날씨 사주 결과가 뜸 | `scene`(내 기운 이름), `score` | `SajuPage.tsx` `Reading` | diff --git a/frontend/src/b/SajuPage.tsx b/frontend/src/b/SajuPage.tsx index 8ef5f8b..534defa 100644 --- a/frontend/src/b/SajuPage.tsx +++ b/frontend/src/b/SajuPage.tsx @@ -292,7 +292,7 @@ function Locked({ locks }: { locks: SajuLock[] }) {

{loggedIn ? `다음에 열려요: ${next.name}` : '각을 모으면 차례로 열려요'}

- {loggedIn ? `Lv.${next.level}에서 열려요${close ? ` · ${level.next_points! - level.points}각 남았어요` : ''}` : '출석·타로·좋아요로 모은 각은 로그인해야 쌓여요'} + {loggedIn ? `Lv.${next.level}에서 열려요${close ? ` · ${level.next_points! - level.points}각 남았어요` : ''}` : '출석·사주·좋아요로 모은 각은 로그인해야 쌓여요'}