Files
outline/server/queues/tasks/DeleteAttachmentTask.ts
Tom Moor 0f19c550f9 fix: Uploaded and immediately deleted images are not removed from storage (#4562)
* fix: Uploaded and immediately deleted images are not removed from storage upon permanant delete
closes #4557

* Move attachment deletion async
2022-12-11 08:29:38 -08:00

25 lines
475 B
TypeScript

import { Attachment } from "@server/models";
import BaseTask from "./BaseTask";
type Props = {
teamId: string;
attachmentId: string;
};
export default class DeleteAttachmentTask extends BaseTask<Props> {
public async perform({ attachmentId, teamId }: Props) {
const attachment = await Attachment.findOne({
where: {
teamId,
id: attachmentId,
},
});
if (!attachment) {
return;
}
await attachment.destroy();
}
}