feat: getting presigned url of the uploaded attachment

This commit is contained in:
Ahmed Bouhuolia
2024-05-29 16:16:08 +02:00
parent e7871e34a9
commit ceb133e29a
7 changed files with 124 additions and 17 deletions

View File

@@ -6,12 +6,20 @@ export class UploadDocument {
@Inject()
private tenancy: HasTenancyService;
/**
* Inserts the document metadata.
* @param {number} tenantId
* @param {} file
* @returns {}
*/
async upload(tenantId: number, file: any) {
const { Document } = this.tenancy.models(tenantId);
const insertedDocument = await Document.query().insert({
key: file.key,
extension: file.mimetype,
mimeType: file.mimetype,
size: file.size,
originName: file.originalname,
});
return insertedDocument;
}