api: add first version of export api

This commit is contained in:
Carl-Gerhard Lindesvärd
2024-04-11 21:30:36 +02:00
committed by Carl-Gerhard Lindesvärd
parent 7ea95afe16
commit 7f8d857508
10 changed files with 232 additions and 7 deletions

View File

@@ -0,0 +1,12 @@
-- CreateEnum
CREATE TYPE "ClientType" AS ENUM ('read', 'write', 'root');
-- DropForeignKey
ALTER TABLE "clients" DROP CONSTRAINT "clients_projectId_fkey";
-- AlterTable
ALTER TABLE "clients" ADD COLUMN "type" "ClientType" NOT NULL DEFAULT 'read',
ALTER COLUMN "projectId" DROP NOT NULL;
-- AddForeignKey
ALTER TABLE "clients" ADD CONSTRAINT "clients_projectId_fkey" FOREIGN KEY ("projectId") REFERENCES "projects"("id") ON DELETE SET NULL ON UPDATE CASCADE;

View File

@@ -0,0 +1,2 @@
-- AlterTable
ALTER TABLE "clients" ALTER COLUMN "type" SET DEFAULT 'write';

View File

@@ -90,14 +90,21 @@ model Profile {
@@map("profiles")
}
enum ClientType {
read
write
root
}
model Client {
id String @id @default(dbgenerated("gen_random_uuid()")) @db.Uuid
id String @id @default(dbgenerated("gen_random_uuid()")) @db.Uuid
name String
secret String?
projectId String
project Project @relation(fields: [projectId], references: [id])
type ClientType @default(write)
projectId String?
project Project? @relation(fields: [projectId], references: [id])
organizationSlug String
cors String @default("*")
cors String @default("*")
createdAt DateTime @default(now())
updatedAt DateTime @default(now()) @updatedAt