Skip to content

Commit

Permalink
add sanity check that primary user was not deleted when merging profi…
Browse files Browse the repository at this point in the history
…els (#4855)
  • Loading branch information
mattcasey authored Oct 21, 2024
1 parent 239f7e1 commit 6e9ceb5
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions lib/users/mergeProfiles.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,13 @@ export async function mergeProfiles({
id: primaryProfileId
},
select: {
deletedAt: true,
spaceRoles: true
}
});
if (primary.deletedAt) {
throw new Error('Primary profile is already deleted');
}

const secondary = await prisma.user.findUniqueOrThrow({
where: {
Expand Down

0 comments on commit 6e9ceb5

Please sign in to comment.