updates
This commit is contained in:
@@ -23,8 +23,8 @@ export default defineEventHandler(async (event) => {
|
||||
});
|
||||
}
|
||||
|
||||
// Ensure EOIs folder exists
|
||||
await createBucketIfNotExists('nda-documents');
|
||||
// Ensure bucket exists
|
||||
await createBucketIfNotExists('client-portal');
|
||||
|
||||
// Parse multipart form data
|
||||
const form = formidable({
|
||||
@@ -55,15 +55,17 @@ export default defineEventHandler(async (event) => {
|
||||
// Get content type
|
||||
const contentType = mime.lookup(uploadedFile.originalFilename || '') || 'application/pdf';
|
||||
|
||||
// Upload to MinIO
|
||||
await uploadFile(fileName, fileBuffer, contentType);
|
||||
// Upload to MinIO client-portal bucket
|
||||
const client = getMinioClient();
|
||||
await client.putObject('client-portal', fileName, fileBuffer, fileBuffer.length, {
|
||||
'Content-Type': contentType,
|
||||
});
|
||||
|
||||
// Clean up temp file
|
||||
await fs.unlink(uploadedFile.filepath);
|
||||
|
||||
// Get download URL for the uploaded file
|
||||
const client = getMinioClient();
|
||||
const url = await client.presignedGetObject('nda-documents', fileName, 24 * 60 * 60); // 24 hour expiry
|
||||
const url = await client.presignedGetObject('client-portal', fileName, 24 * 60 * 60); // 24 hour expiry
|
||||
|
||||
// Prepare document data for database
|
||||
const documentData = {
|
||||
|
||||
Reference in New Issue
Block a user