mirror of
https://github.com/outline/outline.git
synced 2026-12-03 01:59:03 +03:00
* refactor: Add jobId hook to BaseTask for deduplicating queued jobs * fix: Drop jobId from APIImportTask, it re-schedules itself while active
30 lines
707 B
TypeScript
30 lines
707 B
TypeScript
import teamPermanentDeleter from "@server/commands/teamPermanentDeleter";
|
|
import { Team } from "@server/models";
|
|
import { BaseTask, TaskPriority } from "./base/BaseTask";
|
|
|
|
type Props = {
|
|
/** The team ID to permanantly destroy */
|
|
teamId: string;
|
|
};
|
|
|
|
export default class CleanupDeletedTeamTask extends BaseTask<Props> {
|
|
protected jobId({ teamId }: Props) {
|
|
return `cleanup-team:${teamId}`;
|
|
}
|
|
|
|
public async perform({ teamId }: Props) {
|
|
const team = await Team.findByPk(teamId, {
|
|
paranoid: false,
|
|
rejectOnEmpty: true,
|
|
});
|
|
await teamPermanentDeleter(team);
|
|
}
|
|
|
|
public get options() {
|
|
return {
|
|
attempts: 1,
|
|
priority: TaskPriority.Background,
|
|
};
|
|
}
|
|
}
|