Files
outline/server/queues/tasks/DeleteAttachmentTask.ts
Tom Moor 42959d66db chore: Add cron task partitioning (#10736)
* wip

* Implementation complete

* tidying

* test

* Address feedback

* Remove duplicative retry logic from UpdateDocumentsPopularityScoreTask.
Now that we're split across many runs this is not neccessary

* Refactor to subclass, config to instance

* Refactor BaseTask to named export

* fix: Missing partition

* tsc

* Feedback
2025-11-27 16:57:52 +01:00

31 lines
589 B
TypeScript

import { Attachment } from "@server/models";
import { BaseTask, TaskPriority } from "./base/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();
}
public get options() {
return {
priority: TaskPriority.Background,
};
}
}