2
0

first commit

This commit is contained in:
2024-08-09 00:39:27 +02:00
commit 79688abe2e
5698 changed files with 497838 additions and 0 deletions

View File

@@ -0,0 +1,20 @@
import type { User } from "@prisma/client";
import { deleteStripeCustomer } from "@calcom/app-store/stripepayment/lib/customer";
import { deleteWebUser as syncServicesDeleteWebUser } from "@calcom/lib/sync/SyncServiceManager";
import prisma from "@calcom/prisma";
export async function deleteUser(user: Pick<User, "id" | "email" | "metadata">) {
// If 2FA is disabled or totpCode is valid then delete the user from stripe and database
await deleteStripeCustomer(user).catch(console.warn);
// Remove my account
// TODO: Move this to Repository pattern.
const deletedUser = await prisma.user.delete({
where: {
id: user.id,
},
});
// Sync Services
syncServicesDeleteWebUser(deletedUser);
}