Fixing all erros

This commit is contained in:
2023-09-03 19:53:50 +02:00
parent 4e09b604d3
commit 3cb5c2dcf8
8 changed files with 10358 additions and 21 deletions

2
.npmrc
View File

@@ -1,2 +0,0 @@
shamefully-hoist=true
strict-peer-dependencies=false

View File

@@ -0,0 +1,90 @@
-- CreateTable
CREATE TABLE "Maintenance" (
"id" SERIAL NOT NULL,
"reason" TEXT NOT NULL,
"beginAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
"endAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
"createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
CONSTRAINT "Maintenance_pkey" PRIMARY KEY ("id")
);
-- CreateTable
CREATE TABLE "Announcement" (
"id" SERIAL NOT NULL,
"createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
"content" TEXT NOT NULL,
CONSTRAINT "Announcement_pkey" PRIMARY KEY ("id")
);
-- CreateTable
CREATE TABLE "Category" (
"id" SERIAL NOT NULL,
"createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
"slug" TEXT NOT NULL,
"name" TEXT NOT NULL,
CONSTRAINT "Category_pkey" PRIMARY KEY ("id")
);
-- CreateTable
CREATE TABLE "Talent" (
"id" SERIAL NOT NULL,
"createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
"logo" TEXT NOT NULL,
"name" TEXT NOT NULL,
"website" TEXT NOT NULL,
"work" TEXT NOT NULL,
"favorite" BOOLEAN NOT NULL DEFAULT false,
CONSTRAINT "Talent_pkey" PRIMARY KEY ("id")
);
-- CreateTable
CREATE TABLE "CategoriesOnTalents" (
"talentId" INTEGER NOT NULL,
"categoryId" INTEGER NOT NULL,
CONSTRAINT "CategoriesOnTalents_pkey" PRIMARY KEY ("talentId","categoryId")
);
-- CreateTable
CREATE TABLE "Post" (
"id" SERIAL NOT NULL,
"slug" TEXT NOT NULL,
"createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
"views" INTEGER NOT NULL DEFAULT 0,
"likes" INTEGER NOT NULL DEFAULT 0,
CONSTRAINT "Post_pkey" PRIMARY KEY ("id")
);
-- CreateTable
CREATE TABLE "Form" (
"id" SERIAL NOT NULL,
"name" TEXT NOT NULL,
"email" TEXT NOT NULL,
"content" TEXT NOT NULL,
"createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
CONSTRAINT "Form_pkey" PRIMARY KEY ("id")
);
-- CreateIndex
CREATE UNIQUE INDEX "Talent_name_key" ON "Talent"("name");
-- CreateIndex
CREATE INDEX "CategoriesOnTalents_talentId_idx" ON "CategoriesOnTalents"("talentId");
-- CreateIndex
CREATE INDEX "CategoriesOnTalents_categoryId_idx" ON "CategoriesOnTalents"("categoryId");
-- CreateIndex
CREATE UNIQUE INDEX "Post_slug_key" ON "Post"("slug");
-- AddForeignKey
ALTER TABLE "CategoriesOnTalents" ADD CONSTRAINT "CategoriesOnTalents_talentId_fkey" FOREIGN KEY ("talentId") REFERENCES "Talent"("id") ON DELETE RESTRICT ON UPDATE CASCADE;
-- AddForeignKey
ALTER TABLE "CategoriesOnTalents" ADD CONSTRAINT "CategoriesOnTalents_categoryId_fkey" FOREIGN KEY ("categoryId") REFERENCES "Category"("id") ON DELETE RESTRICT ON UPDATE CASCADE;

View 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 = "postgresql"

View File

@@ -1,12 +1,12 @@
generator client {
provider = "prisma-client-js"
provider = "prisma-client-js"
previewFeatures = ["postgresqlExtensions"]
}
datasource db {
provider = "postgresql"
url = env("POSTGRES_PRISMA_URL") // uses connection pooling
directUrl = env("POSTGRES_URL_NON_POOLING") // uses a direct connection
url = env("POSTGRES_PRISMA_URL")
directUrl = env("POSTGRES_URL_NON_POOLING")
}
model Maintenance {
@@ -43,10 +43,10 @@ model Talent {
}
model CategoriesOnTalents {
talent Talent @relation(fields: [talentId], references: [id])
talentId Int
category Category @relation(fields: [categoryId], references: [id])
categoryId Int
category Category @relation(fields: [categoryId], references: [id])
talent Talent @relation(fields: [talentId], references: [id])
@@id([talentId, categoryId])
@@index([talentId])

View File

@@ -73,7 +73,7 @@
:::
:::grid-slot{title="BackEnd"}
Prisma, AdonisJs, Supabase, TRPC.io
Prisma, AdonisJs, Supabase, TRPC.io, Vercel
:::
::

View File

@@ -1,12 +0,0 @@
import process from 'node:process'
import { PrismaClient } from '@prisma/client/edge'
const globalForPrisma = globalThis as unknown as { prisma: PrismaClient }
export const prisma = globalForPrisma.prisma
|| new PrismaClient({
log: process.env.NODE_ENV === 'development' ? ['query', 'error', 'warn'] : ['error'],
})
if (process.env.NODE_ENV !== 'production')
globalForPrisma.prisma = prisma

View File

@@ -1,8 +1,16 @@
import type { inferAsyncReturnType } from '@trpc/server'
import type { H3Event } from 'h3'
import { prisma } from '../prisma'
import { PrismaClient } from '@prisma/client'
let prisma: PrismaClient | undefined
export function createContext(_event: H3Event) {
if (!prisma) {
prisma = new PrismaClient({
log: process.env.NODE_ENV === 'development' ? ['query', 'error', 'warn'] : ['error'],
})
}
return {
prisma,
}

10250
yarn.lock Normal file

File diff suppressed because it is too large Load Diff