Files
outline/server/queues/tasks/DeleteAttachmentTask.ts
Tom Moor 79cbe304da fix: Allow viewers to upload avatar (#4349)
* fix: Allow viewers to upload avatar

* DeleteAttachmentTask

* fix: Previous avatar should be deleted on change, if possible

* fix: Also cleanup team logo on change
2022-10-29 06:08:20 -07:00

18 lines
388 B
TypeScript

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