Fix: PDF 매칭 저장 기능 수정

- 백엔드 문서 업데이트 API에서 DocumentResponse 생성자 수정
- original_filename 필드 추가로 PDF 매칭 정보 제대로 반환
- uploader 필드 null 체크 추가
- 프론트엔드 저장 과정에 상세 디버깅 로그 추가
- PDF 매칭 정보와 순서 저장 과정 로그 추가
This commit is contained in:
Hyungi Ahn
2025-09-03 18:10:42 +09:00
parent b5602cbf44
commit 8f12eb4f76
2 changed files with 15 additions and 5 deletions

View File

@@ -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;