add pocketbase

This commit is contained in:
Guillaume Dorce 2023-05-09 19:57:10 +02:00
parent 9e1d3ddeba
commit e488e15c14
7 changed files with 318 additions and 344 deletions

View File

@ -5,5 +5,4 @@
# If you are cloning this repo, create a copy of this file named `.env` and populate it with your secrets.
# When adding additional env variables, the schema in /env/schema.mjs should be updated accordingly
# Prisma
DATABASE_URL=file:./db.sqlite
PB_API="https://pb.grossebeut.eu"

View File

@ -10,19 +10,20 @@
"start": "next start"
},
"dependencies": {
"@emotion/react": "^11.10.8",
"@emotion/styled": "^11.10.8",
"@prisma/client": "^4.13.0",
"@emotion/react": "^11.11.0",
"@emotion/styled": "^11.11.0",
"@prisma/client": "^4.14.0",
"@react-page/editor": "^5.4.4",
"@react-page/plugins-image": "^5.4.4",
"@react-page/plugins-slate": "^5.4.4",
"@tanstack/react-query": "^4.29.5",
"@trpc/client": "^10.24.0",
"@trpc/next": "^10.24.0",
"@trpc/react-query": "^10.24.0",
"@trpc/server": "^10.24.0",
"@trpc/client": "^10.25.0",
"@trpc/next": "^10.25.0",
"@trpc/react-query": "^10.25.0",
"@trpc/server": "^10.25.0",
"add": "^2.0.6",
"next": "13.1.2",
"pocketbase": "^0.14.4",
"react": "18.2.0",
"react-dom": "18.2.0",
"react-icons": "^4.8.0",
@ -30,19 +31,19 @@
"zod": "^3.21.4"
},
"devDependencies": {
"@types/node": "^18.16.3",
"@types/node": "^18.16.6",
"@types/prettier": "^2.7.2",
"@types/react": "^18.2.1",
"@types/react-dom": "^18.2.3",
"@typescript-eslint/eslint-plugin": "^5.59.2",
"@typescript-eslint/parser": "^5.59.2",
"@types/react": "^18.2.6",
"@types/react-dom": "^18.2.4",
"@typescript-eslint/eslint-plugin": "^5.59.5",
"@typescript-eslint/parser": "^5.59.5",
"autoprefixer": "^10.4.14",
"eslint": "^8.39.0",
"eslint": "^8.40.0",
"eslint-config-next": "13.1.2",
"postcss": "^8.4.23",
"prettier": "^2.8.8",
"prettier-plugin-tailwindcss": "^0.2.8",
"prisma": "^4.13.0",
"prisma": "^4.14.0",
"tailwindcss": "^3.3.2",
"typescript": "^4.9.5"
},

File diff suppressed because it is too large Load Diff

View File

@ -1,17 +0,0 @@
// 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 Example {
id String @id @default(cuid())
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
}

4
src/env/schema.mjs vendored
View File

@ -6,8 +6,8 @@ import { z } from "zod";
* This way you can ensure the app isn't built with invalid env vars.
*/
export const serverSchema = z.object({
DATABASE_URL: z.string().url(),
NODE_ENV: z.enum(["development", "test", "production"]),
PB_API: z.string().url(),
});
/**
@ -16,8 +16,8 @@ export const serverSchema = z.object({
* @type {{ [k in keyof z.infer<typeof serverSchema>]: z.infer<typeof serverSchema>[k] | undefined }}
*/
export const serverEnv = {
DATABASE_URL: process.env.DATABASE_URL,
NODE_ENV: process.env.NODE_ENV,
PB_API: process.env.PB_API,
};
/**

View File

@ -10,7 +10,10 @@ export const exampleRouter = createTRPCRouter({
greeting: `Hello ${input.text}`,
};
}),
getAll: publicProcedure.query(({ ctx }) => {
return ctx.prisma.example.findMany();
pbPages: publicProcedure
.query(() => {
return {
greeting: `Hello`,
};
}),
});

View File

@ -1,19 +0,0 @@
import { PrismaClient } from "@prisma/client";
import { env } from "../env/server.mjs";
declare global {
// eslint-disable-next-line no-var
var prisma: PrismaClient | undefined;
}
export const prisma =
global.prisma ||
new PrismaClient({
log:
env.NODE_ENV === "development" ? ["query", "error", "warn"] : ["error"],
});
if (env.NODE_ENV !== "production") {
global.prisma = prisma;
}