1
0
mirror of synced 2026-02-03 18:01:02 -05:00

Compare commits

...

5 Commits

Author SHA1 Message Date
Brandon Bayer
ef38a4008a ah, there it is 2022-04-26 14:04:02 -04:00
Brandon Bayer
a9a3167a0f fix more 2022-04-26 11:38:52 -04:00
Brandon Bayer
64c75087dc fix 2022-04-26 11:29:22 -04:00
Brandon Bayer
257b1e8b27 remove db 2022-04-26 11:23:30 -04:00
Brandon Bayer
2fc9ceeed7 make it work 2022-04-26 11:22:17 -04:00
10 changed files with 82 additions and 12 deletions

1
.gitignore vendored
View File

@@ -68,3 +68,4 @@ test/**/blitz-env.d.ts
examples/**/blitz-env.d.ts
.blitz**
*.sqlite

View File

@@ -1,8 +1,8 @@
import { AuthClientPlugin } from "@blitzjs/auth"
import { setupClient } from "@blitzjs/next"
import { setupBlitzClient } from "@blitzjs/next"
import { BlitzRpcPlugin } from "@blitzjs/rpc"
const { withBlitz } = setupClient({
const { withBlitz } = setupBlitzClient({
plugins: [
AuthClientPlugin({
cookiePrefix: "web-cookie-prefix",

View File

@@ -1,9 +1,9 @@
import { setupBlitz } from "@blitzjs/next"
import { setupBlitzServer } from "@blitzjs/next"
import { AuthServerPlugin, PrismaStorage } from "@blitzjs/auth"
import { prisma as db } from "../db/index"
import { simpleRolesIsAuthorized } from "@blitzjs/auth"
const { gSSP, gSP, api } = setupBlitz({
const { gSSP, gSP, api } = setupBlitzServer({
plugins: [
AuthServerPlugin({
cookiePrefix: "web-cookie-prefix",

View File

@@ -0,0 +1,47 @@
-- CreateTable
CREATE TABLE "User" (
"id" INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,
"createdAt" DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
"updatedAt" DATETIME NOT NULL,
"name" TEXT,
"email" TEXT NOT NULL,
"hashedPassword" TEXT,
"role" TEXT NOT NULL DEFAULT 'USER'
);
-- CreateTable
CREATE TABLE "Session" (
"id" INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,
"createdAt" DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
"updatedAt" DATETIME NOT NULL,
"expiresAt" DATETIME,
"handle" TEXT NOT NULL,
"hashedSessionToken" TEXT,
"antiCSRFToken" TEXT,
"publicData" TEXT,
"privateData" TEXT,
"userId" INTEGER,
CONSTRAINT "Session_userId_fkey" FOREIGN KEY ("userId") REFERENCES "User" ("id") ON DELETE SET NULL ON UPDATE CASCADE
);
-- CreateTable
CREATE TABLE "Token" (
"id" INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,
"createdAt" DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
"updatedAt" DATETIME NOT NULL,
"hashedToken" TEXT NOT NULL,
"type" TEXT NOT NULL,
"expiresAt" DATETIME NOT NULL,
"sentTo" TEXT NOT NULL,
"userId" INTEGER NOT NULL,
CONSTRAINT "Token_userId_fkey" FOREIGN KEY ("userId") REFERENCES "User" ("id") ON DELETE RESTRICT ON UPDATE CASCADE
);
-- CreateIndex
CREATE UNIQUE INDEX "User_email_key" ON "User"("email");
-- CreateIndex
CREATE UNIQUE INDEX "Session_handle_key" ON "Session"("handle");
-- CreateIndex
CREATE UNIQUE INDEX "Token_hashedToken_type_key" ON "Token"("hashedToken", "type");

View File

@@ -35,6 +35,7 @@
"react": "18.0.0",
"react-dom": "18.0.0",
"react-hook-form": "7.29.0",
"styled-jsx": "5.0.2",
"ts-node": "10.7.0",
"zod": "3.10.1"
},

View File

@@ -1,8 +1,8 @@
import {AuthClientPlugin} from "@blitzjs/auth"
import {setupClient} from "@blitzjs/next"
import {setupBlitzClient} from "@blitzjs/next"
import {BlitzRpcPlugin} from "@blitzjs/rpc"
const {withBlitz} = setupClient({
const {withBlitz} = setupBlitzClient({
plugins: [
AuthClientPlugin({
cookiePrefix: "webapp-cookie-prefix",

View File

@@ -1,9 +1,9 @@
import {setupBlitz} from "@blitzjs/next"
import {setupBlitzServer} from "@blitzjs/next"
import {AuthServerPlugin, PrismaStorage} from "@blitzjs/auth"
import {prisma as db} from "../prisma/index"
import {simpleRolesIsAuthorized} from "@blitzjs/auth"
const {gSSP, gSP, api} = setupBlitz({
const {gSSP, gSP, api} = setupBlitzServer({
plugins: [
AuthServerPlugin({
cookiePrefix: "webapp-cookie-prefix",

View File

@@ -1,7 +1,7 @@
import {AuthClientPlugin} from "@blitzjs/auth"
import {setupClient} from "@blitzjs/next"
import {setupBlitzClient} from "@blitzjs/next"
const {withBlitz} = setupClient({
const {withBlitz} = setupBlitzClient({
plugins: [
AuthClientPlugin({
cookiePrefix: "auth-tests-cookie-prefix",

View File

@@ -1,9 +1,9 @@
import {setupBlitz} from "@blitzjs/next"
import {setupBlitzServer} from "@blitzjs/next"
import {AuthServerPlugin, PrismaStorage} from "@blitzjs/auth"
import {simpleRolesIsAuthorized} from "@blitzjs/auth"
import {prisma as db} from "../prisma/index"
const {gSSP, gSP, api} = setupBlitz({
const {gSSP, gSP, api} = setupBlitzServer({
plugins: [
AuthServerPlugin({
cookiePrefix: "auth-tests-cookie-prefix",

21
pnpm-lock.yaml generated
View File

@@ -64,6 +64,7 @@ importers:
react: 18.0.0
react-dom: 18.0.0
react-hook-form: 7.29.0
styled-jsx: 5.0.2
ts-node: 10.7.0
typescript: ^4.5.3
zod: 3.10.1
@@ -80,6 +81,7 @@ importers:
react: 18.0.0
react-dom: 18.0.0_react@18.0.0
react-hook-form: 7.29.0_react@18.0.0
styled-jsx: 5.0.2_react@18.0.0
ts-node: 10.7.0_2dcdb8fdc9a6e6d9aaf2aac9443a7c28
zod: 3.10.1
devDependencies:
@@ -14090,6 +14092,25 @@ packages:
dependencies:
react: 18.0.0
/styled-jsx/5.0.2_react@18.0.0:
resolution:
{
integrity: sha512-LqPQrbBh3egD57NBcHET4qcgshPks+yblyhPlH2GY8oaDgKs8SK4C3dBh3oSJjgzJ3G5t1SYEZGHkP+QEpX9EQ==,
}
engines: {node: ">= 12.0.0"}
peerDependencies:
"@babel/core": "*"
babel-plugin-macros: "*"
react: ">= 16.8.0 || 17.x.x || ^18.0.0-0"
peerDependenciesMeta:
"@babel/core":
optional: true
babel-plugin-macros:
optional: true
dependencies:
react: 18.0.0
dev: false
/subarg/1.0.0:
resolution: {integrity: sha1-9izxdYHplrSPyWVpn1TAauJouNI=}
dependencies: