From 5bfa3822ca00de868dc1cb779e70d04563a46228 Mon Sep 17 00:00:00 2001 From: Hyungi Ahn Date: Mon, 25 Aug 2025 07:27:24 +0900 Subject: [PATCH] =?UTF-8?q?fix:=20=ED=95=98=EC=9D=B4=EB=9D=BC=EC=9D=B4?= =?UTF-8?q?=ED=8A=B8/=EB=A9=94=EB=AA=A8=20API=20=EC=98=A4=EB=A5=98=20?= =?UTF-8?q?=EB=B0=8F=20=ED=94=8C=EB=A1=9C=ED=8C=85=20=EB=A9=94=EB=AA=A8?= =?UTF-8?q?=EC=B0=BD=20=EB=AC=B8=EC=A0=9C=20=ED=95=B4=EA=B2=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ๐Ÿ› ๋ฒ„๊ทธ ์ˆ˜์ •: - InstrumentedList ์˜ค๋ฅ˜ ํ•ด๊ฒฐ: highlight.notes ๋ฆฌ์ŠคํŠธ ์ ‘๊ทผ ๋ฐฉ์‹ ์ˆ˜์ • - this.filterMemos ํ•จ์ˆ˜ ์Šค์ฝ”ํ”„ ์˜ค๋ฅ˜ ํ•ด๊ฒฐ: this ์ปจํ…์ŠคํŠธ ์•ˆ์ „ ์ฒ˜๋ฆฌ - ํ•˜์ด๋ผ์ดํŠธ API์—์„œ ๋ฉ”๋ชจ ๊ด€๊ณ„ ๋กœ๋”ฉ ์ถ”๊ฐ€ (selectinload) - ํ”Œ๋กœํŒ… ๋ฉ”๋ชจ์ฐฝ showFloatingMemo ๋ณ€์ˆ˜ ์ธ์‹ ๋ฌธ์ œ ํ•ด๊ฒฐ ๐Ÿ› ๏ธ ๊ฐœ์„ ์‚ฌํ•ญ: - ์•ˆ์ „ํ•œ ํ•จ์ˆ˜ ํ˜ธ์ถœ: typeof ์ฒดํฌ ๋ฐ ๋Œ€์ฒด ๋กœ์ง ์ถ”๊ฐ€ - ํ•˜์ด๋ผ์ดํŠธ ์‘๋‹ต์— ์—ฐ๊ด€๋œ ๋ฉ”๋ชจ ๋ฐ์ดํ„ฐ ํฌํ•จ - ์บ์‹œ ๋ฒ„์ŠคํŒ… ๋ฒ„์ „ ์—…๋ฐ์ดํŠธ (v2025012227) - ๋””๋ฒ„๊น… ๋กœ๊ทธ ์ถ”๊ฐ€๋กœ ๋ฌธ์ œ ์ง„๋‹จ ๊ฐœ์„  โœ… ๊ฒฐ๊ณผ: - ํ•˜์ด๋ผ์ดํŠธ์™€ ๋ฉ”๋ชจ๊ฐ€ ์ •์ƒ์ ์œผ๋กœ ํ‘œ์‹œ๋จ - ํ”Œ๋กœํŒ… ๋ฉ”๋ชจ์ฐฝ์ด ์˜ฌ๋ฐ”๋ฅด๊ฒŒ ์ž‘๋™ํ•จ - API 500 ์˜ค๋ฅ˜ ํ•ด๊ฒฐ๋กœ ๋ฐ์ดํ„ฐ ์•ˆ์ „์„ฑ ํ™•๋ณด --- backend/src/api/routes/highlights.py | 16 ++++++++++++++-- frontend/hierarchy.html | 20 +++++++++++++++----- frontend/static/js/hierarchy.js | 19 +++++++++++++------ 3 files changed, 42 insertions(+), 13 deletions(-) diff --git a/backend/src/api/routes/highlights.py b/backend/src/api/routes/highlights.py index 4386983..322eecb 100644 --- a/backend/src/api/routes/highlights.py +++ b/backend/src/api/routes/highlights.py @@ -173,9 +173,10 @@ async def get_document_highlights( detail="Not enough permissions to access this document" ) - # ์‚ฌ์šฉ์ž์˜ ํ•˜์ด๋ผ์ดํŠธ๋งŒ ์กฐํšŒ + # ์‚ฌ์šฉ์ž์˜ ํ•˜์ด๋ผ์ดํŠธ๋งŒ ์กฐํšŒ (์—ฐ๊ด€๋œ ๋ฉ”๋ชจ๋„ ํ•จ๊ป˜ ๋กœ๋“œ) result = await db.execute( select(Highlight) + .options(selectinload(Highlight.notes)) # ๋ฉ”๋ชจ ๊ด€๊ณ„ ๋กœ๋“œ .where( and_( Highlight.document_id == document_id, @@ -191,6 +192,17 @@ async def get_document_highlights( # ์‘๋‹ต ๋ฐ์ดํ„ฐ ๋ณ€ํ™˜ response_data = [] for highlight in highlights: + # ์—ฐ๊ด€๋œ ๋ฉ”๋ชจ ์ •๋ณด ํฌํ•จ (notes๋Š” ๋ฆฌ์ŠคํŠธ์ด๋ฏ€๋กœ ์ฒซ ๋ฒˆ์งธ ๋ฉ”๋ชจ ์‚ฌ์šฉ) + note_data = None + if highlight.notes and len(highlight.notes) > 0: + first_note = highlight.notes[0] # ์ฒซ ๋ฒˆ์งธ ๋ฉ”๋ชจ ์‚ฌ์šฉ + note_data = { + "id": str(first_note.id), + "content": first_note.content, + "created_at": first_note.created_at.isoformat(), + "updated_at": first_note.updated_at.isoformat() if first_note.updated_at else None + } + highlight_data = HighlightResponse( id=str(highlight.id), user_id=str(highlight.user_id), @@ -205,7 +217,7 @@ async def get_document_highlights( highlight_type=highlight.highlight_type, created_at=highlight.created_at, updated_at=highlight.updated_at, - note=None + note=note_data ) response_data.append(highlight_data) diff --git a/frontend/hierarchy.html b/frontend/hierarchy.html index 4b738c7..9eb22b7 100644 --- a/frontend/hierarchy.html +++ b/frontend/hierarchy.html @@ -380,7 +380,7 @@