Skip to content

Commit

Permalink
fix missing where clause
Browse files Browse the repository at this point in the history
  • Loading branch information
a-zzura authored Oct 12, 2024
1 parent 9c22a51 commit 46a76b1
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions pages/sessions/basic-api/prisma.md
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ export async function validateSessionToken(token: string): Promise<SessionValida
}
const { user, ...session } = result;
if (Date.now() >= session.expiresAt.getTime()) {
await prisma.session.delete(sessionId);
await prisma.session.delete({ where: { id: sessionId } });
return { session: null, user: null };
}
if (Date.now() >= session.expiresAt.getTime() - 1000 * 60 * 60 * 24 * 15) {
Expand Down Expand Up @@ -214,7 +214,7 @@ export async function validateSessionToken(token: string): Promise<SessionValida
}
const { user, ...session } = result;
if (Date.now() >= session.expiresAt.getTime()) {
await prisma.session.delete(sessionId);
await prisma.session.delete({ where: { id: sessionId } });
return { session: null, user: null };
}
if (Date.now() >= session.expiresAt.getTime() - 1000 * 60 * 60 * 24 * 15) {
Expand All @@ -232,7 +232,7 @@ export async function validateSessionToken(token: string): Promise<SessionValida
}

export async function invalidateSession(sessionId: string): void {
await db.session.delete(sessionId);
await db.session.delete({ where: { id: sessionId } });
}

export type SessionValidationResult =
Expand Down

0 comments on commit 46a76b1

Please sign in to comment.