feat: 오늘 탭 아이콘 줄 — 오늘 타로·오늘 코디는 창으로, 단풍 지도·쇼츠·동네 이야기는 페이지로, 내 각은 그 줄로
- 오늘 한 장 칸을 오늘 타로 창으로 옮김. 안 뽑았으면 빨간 점, 뽑았으면 n일째 (로그인 안 하면 기기 기록으로 계산) - 오늘 코디: 오늘 피드에 올린 코디 카드를 창으로 (GET /v1/card/latest?template=ootd), 오늘 처음 보면 빨간 점 - 단풍 지도 아이콘은 단풍철에만, 아이콘 4개 추가 (Fluent 3D) - GA4 today_icon
This commit is contained in:
1 parent
c37773f48f
commit
045d8d6cf0
20 files changed
+347
-70
No files matched your search
@@ -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
|
||||
from router.v1.card.protocol import CardItem, Req_CardCreate, Res_Card, Res_CardList, Res_LatestCard
|
||||
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,6 +82,16 @@ 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)
|
||||
|
||||
@@ -18,6 +18,11 @@ 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
|
||||
|
||||
Reference in new issue
Block a user