feat: 지역 카드 좋아요·댓글을 시도 단위로 나눔 (계절·상식·한 문장·달은 전국)

This commit is contained in:
minaChoi committed 2026-10-08 09:33:04 +09:00
1 parent dddd52475e
commit 90c4a36c25
9 files changed
+175 -25

No files matched your search

+5 -5
View File
@@ -9,13 +9,13 @@ from common.database.model.models import Post
class FeedCRUD:
async def day(self, s: AsyncSession, day: date) -> list[Post]:
stmt = select(Post).where(Post.feed_date == day, Post.deleted.is_(False)).order_by(Post.position)
async def day(self, s: AsyncSession, day: date, scopes: list[str]) -> list[Post]:
stmt = select(Post).where(Post.feed_date == day, Post.scope.in_(scopes), Post.deleted.is_(False)).order_by(Post.position, Post.scope)
return list((await s.scalars(stmt)).all())
async def positions(self, s: AsyncSession, day: date) -> set[int]:
"""그날 이미 만든 카드 번호. 지운 카드도 넣어 다시 만들지 않게 한다."""
return set((await s.scalars(select(Post.position).where(Post.feed_date == day))).all())
async def positions(self, s: AsyncSession, day: date) -> set[tuple[str, int]]:
"""그날 이미 만든 (scope, 카드 번호). 지운 카드도 넣어 다시 만들지 않게 한다."""
return {(scope, pos) for scope, pos in (await s.execute(select(Post.scope, Post.position).where(Post.feed_date == day))).all()}
async def insert_day(self, s: AsyncSession, rows: list[dict]) -> None:
if rows: