fix: call db hooks when calling deleteUser (#5553)

This commit is contained in:
Maxwell
2025-10-24 19:04:10 +00:00
committed by GitHub
parent 0aeff90ab3
commit 216dcdef78
2 changed files with 6 additions and 6 deletions
@@ -526,7 +526,6 @@ export const deleteUser = createAuthEndpoint(
}
await ctx.context.internalAdapter.deleteUser(session.user.id);
await ctx.context.internalAdapter.deleteSessions(session.user.id);
await ctx.context.internalAdapter.deleteAccounts(session.user.id);
deleteSessionCookie(ctx);
const afterDelete = ctx.context.options.user.deleteUser?.afterDelete;
if (afterDelete) {
@@ -236,16 +236,17 @@ export const createInternalAdapter = (
undefined,
);
}
await (await getCurrentAdapter(adapter)).deleteMany({
model: "account",
where: [
await deleteManyWithHooks(
[
{
field: "userId",
value: userId,
},
],
});
"account",
undefined,
);
await deleteWithHooks(
[
{