🐛 Check for user exists before merging (#1626)

This commit is contained in:
Luke Vella 2025-03-10 10:48:20 +00:00 committed by GitHub
parent 4dbf992055
commit 8a192f74a1
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -6,6 +6,17 @@ export const mergeGuestsIntoUser = async (
userId: string,
guestIds: string[],
) => {
const count = await prisma.user.count({
where: {
id: userId,
},
});
if (count === 0) {
console.warn(`User ${userId} not found`);
return;
}
try {
await prisma.$transaction(async (tx) => {
await Promise.all([