Skip to content

Commit

Permalink
Merge pull request #4 from a-zzura/fix/prisma
Browse files Browse the repository at this point in the history
fix(basic-api/prisma): missing where clause
  • Loading branch information
pilcrowonpaper authored Oct 14, 2024
2 parents e7a48f4 + 46a76b1 commit be23924
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 be23924

Please sign in to comment.