mirror of
https://github.com/bigcapitalhq/bigcapital.git
synced 2026-02-18 13:50:31 +00:00
feat: wip upload documents
This commit is contained in:
19
packages/server/src/services/Attachments/DeleteAttachment.ts
Normal file
19
packages/server/src/services/Attachments/DeleteAttachment.ts
Normal file
@@ -0,0 +1,19 @@
|
||||
import { DeleteObjectCommand } from '@aws-sdk/client-s3';
|
||||
import { s3 } from '@/lib/S3/S3';
|
||||
import { Service } from 'typedi';
|
||||
|
||||
@Service()
|
||||
export class DeleteAttachment {
|
||||
/**
|
||||
* Deletes the give file attachment file key.
|
||||
* @param {number} tenantId
|
||||
* @param {string} filekey
|
||||
*/
|
||||
async delete(tenantId: number, filekey: string): Promise<void> {
|
||||
const params = {
|
||||
Bucket: process.env.AWS_BUCKET,
|
||||
Key: filekey,
|
||||
};
|
||||
await s3.send(new DeleteObjectCommand(params));
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user