mirror of
https://github.com/bigcapitalhq/bigcapital.git
synced 2026-02-18 13:50:31 +00:00
feat: getting presigned url of the uploaded attachment
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user