mirror of
https://github.com/bigcapitalhq/bigcapital.git
synced 2026-02-17 21:30:31 +00:00
feat: wip upload documents
This commit is contained in:
21
packages/server/src/services/Attachments/GetAttachment.ts
Normal file
21
packages/server/src/services/Attachments/GetAttachment.ts
Normal 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;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user