From cdcbb07561072018543adf6375e497702cd9c216 Mon Sep 17 00:00:00 2001 From: Hyungi Ahn Date: Thu, 9 Apr 2026 08:31:51 +0900 Subject: [PATCH] =?UTF-8?q?fix(inbox):=20page=5Fsize=3D200=20=E2=86=92=204?= =?UTF-8?q?22=20=ED=95=B4=EA=B2=B0,=20review=5Fstatus=20=EC=84=9C=EB=B2=84?= =?UTF-8?q?=20=ED=95=84=ED=84=B0=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Inbox 페이지가 /documents/?page_size=200 를 호출하는데 백엔드 Query 가 le=100 이라 422 발생 — Phase 2 첫 commit(2026-04-02)부터 dormant 버그. inbox 코드 안에 'TODO(backend): review_status filter 지원 시 page_size 축소' 주석이 있던 상태. backend: - list_documents 에 review_status: str | None Query 파라미터 추가 - WHERE 절에 review_status 매칭 분기 추가 frontend: - /documents/?review_status=pending&page_size=100 으로 변경 - 클라이언트 필터링 코드 제거 (서버 필터로 대체) 100 미만 안전. pending 이 100 넘으면 다음 페이지 로직 추가 필요 (별도 작업). --- app/api/documents.py | 3 +++ frontend/src/routes/inbox/+page.svelte | 6 +++--- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/app/api/documents.py b/app/api/documents.py index 701f664..ef19327 100644 --- a/app/api/documents.py +++ b/app/api/documents.py @@ -147,6 +147,7 @@ async def list_documents( sub_group: str | None = None, source: str | None = None, format: str | None = None, + review_status: str | None = Query(None, description="pending | approved | rejected"), ): """문서 목록 조회 (페이지네이션 + 필터, 뉴스 제외)""" query = select(Document).where(Document.deleted_at == None, Document.source_channel != "news") @@ -158,6 +159,8 @@ async def list_documents( query = query.where(Document.source_channel == source) if format: query = query.where(Document.file_format == format) + if review_status: + query = query.where(Document.review_status == review_status) # 전체 건수 count_query = select(func.count()).select_from(query.subquery()) diff --git a/frontend/src/routes/inbox/+page.svelte b/frontend/src/routes/inbox/+page.svelte index 4c2156d..ff19ba2 100644 --- a/frontend/src/routes/inbox/+page.svelte +++ b/frontend/src/routes/inbox/+page.svelte @@ -59,9 +59,9 @@ async function loadInbox() { loading = true; try { - // TODO(backend): /documents/?review_status=pending 서버 필터 지원 시 page_size 축소 - const data = await api('/documents/?page_size=200'); - documents = (data.items || []).filter((d) => d.review_status === 'pending'); + // 서버 필터 review_status=pending 적용 — page_size 100 이내 안전 + const data = await api('/documents/?review_status=pending&page_size=100'); + documents = data.items || []; } catch (err) { addToast('error', 'Inbox 로딩 실패'); } finally {