From d68bfd45b2c3ccbfd61750af90f07224926224de Mon Sep 17 00:00:00 2001 From: Hyungi Ahn Date: Wed, 3 Sep 2025 18:48:13 +0900 Subject: [PATCH] =?UTF-8?q?Fix:=20=EB=A7=81=ED=81=AC=20=EA=B8=B0=EB=8A=A5?= =?UTF-8?q?=20=EB=94=94=EB=B2=84=EA=B9=85=20=EB=B0=8F=20=EB=9D=BC=EC=9A=B0?= =?UTF-8?q?=ED=84=B0=20=EB=93=B1=EB=A1=9D=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - document_links 라우터를 /api 경로에도 추가 등록 (링크 삭제 호환성) - 노트 검색 실패 시 상세한 디버깅 로그 추가 - 존재하는 노트 목록 출력으로 문제 원인 파악 --- backend/src/api/routes/document_links.py | 13 ++++++++++++- backend/src/main.py | 2 ++ 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/backend/src/api/routes/document_links.py b/backend/src/api/routes/document_links.py index 44401ea..a8cbb71 100644 --- a/backend/src/api/routes/document_links.py +++ b/backend/src/api/routes/document_links.py @@ -122,11 +122,22 @@ async def create_document_link( target_note = None if not target_doc: # 문서에서 찾지 못하면 노트에서 찾기 + print(f"🔍 문서에서 찾지 못함, 노트에서 검색: {link_data.target_document_id}") from models.note_document import NoteDocument result = await db.execute(select(NoteDocument).where(NoteDocument.id == link_data.target_document_id)) target_note = result.scalar_one_or_none() - if not target_note: + if target_note: + print(f"✅ 노트 찾음: {target_note.title}") + else: + print(f"❌ 노트도 찾지 못함: {link_data.target_document_id}") + # 디버깅: 실제 존재하는 노트들 확인 + all_notes_result = await db.execute(select(NoteDocument).limit(5)) + all_notes = all_notes_result.scalars().all() + print(f"🔍 존재하는 노트 예시 (최대 5개):") + for note in all_notes: + print(f" - ID: {note.id}, 제목: {note.title}") + raise HTTPException( status_code=status.HTTP_404_NOT_FOUND, detail="Target document or note not found" diff --git a/backend/src/main.py b/backend/src/main.py index 829f711..918ef94 100644 --- a/backend/src/main.py +++ b/backend/src/main.py @@ -55,6 +55,8 @@ app.include_router(bookmarks.router, prefix="/api/bookmarks", tags=["책갈피"] app.include_router(search.router, prefix="/api/search", tags=["검색"]) app.include_router(memo_trees.router, prefix="/api", tags=["트리 메모장"]) app.include_router(document_links.router, prefix="/api/documents", tags=["문서 링크"]) +# 링크 삭제를 위한 추가 라우터 (document-links 경로 지원) +app.include_router(document_links.router, prefix="/api", tags=["문서 링크 (호환성)"]) app.include_router(note_documents.router, prefix="/api/note-documents", tags=["노트 문서"]) app.include_router(note_links.router, prefix="/api", tags=["노트 링크"]) app.include_router(notebooks.router, prefix="/api/notebooks", tags=["노트북"])