diff --git a/backend/src/api/routes/documents.py b/backend/src/api/routes/documents.py index 57521da..dc79d7d 100644 --- a/backend/src/api/routes/documents.py +++ b/backend/src/api/routes/documents.py @@ -802,13 +802,14 @@ async def update_document( created_at=document.created_at, updated_at=document.updated_at, document_date=document.document_date, - uploader_name=document.uploader.full_name or document.uploader.email, + uploader_name=document.uploader.full_name or document.uploader.email if document.uploader else "Unknown", tags=[tag.name for tag in document.tags], book_id=str(document.book.id) if document.book else None, book_title=document.book.title if document.book else None, book_author=document.book.author if document.book else None, sort_order=document.sort_order, - matched_pdf_id=str(document.matched_pdf_id) if document.matched_pdf_id else None + matched_pdf_id=str(document.matched_pdf_id) if document.matched_pdf_id else None, + original_filename=document.original_filename ) diff --git a/frontend/static/js/book-editor.js b/frontend/static/js/book-editor.js index 371d1eb..d54441e 100644 --- a/frontend/static/js/book-editor.js +++ b/frontend/static/js/book-editor.js @@ -206,24 +206,33 @@ window.bookEditorApp = () => ({ if (this.saving) return; this.saving = true; + console.log('πŸ’Ύ μ €μž₯ μ‹œμž‘...'); try { // μ„œμ  정보 μ—…λ°μ΄νŠΈ + console.log('πŸ“š μ„œμ  정보 μ—…λ°μ΄νŠΈ 쀑...'); await window.api.updateBook(this.bookId, { title: this.bookInfo.title, author: this.bookInfo.author, description: this.bookInfo.description }); + console.log('βœ… μ„œμ  정보 μ—…λ°μ΄νŠΈ μ™„λ£Œ'); // 각 λ¬Έμ„œμ˜ μˆœμ„œμ™€ PDF λ§€μΉ­ 정보 μ—…λ°μ΄νŠΈ - const updatePromises = this.documents.map(doc => { + console.log('πŸ“„ λ¬Έμ„œ μ—…λ°μ΄νŠΈ μ‹œμž‘...'); + const updatePromises = this.documents.map((doc, index) => { + console.log(`πŸ“„ λ¬Έμ„œ ${index + 1}/${this.documents.length}: ${doc.title}`); + console.log(` - sort_order: ${doc.sort_order}`); + console.log(` - matched_pdf_id: ${doc.matched_pdf_id || 'null'}`); + return window.api.updateDocument(doc.id, { sort_order: doc.sort_order, matched_pdf_id: doc.matched_pdf_id || null }); }); - await Promise.all(updatePromises); + const results = await Promise.all(updatePromises); + console.log('βœ… λͺ¨λ“  λ¬Έμ„œ μ—…λ°μ΄νŠΈ μ™„λ£Œ:', results.length, '개'); console.log('βœ… λͺ¨λ“  변경사항 μ €μž₯ μ™„λ£Œ'); this.showNotification('변경사항이 μ €μž₯λ˜μ—ˆμŠ΅λ‹ˆλ‹€', 'success'); @@ -234,7 +243,7 @@ window.bookEditorApp = () => ({ }, 1500); } catch (error) { - console.error('μ €μž₯ μ‹€νŒ¨:', error); + console.error('❌ μ €μž₯ μ‹€νŒ¨:', error); this.showNotification('μ €μž₯에 μ‹€νŒ¨ν–ˆμŠ΅λ‹ˆλ‹€: ' + error.message, 'error'); } finally { this.saving = false;