Lucia Authentication #8

Merged
DanMihailescu merged 18 commits from undoPretty into master 2024-12-19 20:06:45 -05:00
5 changed files with 7797 additions and 25 deletions
Showing only changes of commit 227fe5ae14 - Show all commits

BIN
bun.lockb

Binary file not shown.

12
lucia.ts Normal file
View file

@ -0,0 +1,12 @@
import { Lucia } from "lucia";
import { PrismaAdapter } from "@lucia-auth/adapter-prisma";
import { PrismaClient } from "@prisma/client";
const client = new PrismaClient();
const adapter = new PrismaAdapter(client.session, client.user)
// expect error (see next section)
export const auth = new Lucia({
});
export type Auth = typeof auth;

7795
package-lock.json generated

File diff suppressed because it is too large Load diff

View file

@ -50,17 +50,20 @@
"vitest": "^2.0.4"
},
"dependencies": {
"@lucia-auth/adapter-prisma": "^4.0.1",
"@pothos/core": "^4.3.0",
"@pothos/plugin-prisma": "^4.4.0",
"@prisma/client": "6.0.1",
"@supabase/supabase-js": "^2.47.6",
"@tailwindcss/typography": "^0.5.15",
"@types/bun": "^1.1.14",
"graphql": "^16.9.0",
"graphql-yoga": "^5.10.4",
"lucia": "^3.2.2",
"oslo": "^1.2.1",
"pino": "^9.5.0",
"pino-pretty": "^13.0.0",
"storybook-dark-mode": "^4.0.2",
"zod": "^3.24.0"
}
}
}

View file

@ -28,4 +28,12 @@ model Post {
published Boolean @default(false)
author User @relation(fields: [authorId], references: [id])
authorId Int
}
}
model Session {
id String @id
userId String
expiresAt DateTime
BenjaminPalko commented 2024-12-17 14:10:51 -05:00 (Migrated from github.com)
Review

NIT: references and fields is backwards from how post shows it, can we keep them consistent

NIT: references and fields is backwards from how post shows it, can we keep them consistent
user User @relation(references: [id], fields: [userId], onDelete: Cascade)
}