Skip to content

Commit 073e4d2

Browse files
authored
Merge pull request #9 from deploy-cat/feature/github-oauth
Implement github oauth
2 parents 68ac092 + af72037 commit 073e4d2

34 files changed

+757
-370
lines changed

package-lock.json

Lines changed: 214 additions & 87 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,12 +12,14 @@
1212
"@types/node": "^20.10.1"
1313
},
1414
"dependencies": {
15+
"@auth/core": "^0.35.0",
16+
"@auth/prisma-adapter": "^2.5.2",
1517
"@deploy-cat/heroicons-solid": "^2.1.1",
1618
"@kubernetes/client-node": "^0.18.1",
1719
"@prisma/client": "^5.19.1",
18-
"@solidjs/router": "^0.14.1",
20+
"@solid-mediakit/auth": "^2.1.3",
21+
"@solidjs/router": "^0.13.1",
1922
"@solidjs/start": "^1.0.6",
20-
"@supabase/supabase-js": "^2.39.3",
2123
"autoprefixer": "^10.4.14",
2224
"chart.js": "^4.4.4",
2325
"color-hash": "^2.0.2",
@@ -31,9 +33,8 @@
3133
"solid-echarts": "^0.0.4",
3234
"solid-js": "^1.8.18",
3335
"solid-monaco": "^0.2.0",
34-
"solid-supabase": "^0.5.0",
3536
"tailwindcss": "^3.3.3",
36-
"vinxi": "^0.4.1",
37+
"vinxi": "^0.3.10",
3738
"zod": "^3.23.8"
3839
},
3940
"engines": {
Lines changed: 81 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,81 @@
1+
-- CreateTable
2+
CREATE TABLE "User" (
3+
"id" TEXT NOT NULL,
4+
"name" TEXT,
5+
"email" TEXT NOT NULL,
6+
"emailVerified" TIMESTAMP(3),
7+
"image" TEXT,
8+
"createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
9+
"updatedAt" TIMESTAMP(3) NOT NULL,
10+
11+
CONSTRAINT "User_pkey" PRIMARY KEY ("id")
12+
);
13+
14+
-- CreateTable
15+
CREATE TABLE "Account" (
16+
"userId" TEXT NOT NULL,
17+
"type" TEXT NOT NULL,
18+
"provider" TEXT NOT NULL,
19+
"providerAccountId" TEXT NOT NULL,
20+
"refresh_token" TEXT,
21+
"access_token" TEXT,
22+
"expires_at" INTEGER,
23+
"token_type" TEXT,
24+
"scope" TEXT,
25+
"id_token" TEXT,
26+
"session_state" TEXT,
27+
"createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
28+
"updatedAt" TIMESTAMP(3) NOT NULL,
29+
30+
CONSTRAINT "Account_pkey" PRIMARY KEY ("provider","providerAccountId")
31+
);
32+
33+
-- CreateTable
34+
CREATE TABLE "Session" (
35+
"sessionToken" TEXT NOT NULL,
36+
"userId" TEXT NOT NULL,
37+
"expires" TIMESTAMP(3) NOT NULL,
38+
"createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
39+
"updatedAt" TIMESTAMP(3) NOT NULL
40+
);
41+
42+
-- CreateTable
43+
CREATE TABLE "VerificationToken" (
44+
"identifier" TEXT NOT NULL,
45+
"token" TEXT NOT NULL,
46+
"expires" TIMESTAMP(3) NOT NULL,
47+
48+
CONSTRAINT "VerificationToken_pkey" PRIMARY KEY ("identifier","token")
49+
);
50+
51+
-- CreateTable
52+
CREATE TABLE "Authenticator" (
53+
"credentialID" TEXT NOT NULL,
54+
"userId" TEXT NOT NULL,
55+
"providerAccountId" TEXT NOT NULL,
56+
"credentialPublicKey" TEXT NOT NULL,
57+
"counter" INTEGER NOT NULL,
58+
"credentialDeviceType" TEXT NOT NULL,
59+
"credentialBackedUp" BOOLEAN NOT NULL,
60+
"transports" TEXT,
61+
62+
CONSTRAINT "Authenticator_pkey" PRIMARY KEY ("userId","credentialID")
63+
);
64+
65+
-- CreateIndex
66+
CREATE UNIQUE INDEX "User_email_key" ON "User"("email");
67+
68+
-- CreateIndex
69+
CREATE UNIQUE INDEX "Session_sessionToken_key" ON "Session"("sessionToken");
70+
71+
-- CreateIndex
72+
CREATE UNIQUE INDEX "Authenticator_credentialID_key" ON "Authenticator"("credentialID");
73+
74+
-- AddForeignKey
75+
ALTER TABLE "Account" ADD CONSTRAINT "Account_userId_fkey" FOREIGN KEY ("userId") REFERENCES "User"("id") ON DELETE CASCADE ON UPDATE CASCADE;
76+
77+
-- AddForeignKey
78+
ALTER TABLE "Session" ADD CONSTRAINT "Session_userId_fkey" FOREIGN KEY ("userId") REFERENCES "User"("id") ON DELETE CASCADE ON UPDATE CASCADE;
79+
80+
-- AddForeignKey
81+
ALTER TABLE "Authenticator" ADD CONSTRAINT "Authenticator_userId_fkey" FOREIGN KEY ("userId") REFERENCES "User"("id") ON DELETE CASCADE ON UPDATE CASCADE;
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# Please do not edit this file manually
2+
# It should be added in your version-control system (i.e. Git)
3+
provider = "postgresql"

prisma/schema.prisma

Lines changed: 67 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,71 @@ datasource db {
1111
}
1212

1313
model User {
14-
id String @id @default(uuid())
15-
username String @unique
16-
password String
14+
id String @id @default(cuid())
15+
name String?
16+
email String @unique
17+
emailVerified DateTime?
18+
image String?
19+
accounts Account[]
20+
sessions Session[]
21+
// Optional for WebAuthn support
22+
Authenticator Authenticator[]
23+
24+
createdAt DateTime @default(now())
25+
updatedAt DateTime @updatedAt
26+
}
27+
28+
model Account {
29+
userId String
30+
type String
31+
provider String
32+
providerAccountId String
33+
refresh_token String?
34+
access_token String?
35+
expires_at Int?
36+
token_type String?
37+
scope String?
38+
id_token String?
39+
session_state String?
40+
41+
createdAt DateTime @default(now())
42+
updatedAt DateTime @updatedAt
43+
44+
user User @relation(fields: [userId], references: [id], onDelete: Cascade)
45+
46+
@@id([provider, providerAccountId])
47+
}
48+
49+
model Session {
50+
sessionToken String @unique
51+
userId String
52+
expires DateTime
53+
user User @relation(fields: [userId], references: [id], onDelete: Cascade)
54+
55+
createdAt DateTime @default(now())
56+
updatedAt DateTime @updatedAt
57+
}
58+
59+
model VerificationToken {
60+
identifier String
61+
token String
62+
expires DateTime
63+
64+
@@id([identifier, token])
65+
}
66+
67+
// Optional for WebAuthn support
68+
model Authenticator {
69+
credentialID String @unique
70+
userId String
71+
providerAccountId String
72+
credentialPublicKey String
73+
counter Int
74+
credentialDeviceType String
75+
credentialBackedUp Boolean
76+
transports String?
77+
78+
user User @relation(fields: [userId], references: [id], onDelete: Cascade)
79+
80+
@@id([userId, credentialID])
1781
}

src/app.tsx

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,17 @@
22
import { Router } from "@solidjs/router";
33
import { FileRoutes } from "@solidjs/start/router";
44
import { Suspense } from "solid-js";
5+
import { SessionProvider } from "@solid-mediakit/auth/client";
56
import "./app.css";
67

78
export default function App() {
89
return (
910
<Router
1011
root={(props) => (
1112
<>
12-
<Suspense>{props.children}</Suspense>
13+
<Suspense>
14+
<SessionProvider>{props.children}</SessionProvider>
15+
</Suspense>
1316
</>
1417
)}
1518
>

0 commit comments

Comments
 (0)