feat: wip upload documents

This commit is contained in:
Ahmed Bouhuolia
2024-05-24 14:28:21 +02:00
parent 1227111fae
commit c8f31f33be
13 changed files with 6353 additions and 6211 deletions

View File

@@ -0,0 +1,21 @@
import { Service } from 'typedi';
import { s3 } from '@/lib/S3/S3';
import { GetObjectCommand } from '@aws-sdk/client-s3';
@Service()
export class GetAttachment {
/**
* Retrieves data of the given document key.
* @param {number} tenantId
* @param {string} filekey
*/
async getAttachment(tenantId: number, filekey: string) {
const params = {
Bucket: process.env.AWS_BUCKET,
Key: filekey,
};
const data = await s3.send(new GetObjectCommand(params));
return data;
}
}