Install Prisma
This commit is contained in:
parent
3f9e8f7913
commit
348cb6c204
|
@ -11,4 +11,7 @@ OAUTH2__CLIENT_ID=
|
|||
OAUTH2__CLIENT_SECRET=
|
||||
|
||||
# Userinfo route
|
||||
USERINFO__ROUTE=
|
||||
USERINFO__ROUTE=
|
||||
|
||||
# Prisma database URL
|
||||
DATABASE_URL="file:./data.db"
|
2
.gitignore
vendored
2
.gitignore
vendored
|
@ -19,3 +19,5 @@ Thumbs.db
|
|||
# Vite
|
||||
vite.config.js.timestamp-*
|
||||
vite.config.ts.timestamp-*
|
||||
|
||||
data.db*
|
3677
package-lock.json
generated
3677
package-lock.json
generated
File diff suppressed because it is too large
Load diff
|
@ -17,6 +17,7 @@
|
|||
"@sveltejs/vite-plugin-svelte": "^3.0.0",
|
||||
"prettier": "^3.1.1",
|
||||
"prettier-plugin-svelte": "^3.1.2",
|
||||
"prisma": "^5.16.2",
|
||||
"svelte": "^4.2.7",
|
||||
"svelte-check": "^3.6.0",
|
||||
"tslib": "^2.4.1",
|
||||
|
@ -25,6 +26,7 @@
|
|||
},
|
||||
"type": "module",
|
||||
"dependencies": {
|
||||
"@fontsource-variable/inter": "^5.0.18"
|
||||
"@fontsource-variable/inter": "^5.0.18",
|
||||
"@prisma/client": "5.16.2"
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,9 @@
|
|||
-- CreateTable
|
||||
CREATE TABLE "Token" (
|
||||
"id" TEXT NOT NULL PRIMARY KEY,
|
||||
"token" TEXT NOT NULL,
|
||||
"refreshToken" TEXT NOT NULL
|
||||
);
|
||||
|
||||
-- CreateIndex
|
||||
CREATE UNIQUE INDEX "Token_id_key" ON "Token"("id");
|
3
prisma/migrations/migration_lock.toml
Normal file
3
prisma/migrations/migration_lock.toml
Normal file
|
@ -0,0 +1,3 @@
|
|||
# Please do not edit this file manually
|
||||
# It should be added in your version-control system (i.e. Git)
|
||||
provider = "sqlite"
|
17
prisma/schema.prisma
Normal file
17
prisma/schema.prisma
Normal file
|
@ -0,0 +1,17 @@
|
|||
// This is your Prisma schema file,
|
||||
// learn more about it in the docs: https://pris.ly/d/prisma-schema
|
||||
|
||||
generator client {
|
||||
provider = "prisma-client-js"
|
||||
}
|
||||
|
||||
datasource db {
|
||||
provider = "sqlite"
|
||||
url = env("DATABASE_URL")
|
||||
}
|
||||
|
||||
model Token {
|
||||
id String @id @unique @default(uuid())
|
||||
token String
|
||||
refreshToken String
|
||||
}
|
|
@ -1,8 +1,14 @@
|
|||
import { error, redirect, type Cookies } from "@sveltejs/kit"
|
||||
import configuration from "./configuration"
|
||||
import type { User } from "./types"
|
||||
import { PrismaClient } from "@prisma/client"
|
||||
|
||||
const prisma = new PrismaClient()
|
||||
|
||||
// Map of OAuth2 states
|
||||
const states = new Map<string, { redirect_uri: string, timeout: ReturnType<typeof setTimeout> }>()
|
||||
// Cache of userinfo
|
||||
const usercache = new Map<string, User>()
|
||||
|
||||
/**
|
||||
* @description Launch an OAuth2 login request for this request.
|
||||
|
|
Loading…
Reference in a new issue