This commit is contained in:
2025-06-10 16:48:40 +02:00
parent 49aa47ab10
commit 839b307edd
8 changed files with 473 additions and 57 deletions

View File

@@ -107,7 +107,16 @@ export default defineEventHandler(async (event) => {
// Update interest with EOI document information
console.log('[EOI Upload] Updating interest with EOI document info');
await updateInterestEOIDocument(interestId, documentData);
console.log('[EOI Upload] Document data:', JSON.stringify(documentData, null, 2));
try {
await updateInterestEOIDocument(interestId, documentData);
console.log('[EOI Upload] Successfully updated EOI document in database');
} catch (dbError: any) {
console.error('[EOI Upload] Failed to update database with EOI document:', dbError);
console.error('[EOI Upload] Database error details:', dbError.data || dbError.message);
throw new Error(`Failed to update database: ${dbError.message}`);
}
// Update the status fields for uploaded (signed) EOI
const updateData: any = {
@@ -116,18 +125,26 @@ export default defineEventHandler(async (event) => {
'Sales Process Level': 'Signed LOI and NDA'
};
console.log('[EOI Upload] Updating interest status fields for signed EOI');
console.log('[EOI Upload] Status update data:', JSON.stringify(updateData, null, 2));
// Update the interest
await $fetch('/api/update-interest', {
method: 'POST',
headers: {
'x-tag': xTagHeader,
},
body: {
id: interestId,
data: updateData
}
});
try {
// Update the interest
await $fetch('/api/update-interest', {
method: 'POST',
headers: {
'x-tag': xTagHeader,
},
body: {
id: interestId,
data: updateData
}
});
console.log('[EOI Upload] Successfully updated interest status');
} catch (statusError: any) {
console.error('[EOI Upload] Failed to update interest status:', statusError);
console.error('[EOI Upload] Status error details:', statusError.data || statusError.message);
// Don't throw here - the file was uploaded successfully
}
console.log('[EOI Upload] Upload completed successfully');
return {