Fix file upload errors and improve error handling

- Fix uploadAttachments method to use proper SupabaseHelper methods
- Add addFileAttachment method for proper database insertion
- Improve error handling with detailed logging and user feedback
- Add file upload progress tracking and cleanup on failure
- Fix direct supabase variable access issues
- Better error messages for users and developers

Bug fixes:
• File upload now works properly with Supabase Storage
• Database insertion errors are properly handled
• Failed uploads are cleaned up automatically
• More informative error messages displayed to users

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
2025-08-19 14:08:28 +09:00
parent 7bae9abe28
commit a0efe6f637
2 changed files with 100 additions and 16 deletions

View File

@@ -214,6 +214,23 @@ const SupabaseHelper = {
.remove([filePath]);
if (error) throw error;
},
// 첨부파일 정보 추가
async addFileAttachment(fileId, attachmentData) {
if (!supabase) throw new Error('Supabase가 초기화되지 않았습니다.');
const { data, error } = await supabase
.from('file_attachments')
.insert([{
file_id: fileId,
...attachmentData
}])
.select()
.single();
if (error) throw error;
return data;
}
};