added prismAdapter for lucia

This commit is contained in:
Dan Mihailescu 2024-12-13 10:07:02 -05:00
parent 7ecfb15818
commit 227fe5ae14
5 changed files with 7797 additions and 25 deletions

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

View file

@ -28,4 +28,12 @@ model Post {
published Boolean @default(false) published Boolean @default(false)
author User @relation(fields: [authorId], references: [id]) author User @relation(fields: [authorId], references: [id])
authorId Int authorId Int
} }
model Session {
id String @id
userId String
expiresAt DateTime
user User @relation(references: [id], fields: [userId], onDelete: Cascade)
}