Skip to content

Commit

Permalink
Convert update statement into unique select in getServerSession
Browse files Browse the repository at this point in the history
  • Loading branch information
emrysal committed Dec 12, 2024
1 parent 2ace1d1 commit e366c10
Showing 1 changed file with 4 additions and 10 deletions.
14 changes: 4 additions & 10 deletions packages/features/auth/lib/getServerSession.ts
Original file line number Diff line number Diff line change
Expand Up @@ -55,16 +55,10 @@ export async function getServerSession(options: {
}

const email = token.email.toLowerCase();
const userFromDb = await prisma.user
.update({
where: { email },
data: { lastActiveAt: new Date() },
})
.catch((error) => {
console.error(error);
log.debug("No user found for email: ", email);
return null;
});

const userFromDb = await prisma.user.findUnique({
where: { email },
});

if (!userFromDb) {
log.debug("No user found");
Expand Down

0 comments on commit e366c10

Please sign in to comment.