firefish/packages/backend/src/services/delete-account.ts

24 lines
604 B
TypeScript
Raw Normal View History

2023-07-20 04:17:05 +09:00
import { Users } from "@/models/index.js";
import { createDeleteAccountJob } from "@/queue/index.js";
2023-11-17 06:01:31 +09:00
import { publishUserEvent } from "@/services/stream.js";
import { doPostSuspend } from "@/services/suspend-user.js";
2023-07-20 04:17:05 +09:00
export async function deleteAccount(user: {
id: string;
host: string | null;
}): Promise<void> {
// 物理削除する前にDelete activityを送信する
await doPostSuspend(user).catch((e) => {});
createDeleteAccountJob(user, {
soft: false,
});
await Users.update(user.id, {
isDeleted: true,
});
// Terminate streaming
publishUserEvent(user.id, "terminate", {});
}