From 56c688f6740512f16409b47c27c9324b81497c8b Mon Sep 17 00:00:00 2001 From: NeilClack Date: Wed, 18 Mar 2026 01:09:21 -0500 Subject: [PATCH] Add proclamations api endpoint --- .../migration.sql | 2 + .../migration.sql | 8 + .../migration.sql | 15 + prisma/schema.prisma | 41 +- src/lib/generated/prisma/browser.ts | 5 + src/lib/generated/prisma/client.ts | 5 + src/lib/generated/prisma/internal/class.ts | 14 +- .../prisma/internal/prismaNamespace.ts | 88 +- .../prisma/internal/prismaNamespaceBrowser.ts | 11 + src/lib/generated/prisma/models.ts | 1 + src/lib/generated/prisma/models/LicenseKey.ts | 4 +- .../generated/prisma/models/Proclamation.ts | 149 +- .../prisma/models/ProclamationCategory.ts | 10 +- src/lib/generated/prisma/models/User.ts | 154 ++ .../prisma/models/UserProclamations.ts | 1425 +++++++++++++++++ src/lib/svelte-admin/README.md | 194 +-- src/routes/api/v1/proclamations/+server.ts | 44 +- 17 files changed, 2044 insertions(+), 126 deletions(-) create mode 100644 prisma/migrations/20260317215538_remove_proclamation_content_index/migration.sql create mode 100644 prisma/migrations/20260318054659_make_keys_unique/migration.sql create mode 100644 prisma/migrations/20260318060321_create_user_proclamations_table/migration.sql create mode 100644 src/lib/generated/prisma/models/UserProclamations.ts diff --git a/prisma/migrations/20260317215538_remove_proclamation_content_index/migration.sql b/prisma/migrations/20260317215538_remove_proclamation_content_index/migration.sql new file mode 100644 index 0000000..e06ae7f --- /dev/null +++ b/prisma/migrations/20260317215538_remove_proclamation_content_index/migration.sql @@ -0,0 +1,2 @@ +-- DropIndex +DROP INDEX "Proclamation_content_key"; diff --git a/prisma/migrations/20260318054659_make_keys_unique/migration.sql b/prisma/migrations/20260318054659_make_keys_unique/migration.sql new file mode 100644 index 0000000..428679f --- /dev/null +++ b/prisma/migrations/20260318054659_make_keys_unique/migration.sql @@ -0,0 +1,8 @@ +/* + Warnings: + + - A unique constraint covering the columns `[key]` on the table `LicenseKey` will be added. If there are existing duplicate values, this will fail. + +*/ +-- CreateIndex +CREATE UNIQUE INDEX "LicenseKey_key_key" ON "LicenseKey"("key"); diff --git a/prisma/migrations/20260318060321_create_user_proclamations_table/migration.sql b/prisma/migrations/20260318060321_create_user_proclamations_table/migration.sql new file mode 100644 index 0000000..77024cb --- /dev/null +++ b/prisma/migrations/20260318060321_create_user_proclamations_table/migration.sql @@ -0,0 +1,15 @@ +-- CreateTable +CREATE TABLE "UserProclamations" ( + "userId" TEXT NOT NULL, + "proclamationId" TEXT NOT NULL, + "createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP, + "updatedAt" TIMESTAMP(3) NOT NULL, + + CONSTRAINT "UserProclamations_pkey" PRIMARY KEY ("userId","proclamationId") +); + +-- AddForeignKey +ALTER TABLE "UserProclamations" ADD CONSTRAINT "UserProclamations_userId_fkey" FOREIGN KEY ("userId") REFERENCES "user"("id") ON DELETE RESTRICT ON UPDATE CASCADE; + +-- AddForeignKey +ALTER TABLE "UserProclamations" ADD CONSTRAINT "UserProclamations_proclamationId_fkey" FOREIGN KEY ("proclamationId") REFERENCES "Proclamation"("id") ON DELETE RESTRICT ON UPDATE CASCADE; diff --git a/prisma/schema.prisma b/prisma/schema.prisma index 3d0e0ce..8f070b1 100644 --- a/prisma/schema.prisma +++ b/prisma/schema.prisma @@ -14,19 +14,20 @@ datasource db { } model User { - id String @id - name String - email String - emailVerified Boolean @default(false) - image String? - createdAt DateTime @default(now()) - updatedAt DateTime @updatedAt - roleId Int? - role UserRole? @relation(fields: [roleId], references: [id]) - sessions Session[] - accounts Account[] - profile Profile? - licenseKeys LicenseKey[] + id String @id + name String + email String + emailVerified Boolean @default(false) + image String? + createdAt DateTime @default(now()) + updatedAt DateTime @updatedAt + roleId Int? + role UserRole? @relation(fields: [roleId], references: [id]) + sessions Session[] + accounts Account[] + profile Profile? + licenseKeys LicenseKey[] + userProclamations UserProclamations[] @@unique([email]) @@map("user") @@ -118,6 +119,18 @@ model Proclamation { categoryId Int category ProclamationCategory @relation(fields: [categoryId], references: [id]) price Float @default(0.99) + userProclamations UserProclamations[] +} + +model UserProclamations { + userId String + user User @relation(fields: [userId], references: [id]) + proclamationId String + proclamation Proclamation @relation(fields: [proclamationId], references: [id]) + createdAt DateTime @default(now()) + updatedAt DateTime @updatedAt + + @@id([userId, proclamationId]) } model SolfeggioFrequency { @@ -140,7 +153,7 @@ model ProclamationCategory { model LicenseKey { id String @id @default(uuid()) - key String + key String @unique active Boolean level String userId String diff --git a/src/lib/generated/prisma/browser.ts b/src/lib/generated/prisma/browser.ts index 1a2bab2..9393ff3 100644 --- a/src/lib/generated/prisma/browser.ts +++ b/src/lib/generated/prisma/browser.ts @@ -57,6 +57,11 @@ export type Verification = Prisma.VerificationModel * */ export type Proclamation = Prisma.ProclamationModel +/** + * Model UserProclamations + * + */ +export type UserProclamations = Prisma.UserProclamationsModel /** * Model SolfeggioFrequency * diff --git a/src/lib/generated/prisma/client.ts b/src/lib/generated/prisma/client.ts index 26663fe..b9fff2a 100644 --- a/src/lib/generated/prisma/client.ts +++ b/src/lib/generated/prisma/client.ts @@ -79,6 +79,11 @@ export type Verification = Prisma.VerificationModel * */ export type Proclamation = Prisma.ProclamationModel +/** + * Model UserProclamations + * + */ +export type UserProclamations = Prisma.UserProclamationsModel /** * Model SolfeggioFrequency * diff --git a/src/lib/generated/prisma/internal/class.ts b/src/lib/generated/prisma/internal/class.ts index 38773f1..ec0bc6d 100644 --- a/src/lib/generated/prisma/internal/class.ts +++ b/src/lib/generated/prisma/internal/class.ts @@ -20,7 +20,7 @@ const config: runtime.GetPrismaClientConfig = { "clientVersion": "7.2.0", "engineVersion": "0c8ef2ce45c83248ab3df073180d5eda9e8be7a3", "activeProvider": "postgresql", - "inlineSchema": "// This is your Prisma schema file,\n// learn more about it in the docs: https://pris.ly/d/prisma-schema\n\n// Looking for ways to speed up your queries, or scale easily with your serverless or edge functions?\n// Try Prisma Accelerate: https://pris.ly/cli/accelerate-init\n\ngenerator client {\n provider = \"prisma-client\"\n output = \"../src/lib/generated/prisma\"\n}\n\ndatasource db {\n provider = \"postgresql\"\n}\n\nmodel User {\n id String @id\n name String\n email String\n emailVerified Boolean @default(false)\n image String?\n createdAt DateTime @default(now())\n updatedAt DateTime @updatedAt\n roleId Int?\n role UserRole? @relation(fields: [roleId], references: [id])\n sessions Session[]\n accounts Account[]\n profile Profile?\n licenseKeys LicenseKey[]\n\n @@unique([email])\n @@map(\"user\")\n}\n\n// I chose to create a Profile table here because honestly, I didn't want to waste\n// a bunch of time trying to figure out how to customize the default Better-Auth model. \nmodel Profile {\n id String @id @default(uuid())\n userId String @unique\n user User @relation(fields: [userId], references: [id], onDelete: Cascade)\n firstName String\n lastName String\n phoneNumber String\n addresses Address[]\n}\n\nmodel Address {\n id String @id @default(uuid())\n profileId String\n profile Profile @relation(fields: [profileId], references: [id], onDelete: Cascade)\n street String\n city String\n state String\n postalCode String\n country String\n}\n\nmodel Session {\n id String @id\n expiresAt DateTime\n token String\n createdAt DateTime @default(now())\n updatedAt DateTime @updatedAt\n ipAddress String?\n userAgent String?\n userId String\n user User @relation(fields: [userId], references: [id], onDelete: Cascade)\n\n @@unique([token])\n @@index([userId])\n @@map(\"session\")\n}\n\nmodel Account {\n id String @id\n accountId String\n providerId String\n userId String\n user User @relation(fields: [userId], references: [id], onDelete: Cascade)\n accessToken String?\n refreshToken String?\n idToken String?\n accessTokenExpiresAt DateTime?\n refreshTokenExpiresAt DateTime?\n scope String?\n password String?\n createdAt DateTime @default(now())\n updatedAt DateTime @updatedAt\n\n @@index([userId])\n @@map(\"account\")\n}\n\nmodel UserRole {\n id Int @id @default(autoincrement())\n name String\n users User[]\n}\n\nmodel Verification {\n id String @id\n identifier String\n value String\n expiresAt DateTime\n createdAt DateTime @default(now())\n updatedAt DateTime @updatedAt\n\n @@index([identifier])\n @@map(\"verification\")\n}\n\nmodel Proclamation {\n id String @id @default(uuid())\n name String @unique\n content String @unique\n solfeggioFrequencyId Int\n solfeggioFrequency SolfeggioFrequency @relation(fields: [solfeggioFrequencyId], references: [id])\n categoryId Int\n category ProclamationCategory @relation(fields: [categoryId], references: [id])\n price Float @default(0.99)\n}\n\nmodel SolfeggioFrequency {\n id Int @id @default(autoincrement())\n name String @unique\n value Float @unique\n proclamations Proclamation[]\n}\n\nmodel ProclamationCategory {\n id Int @id @default(autoincrement())\n name String @unique\n parentId Int?\n parent ProclamationCategory? @relation(\"CategoryHierarchy\", fields: [parentId], references: [id])\n children ProclamationCategory[] @relation(\"CategoryHierarchy\")\n proclamations Proclamation[]\n}\n\nmodel LicenseKey {\n id String @id @default(uuid())\n key String\n active Boolean\n level String\n userId String\n user User @relation(fields: [userId], references: [id])\n}\n", + "inlineSchema": "// This is your Prisma schema file,\n// learn more about it in the docs: https://pris.ly/d/prisma-schema\n\n// Looking for ways to speed up your queries, or scale easily with your serverless or edge functions?\n// Try Prisma Accelerate: https://pris.ly/cli/accelerate-init\n\ngenerator client {\n provider = \"prisma-client\"\n output = \"../src/lib/generated/prisma\"\n}\n\ndatasource db {\n provider = \"postgresql\"\n}\n\nmodel User {\n id String @id\n name String\n email String\n emailVerified Boolean @default(false)\n image String?\n createdAt DateTime @default(now())\n updatedAt DateTime @updatedAt\n roleId Int?\n role UserRole? @relation(fields: [roleId], references: [id])\n sessions Session[]\n accounts Account[]\n profile Profile?\n licenseKeys LicenseKey[]\n userProclamations UserProclamations[]\n\n @@unique([email])\n @@map(\"user\")\n}\n\n// I chose to create a Profile table here because honestly, I didn't want to waste\n// a bunch of time trying to figure out how to customize the default Better-Auth model. \nmodel Profile {\n id String @id @default(uuid())\n userId String @unique\n user User @relation(fields: [userId], references: [id], onDelete: Cascade)\n firstName String\n lastName String\n phoneNumber String\n addresses Address[]\n}\n\nmodel Address {\n id String @id @default(uuid())\n profileId String\n profile Profile @relation(fields: [profileId], references: [id], onDelete: Cascade)\n street String\n city String\n state String\n postalCode String\n country String\n}\n\nmodel Session {\n id String @id\n expiresAt DateTime\n token String\n createdAt DateTime @default(now())\n updatedAt DateTime @updatedAt\n ipAddress String?\n userAgent String?\n userId String\n user User @relation(fields: [userId], references: [id], onDelete: Cascade)\n\n @@unique([token])\n @@index([userId])\n @@map(\"session\")\n}\n\nmodel Account {\n id String @id\n accountId String\n providerId String\n userId String\n user User @relation(fields: [userId], references: [id], onDelete: Cascade)\n accessToken String?\n refreshToken String?\n idToken String?\n accessTokenExpiresAt DateTime?\n refreshTokenExpiresAt DateTime?\n scope String?\n password String?\n createdAt DateTime @default(now())\n updatedAt DateTime @updatedAt\n\n @@index([userId])\n @@map(\"account\")\n}\n\nmodel UserRole {\n id Int @id @default(autoincrement())\n name String\n users User[]\n}\n\nmodel Verification {\n id String @id\n identifier String\n value String\n expiresAt DateTime\n createdAt DateTime @default(now())\n updatedAt DateTime @updatedAt\n\n @@index([identifier])\n @@map(\"verification\")\n}\n\nmodel Proclamation {\n id String @id @default(uuid())\n name String @unique\n content String\n solfeggioFrequencyId Int\n solfeggioFrequency SolfeggioFrequency @relation(fields: [solfeggioFrequencyId], references: [id])\n categoryId Int\n category ProclamationCategory @relation(fields: [categoryId], references: [id])\n price Float @default(0.99)\n userProclamations UserProclamations[]\n}\n\nmodel UserProclamations {\n userId String\n user User @relation(fields: [userId], references: [id])\n proclamationId String\n proclamation Proclamation @relation(fields: [proclamationId], references: [id])\n createdAt DateTime @default(now())\n updatedAt DateTime @updatedAt\n\n @@id([userId, proclamationId])\n}\n\nmodel SolfeggioFrequency {\n id Int @id @default(autoincrement())\n name String @unique\n value Float @unique\n proclamations Proclamation[]\n}\n\nmodel ProclamationCategory {\n id Int @id @default(autoincrement())\n name String\n parentId Int?\n parent ProclamationCategory? @relation(\"CategoryHierarchy\", fields: [parentId], references: [id])\n children ProclamationCategory[] @relation(\"CategoryHierarchy\")\n proclamations Proclamation[]\n\n @@unique([parentId, name])\n}\n\nmodel LicenseKey {\n id String @id @default(uuid())\n key String @unique\n active Boolean\n level String\n userId String\n user User @relation(fields: [userId], references: [id])\n}\n", "runtimeDataModel": { "models": {}, "enums": {}, @@ -28,7 +28,7 @@ const config: runtime.GetPrismaClientConfig = { } } -config.runtimeDataModel = JSON.parse("{\"models\":{\"User\":{\"fields\":[{\"name\":\"id\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"name\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"email\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"emailVerified\",\"kind\":\"scalar\",\"type\":\"Boolean\"},{\"name\":\"image\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"createdAt\",\"kind\":\"scalar\",\"type\":\"DateTime\"},{\"name\":\"updatedAt\",\"kind\":\"scalar\",\"type\":\"DateTime\"},{\"name\":\"roleId\",\"kind\":\"scalar\",\"type\":\"Int\"},{\"name\":\"role\",\"kind\":\"object\",\"type\":\"UserRole\",\"relationName\":\"UserToUserRole\"},{\"name\":\"sessions\",\"kind\":\"object\",\"type\":\"Session\",\"relationName\":\"SessionToUser\"},{\"name\":\"accounts\",\"kind\":\"object\",\"type\":\"Account\",\"relationName\":\"AccountToUser\"},{\"name\":\"profile\",\"kind\":\"object\",\"type\":\"Profile\",\"relationName\":\"ProfileToUser\"},{\"name\":\"licenseKeys\",\"kind\":\"object\",\"type\":\"LicenseKey\",\"relationName\":\"LicenseKeyToUser\"}],\"dbName\":\"user\"},\"Profile\":{\"fields\":[{\"name\":\"id\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"userId\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"user\",\"kind\":\"object\",\"type\":\"User\",\"relationName\":\"ProfileToUser\"},{\"name\":\"firstName\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"lastName\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"phoneNumber\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"addresses\",\"kind\":\"object\",\"type\":\"Address\",\"relationName\":\"AddressToProfile\"}],\"dbName\":null},\"Address\":{\"fields\":[{\"name\":\"id\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"profileId\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"profile\",\"kind\":\"object\",\"type\":\"Profile\",\"relationName\":\"AddressToProfile\"},{\"name\":\"street\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"city\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"state\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"postalCode\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"country\",\"kind\":\"scalar\",\"type\":\"String\"}],\"dbName\":null},\"Session\":{\"fields\":[{\"name\":\"id\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"expiresAt\",\"kind\":\"scalar\",\"type\":\"DateTime\"},{\"name\":\"token\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"createdAt\",\"kind\":\"scalar\",\"type\":\"DateTime\"},{\"name\":\"updatedAt\",\"kind\":\"scalar\",\"type\":\"DateTime\"},{\"name\":\"ipAddress\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"userAgent\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"userId\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"user\",\"kind\":\"object\",\"type\":\"User\",\"relationName\":\"SessionToUser\"}],\"dbName\":\"session\"},\"Account\":{\"fields\":[{\"name\":\"id\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"accountId\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"providerId\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"userId\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"user\",\"kind\":\"object\",\"type\":\"User\",\"relationName\":\"AccountToUser\"},{\"name\":\"accessToken\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"refreshToken\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"idToken\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"accessTokenExpiresAt\",\"kind\":\"scalar\",\"type\":\"DateTime\"},{\"name\":\"refreshTokenExpiresAt\",\"kind\":\"scalar\",\"type\":\"DateTime\"},{\"name\":\"scope\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"password\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"createdAt\",\"kind\":\"scalar\",\"type\":\"DateTime\"},{\"name\":\"updatedAt\",\"kind\":\"scalar\",\"type\":\"DateTime\"}],\"dbName\":\"account\"},\"UserRole\":{\"fields\":[{\"name\":\"id\",\"kind\":\"scalar\",\"type\":\"Int\"},{\"name\":\"name\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"users\",\"kind\":\"object\",\"type\":\"User\",\"relationName\":\"UserToUserRole\"}],\"dbName\":null},\"Verification\":{\"fields\":[{\"name\":\"id\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"identifier\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"value\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"expiresAt\",\"kind\":\"scalar\",\"type\":\"DateTime\"},{\"name\":\"createdAt\",\"kind\":\"scalar\",\"type\":\"DateTime\"},{\"name\":\"updatedAt\",\"kind\":\"scalar\",\"type\":\"DateTime\"}],\"dbName\":\"verification\"},\"Proclamation\":{\"fields\":[{\"name\":\"id\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"name\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"content\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"solfeggioFrequencyId\",\"kind\":\"scalar\",\"type\":\"Int\"},{\"name\":\"solfeggioFrequency\",\"kind\":\"object\",\"type\":\"SolfeggioFrequency\",\"relationName\":\"ProclamationToSolfeggioFrequency\"},{\"name\":\"categoryId\",\"kind\":\"scalar\",\"type\":\"Int\"},{\"name\":\"category\",\"kind\":\"object\",\"type\":\"ProclamationCategory\",\"relationName\":\"ProclamationToProclamationCategory\"},{\"name\":\"price\",\"kind\":\"scalar\",\"type\":\"Float\"}],\"dbName\":null},\"SolfeggioFrequency\":{\"fields\":[{\"name\":\"id\",\"kind\":\"scalar\",\"type\":\"Int\"},{\"name\":\"name\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"value\",\"kind\":\"scalar\",\"type\":\"Float\"},{\"name\":\"proclamations\",\"kind\":\"object\",\"type\":\"Proclamation\",\"relationName\":\"ProclamationToSolfeggioFrequency\"}],\"dbName\":null},\"ProclamationCategory\":{\"fields\":[{\"name\":\"id\",\"kind\":\"scalar\",\"type\":\"Int\"},{\"name\":\"name\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"parentId\",\"kind\":\"scalar\",\"type\":\"Int\"},{\"name\":\"parent\",\"kind\":\"object\",\"type\":\"ProclamationCategory\",\"relationName\":\"CategoryHierarchy\"},{\"name\":\"children\",\"kind\":\"object\",\"type\":\"ProclamationCategory\",\"relationName\":\"CategoryHierarchy\"},{\"name\":\"proclamations\",\"kind\":\"object\",\"type\":\"Proclamation\",\"relationName\":\"ProclamationToProclamationCategory\"}],\"dbName\":null},\"LicenseKey\":{\"fields\":[{\"name\":\"id\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"key\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"active\",\"kind\":\"scalar\",\"type\":\"Boolean\"},{\"name\":\"level\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"userId\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"user\",\"kind\":\"object\",\"type\":\"User\",\"relationName\":\"LicenseKeyToUser\"}],\"dbName\":null}},\"enums\":{},\"types\":{}}") +config.runtimeDataModel = JSON.parse("{\"models\":{\"User\":{\"fields\":[{\"name\":\"id\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"name\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"email\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"emailVerified\",\"kind\":\"scalar\",\"type\":\"Boolean\"},{\"name\":\"image\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"createdAt\",\"kind\":\"scalar\",\"type\":\"DateTime\"},{\"name\":\"updatedAt\",\"kind\":\"scalar\",\"type\":\"DateTime\"},{\"name\":\"roleId\",\"kind\":\"scalar\",\"type\":\"Int\"},{\"name\":\"role\",\"kind\":\"object\",\"type\":\"UserRole\",\"relationName\":\"UserToUserRole\"},{\"name\":\"sessions\",\"kind\":\"object\",\"type\":\"Session\",\"relationName\":\"SessionToUser\"},{\"name\":\"accounts\",\"kind\":\"object\",\"type\":\"Account\",\"relationName\":\"AccountToUser\"},{\"name\":\"profile\",\"kind\":\"object\",\"type\":\"Profile\",\"relationName\":\"ProfileToUser\"},{\"name\":\"licenseKeys\",\"kind\":\"object\",\"type\":\"LicenseKey\",\"relationName\":\"LicenseKeyToUser\"},{\"name\":\"userProclamations\",\"kind\":\"object\",\"type\":\"UserProclamations\",\"relationName\":\"UserToUserProclamations\"}],\"dbName\":\"user\"},\"Profile\":{\"fields\":[{\"name\":\"id\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"userId\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"user\",\"kind\":\"object\",\"type\":\"User\",\"relationName\":\"ProfileToUser\"},{\"name\":\"firstName\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"lastName\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"phoneNumber\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"addresses\",\"kind\":\"object\",\"type\":\"Address\",\"relationName\":\"AddressToProfile\"}],\"dbName\":null},\"Address\":{\"fields\":[{\"name\":\"id\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"profileId\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"profile\",\"kind\":\"object\",\"type\":\"Profile\",\"relationName\":\"AddressToProfile\"},{\"name\":\"street\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"city\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"state\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"postalCode\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"country\",\"kind\":\"scalar\",\"type\":\"String\"}],\"dbName\":null},\"Session\":{\"fields\":[{\"name\":\"id\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"expiresAt\",\"kind\":\"scalar\",\"type\":\"DateTime\"},{\"name\":\"token\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"createdAt\",\"kind\":\"scalar\",\"type\":\"DateTime\"},{\"name\":\"updatedAt\",\"kind\":\"scalar\",\"type\":\"DateTime\"},{\"name\":\"ipAddress\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"userAgent\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"userId\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"user\",\"kind\":\"object\",\"type\":\"User\",\"relationName\":\"SessionToUser\"}],\"dbName\":\"session\"},\"Account\":{\"fields\":[{\"name\":\"id\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"accountId\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"providerId\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"userId\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"user\",\"kind\":\"object\",\"type\":\"User\",\"relationName\":\"AccountToUser\"},{\"name\":\"accessToken\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"refreshToken\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"idToken\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"accessTokenExpiresAt\",\"kind\":\"scalar\",\"type\":\"DateTime\"},{\"name\":\"refreshTokenExpiresAt\",\"kind\":\"scalar\",\"type\":\"DateTime\"},{\"name\":\"scope\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"password\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"createdAt\",\"kind\":\"scalar\",\"type\":\"DateTime\"},{\"name\":\"updatedAt\",\"kind\":\"scalar\",\"type\":\"DateTime\"}],\"dbName\":\"account\"},\"UserRole\":{\"fields\":[{\"name\":\"id\",\"kind\":\"scalar\",\"type\":\"Int\"},{\"name\":\"name\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"users\",\"kind\":\"object\",\"type\":\"User\",\"relationName\":\"UserToUserRole\"}],\"dbName\":null},\"Verification\":{\"fields\":[{\"name\":\"id\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"identifier\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"value\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"expiresAt\",\"kind\":\"scalar\",\"type\":\"DateTime\"},{\"name\":\"createdAt\",\"kind\":\"scalar\",\"type\":\"DateTime\"},{\"name\":\"updatedAt\",\"kind\":\"scalar\",\"type\":\"DateTime\"}],\"dbName\":\"verification\"},\"Proclamation\":{\"fields\":[{\"name\":\"id\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"name\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"content\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"solfeggioFrequencyId\",\"kind\":\"scalar\",\"type\":\"Int\"},{\"name\":\"solfeggioFrequency\",\"kind\":\"object\",\"type\":\"SolfeggioFrequency\",\"relationName\":\"ProclamationToSolfeggioFrequency\"},{\"name\":\"categoryId\",\"kind\":\"scalar\",\"type\":\"Int\"},{\"name\":\"category\",\"kind\":\"object\",\"type\":\"ProclamationCategory\",\"relationName\":\"ProclamationToProclamationCategory\"},{\"name\":\"price\",\"kind\":\"scalar\",\"type\":\"Float\"},{\"name\":\"userProclamations\",\"kind\":\"object\",\"type\":\"UserProclamations\",\"relationName\":\"ProclamationToUserProclamations\"}],\"dbName\":null},\"UserProclamations\":{\"fields\":[{\"name\":\"userId\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"user\",\"kind\":\"object\",\"type\":\"User\",\"relationName\":\"UserToUserProclamations\"},{\"name\":\"proclamationId\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"proclamation\",\"kind\":\"object\",\"type\":\"Proclamation\",\"relationName\":\"ProclamationToUserProclamations\"},{\"name\":\"createdAt\",\"kind\":\"scalar\",\"type\":\"DateTime\"},{\"name\":\"updatedAt\",\"kind\":\"scalar\",\"type\":\"DateTime\"}],\"dbName\":null},\"SolfeggioFrequency\":{\"fields\":[{\"name\":\"id\",\"kind\":\"scalar\",\"type\":\"Int\"},{\"name\":\"name\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"value\",\"kind\":\"scalar\",\"type\":\"Float\"},{\"name\":\"proclamations\",\"kind\":\"object\",\"type\":\"Proclamation\",\"relationName\":\"ProclamationToSolfeggioFrequency\"}],\"dbName\":null},\"ProclamationCategory\":{\"fields\":[{\"name\":\"id\",\"kind\":\"scalar\",\"type\":\"Int\"},{\"name\":\"name\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"parentId\",\"kind\":\"scalar\",\"type\":\"Int\"},{\"name\":\"parent\",\"kind\":\"object\",\"type\":\"ProclamationCategory\",\"relationName\":\"CategoryHierarchy\"},{\"name\":\"children\",\"kind\":\"object\",\"type\":\"ProclamationCategory\",\"relationName\":\"CategoryHierarchy\"},{\"name\":\"proclamations\",\"kind\":\"object\",\"type\":\"Proclamation\",\"relationName\":\"ProclamationToProclamationCategory\"}],\"dbName\":null},\"LicenseKey\":{\"fields\":[{\"name\":\"id\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"key\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"active\",\"kind\":\"scalar\",\"type\":\"Boolean\"},{\"name\":\"level\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"userId\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"user\",\"kind\":\"object\",\"type\":\"User\",\"relationName\":\"LicenseKeyToUser\"}],\"dbName\":null}},\"enums\":{},\"types\":{}}") async function decodeBase64AsWasm(wasmBase64: string): Promise { const { Buffer } = await import('node:buffer') @@ -254,6 +254,16 @@ export interface PrismaClient< */ get proclamation(): Prisma.ProclamationDelegate; + /** + * `prisma.userProclamations`: Exposes CRUD operations for the **UserProclamations** model. + * Example usage: + * ```ts + * // Fetch zero or more UserProclamations + * const userProclamations = await prisma.userProclamations.findMany() + * ``` + */ + get userProclamations(): Prisma.UserProclamationsDelegate; + /** * `prisma.solfeggioFrequency`: Exposes CRUD operations for the **SolfeggioFrequency** model. * Example usage: diff --git a/src/lib/generated/prisma/internal/prismaNamespace.ts b/src/lib/generated/prisma/internal/prismaNamespace.ts index 5e3cd2a..2d3cb5c 100644 --- a/src/lib/generated/prisma/internal/prismaNamespace.ts +++ b/src/lib/generated/prisma/internal/prismaNamespace.ts @@ -392,6 +392,7 @@ export const ModelName = { UserRole: 'UserRole', Verification: 'Verification', Proclamation: 'Proclamation', + UserProclamations: 'UserProclamations', SolfeggioFrequency: 'SolfeggioFrequency', ProclamationCategory: 'ProclamationCategory', LicenseKey: 'LicenseKey' @@ -410,7 +411,7 @@ export type TypeMap + fields: Prisma.UserProclamationsFieldRefs + operations: { + findUnique: { + args: Prisma.UserProclamationsFindUniqueArgs + result: runtime.Types.Utils.PayloadToResult | null + } + findUniqueOrThrow: { + args: Prisma.UserProclamationsFindUniqueOrThrowArgs + result: runtime.Types.Utils.PayloadToResult + } + findFirst: { + args: Prisma.UserProclamationsFindFirstArgs + result: runtime.Types.Utils.PayloadToResult | null + } + findFirstOrThrow: { + args: Prisma.UserProclamationsFindFirstOrThrowArgs + result: runtime.Types.Utils.PayloadToResult + } + findMany: { + args: Prisma.UserProclamationsFindManyArgs + result: runtime.Types.Utils.PayloadToResult[] + } + create: { + args: Prisma.UserProclamationsCreateArgs + result: runtime.Types.Utils.PayloadToResult + } + createMany: { + args: Prisma.UserProclamationsCreateManyArgs + result: BatchPayload + } + createManyAndReturn: { + args: Prisma.UserProclamationsCreateManyAndReturnArgs + result: runtime.Types.Utils.PayloadToResult[] + } + delete: { + args: Prisma.UserProclamationsDeleteArgs + result: runtime.Types.Utils.PayloadToResult + } + update: { + args: Prisma.UserProclamationsUpdateArgs + result: runtime.Types.Utils.PayloadToResult + } + deleteMany: { + args: Prisma.UserProclamationsDeleteManyArgs + result: BatchPayload + } + updateMany: { + args: Prisma.UserProclamationsUpdateManyArgs + result: BatchPayload + } + updateManyAndReturn: { + args: Prisma.UserProclamationsUpdateManyAndReturnArgs + result: runtime.Types.Utils.PayloadToResult[] + } + upsert: { + args: Prisma.UserProclamationsUpsertArgs + result: runtime.Types.Utils.PayloadToResult + } + aggregate: { + args: Prisma.UserProclamationsAggregateArgs + result: runtime.Types.Utils.Optional + } + groupBy: { + args: Prisma.UserProclamationsGroupByArgs + result: runtime.Types.Utils.Optional[] + } + count: { + args: Prisma.UserProclamationsCountArgs + result: runtime.Types.Utils.Optional | number + } + } + } SolfeggioFrequency: { payload: Prisma.$SolfeggioFrequencyPayload fields: Prisma.SolfeggioFrequencyFieldRefs @@ -1370,6 +1445,16 @@ export const ProclamationScalarFieldEnum = { export type ProclamationScalarFieldEnum = (typeof ProclamationScalarFieldEnum)[keyof typeof ProclamationScalarFieldEnum] +export const UserProclamationsScalarFieldEnum = { + userId: 'userId', + proclamationId: 'proclamationId', + createdAt: 'createdAt', + updatedAt: 'updatedAt' +} as const + +export type UserProclamationsScalarFieldEnum = (typeof UserProclamationsScalarFieldEnum)[keyof typeof UserProclamationsScalarFieldEnum] + + export const SolfeggioFrequencyScalarFieldEnum = { id: 'id', name: 'name', @@ -1594,6 +1679,7 @@ export type GlobalOmitConfig = { userRole?: Prisma.UserRoleOmit verification?: Prisma.VerificationOmit proclamation?: Prisma.ProclamationOmit + userProclamations?: Prisma.UserProclamationsOmit solfeggioFrequency?: Prisma.SolfeggioFrequencyOmit proclamationCategory?: Prisma.ProclamationCategoryOmit licenseKey?: Prisma.LicenseKeyOmit diff --git a/src/lib/generated/prisma/internal/prismaNamespaceBrowser.ts b/src/lib/generated/prisma/internal/prismaNamespaceBrowser.ts index f1d62d5..7ab0ab2 100644 --- a/src/lib/generated/prisma/internal/prismaNamespaceBrowser.ts +++ b/src/lib/generated/prisma/internal/prismaNamespaceBrowser.ts @@ -59,6 +59,7 @@ export const ModelName = { UserRole: 'UserRole', Verification: 'Verification', Proclamation: 'Proclamation', + UserProclamations: 'UserProclamations', SolfeggioFrequency: 'SolfeggioFrequency', ProclamationCategory: 'ProclamationCategory', LicenseKey: 'LicenseKey' @@ -183,6 +184,16 @@ export const ProclamationScalarFieldEnum = { export type ProclamationScalarFieldEnum = (typeof ProclamationScalarFieldEnum)[keyof typeof ProclamationScalarFieldEnum] +export const UserProclamationsScalarFieldEnum = { + userId: 'userId', + proclamationId: 'proclamationId', + createdAt: 'createdAt', + updatedAt: 'updatedAt' +} as const + +export type UserProclamationsScalarFieldEnum = (typeof UserProclamationsScalarFieldEnum)[keyof typeof UserProclamationsScalarFieldEnum] + + export const SolfeggioFrequencyScalarFieldEnum = { id: 'id', name: 'name', diff --git a/src/lib/generated/prisma/models.ts b/src/lib/generated/prisma/models.ts index 178d488..5438547 100644 --- a/src/lib/generated/prisma/models.ts +++ b/src/lib/generated/prisma/models.ts @@ -16,6 +16,7 @@ export type * from './models/Account.ts' export type * from './models/UserRole.ts' export type * from './models/Verification.ts' export type * from './models/Proclamation.ts' +export type * from './models/UserProclamations.ts' export type * from './models/SolfeggioFrequency.ts' export type * from './models/ProclamationCategory.ts' export type * from './models/LicenseKey.ts' diff --git a/src/lib/generated/prisma/models/LicenseKey.ts b/src/lib/generated/prisma/models/LicenseKey.ts index 1850322..d3795fb 100644 --- a/src/lib/generated/prisma/models/LicenseKey.ts +++ b/src/lib/generated/prisma/models/LicenseKey.ts @@ -196,15 +196,15 @@ export type LicenseKeyOrderByWithRelationInput = { export type LicenseKeyWhereUniqueInput = Prisma.AtLeast<{ id?: string + key?: string AND?: Prisma.LicenseKeyWhereInput | Prisma.LicenseKeyWhereInput[] OR?: Prisma.LicenseKeyWhereInput[] NOT?: Prisma.LicenseKeyWhereInput | Prisma.LicenseKeyWhereInput[] - key?: Prisma.StringFilter<"LicenseKey"> | string active?: Prisma.BoolFilter<"LicenseKey"> | boolean level?: Prisma.StringFilter<"LicenseKey"> | string userId?: Prisma.StringFilter<"LicenseKey"> | string user?: Prisma.XOR -}, "id"> +}, "id" | "key"> export type LicenseKeyOrderByWithAggregationInput = { id?: Prisma.SortOrder diff --git a/src/lib/generated/prisma/models/Proclamation.ts b/src/lib/generated/prisma/models/Proclamation.ts index 373bc74..514bf1f 100644 --- a/src/lib/generated/prisma/models/Proclamation.ts +++ b/src/lib/generated/prisma/models/Proclamation.ts @@ -234,6 +234,7 @@ export type ProclamationWhereInput = { price?: Prisma.FloatFilter<"Proclamation"> | number solfeggioFrequency?: Prisma.XOR category?: Prisma.XOR + userProclamations?: Prisma.UserProclamationsListRelationFilter } export type ProclamationOrderByWithRelationInput = { @@ -245,21 +246,23 @@ export type ProclamationOrderByWithRelationInput = { price?: Prisma.SortOrder solfeggioFrequency?: Prisma.SolfeggioFrequencyOrderByWithRelationInput category?: Prisma.ProclamationCategoryOrderByWithRelationInput + userProclamations?: Prisma.UserProclamationsOrderByRelationAggregateInput } export type ProclamationWhereUniqueInput = Prisma.AtLeast<{ id?: string name?: string - content?: string AND?: Prisma.ProclamationWhereInput | Prisma.ProclamationWhereInput[] OR?: Prisma.ProclamationWhereInput[] NOT?: Prisma.ProclamationWhereInput | Prisma.ProclamationWhereInput[] + content?: Prisma.StringFilter<"Proclamation"> | string solfeggioFrequencyId?: Prisma.IntFilter<"Proclamation"> | number categoryId?: Prisma.IntFilter<"Proclamation"> | number price?: Prisma.FloatFilter<"Proclamation"> | number solfeggioFrequency?: Prisma.XOR category?: Prisma.XOR -}, "id" | "name" | "content"> + userProclamations?: Prisma.UserProclamationsListRelationFilter +}, "id" | "name"> export type ProclamationOrderByWithAggregationInput = { id?: Prisma.SortOrder @@ -294,6 +297,7 @@ export type ProclamationCreateInput = { price?: number solfeggioFrequency: Prisma.SolfeggioFrequencyCreateNestedOneWithoutProclamationsInput category: Prisma.ProclamationCategoryCreateNestedOneWithoutProclamationsInput + userProclamations?: Prisma.UserProclamationsCreateNestedManyWithoutProclamationInput } export type ProclamationUncheckedCreateInput = { @@ -303,6 +307,7 @@ export type ProclamationUncheckedCreateInput = { solfeggioFrequencyId: number categoryId: number price?: number + userProclamations?: Prisma.UserProclamationsUncheckedCreateNestedManyWithoutProclamationInput } export type ProclamationUpdateInput = { @@ -312,6 +317,7 @@ export type ProclamationUpdateInput = { price?: Prisma.FloatFieldUpdateOperationsInput | number solfeggioFrequency?: Prisma.SolfeggioFrequencyUpdateOneRequiredWithoutProclamationsNestedInput category?: Prisma.ProclamationCategoryUpdateOneRequiredWithoutProclamationsNestedInput + userProclamations?: Prisma.UserProclamationsUpdateManyWithoutProclamationNestedInput } export type ProclamationUncheckedUpdateInput = { @@ -321,6 +327,7 @@ export type ProclamationUncheckedUpdateInput = { solfeggioFrequencyId?: Prisma.IntFieldUpdateOperationsInput | number categoryId?: Prisma.IntFieldUpdateOperationsInput | number price?: Prisma.FloatFieldUpdateOperationsInput | number + userProclamations?: Prisma.UserProclamationsUncheckedUpdateManyWithoutProclamationNestedInput } export type ProclamationCreateManyInput = { @@ -387,6 +394,11 @@ export type ProclamationSumOrderByAggregateInput = { price?: Prisma.SortOrder } +export type ProclamationScalarRelationFilter = { + is?: Prisma.ProclamationWhereInput + isNot?: Prisma.ProclamationWhereInput +} + export type ProclamationListRelationFilter = { every?: Prisma.ProclamationWhereInput some?: Prisma.ProclamationWhereInput @@ -405,6 +417,20 @@ export type FloatFieldUpdateOperationsInput = { divide?: number } +export type ProclamationCreateNestedOneWithoutUserProclamationsInput = { + create?: Prisma.XOR + connectOrCreate?: Prisma.ProclamationCreateOrConnectWithoutUserProclamationsInput + connect?: Prisma.ProclamationWhereUniqueInput +} + +export type ProclamationUpdateOneRequiredWithoutUserProclamationsNestedInput = { + create?: Prisma.XOR + connectOrCreate?: Prisma.ProclamationCreateOrConnectWithoutUserProclamationsInput + upsert?: Prisma.ProclamationUpsertWithoutUserProclamationsInput + connect?: Prisma.ProclamationWhereUniqueInput + update?: Prisma.XOR, Prisma.ProclamationUncheckedUpdateWithoutUserProclamationsInput> +} + export type ProclamationCreateNestedManyWithoutSolfeggioFrequencyInput = { create?: Prisma.XOR | Prisma.ProclamationCreateWithoutSolfeggioFrequencyInput[] | Prisma.ProclamationUncheckedCreateWithoutSolfeggioFrequencyInput[] connectOrCreate?: Prisma.ProclamationCreateOrConnectWithoutSolfeggioFrequencyInput | Prisma.ProclamationCreateOrConnectWithoutSolfeggioFrequencyInput[] @@ -489,12 +515,65 @@ export type ProclamationUncheckedUpdateManyWithoutCategoryNestedInput = { deleteMany?: Prisma.ProclamationScalarWhereInput | Prisma.ProclamationScalarWhereInput[] } +export type ProclamationCreateWithoutUserProclamationsInput = { + id?: string + name: string + content: string + price?: number + solfeggioFrequency: Prisma.SolfeggioFrequencyCreateNestedOneWithoutProclamationsInput + category: Prisma.ProclamationCategoryCreateNestedOneWithoutProclamationsInput +} + +export type ProclamationUncheckedCreateWithoutUserProclamationsInput = { + id?: string + name: string + content: string + solfeggioFrequencyId: number + categoryId: number + price?: number +} + +export type ProclamationCreateOrConnectWithoutUserProclamationsInput = { + where: Prisma.ProclamationWhereUniqueInput + create: Prisma.XOR +} + +export type ProclamationUpsertWithoutUserProclamationsInput = { + update: Prisma.XOR + create: Prisma.XOR + where?: Prisma.ProclamationWhereInput +} + +export type ProclamationUpdateToOneWithWhereWithoutUserProclamationsInput = { + where?: Prisma.ProclamationWhereInput + data: Prisma.XOR +} + +export type ProclamationUpdateWithoutUserProclamationsInput = { + id?: Prisma.StringFieldUpdateOperationsInput | string + name?: Prisma.StringFieldUpdateOperationsInput | string + content?: Prisma.StringFieldUpdateOperationsInput | string + price?: Prisma.FloatFieldUpdateOperationsInput | number + solfeggioFrequency?: Prisma.SolfeggioFrequencyUpdateOneRequiredWithoutProclamationsNestedInput + category?: Prisma.ProclamationCategoryUpdateOneRequiredWithoutProclamationsNestedInput +} + +export type ProclamationUncheckedUpdateWithoutUserProclamationsInput = { + id?: Prisma.StringFieldUpdateOperationsInput | string + name?: Prisma.StringFieldUpdateOperationsInput | string + content?: Prisma.StringFieldUpdateOperationsInput | string + solfeggioFrequencyId?: Prisma.IntFieldUpdateOperationsInput | number + categoryId?: Prisma.IntFieldUpdateOperationsInput | number + price?: Prisma.FloatFieldUpdateOperationsInput | number +} + export type ProclamationCreateWithoutSolfeggioFrequencyInput = { id?: string name: string content: string price?: number category: Prisma.ProclamationCategoryCreateNestedOneWithoutProclamationsInput + userProclamations?: Prisma.UserProclamationsCreateNestedManyWithoutProclamationInput } export type ProclamationUncheckedCreateWithoutSolfeggioFrequencyInput = { @@ -503,6 +582,7 @@ export type ProclamationUncheckedCreateWithoutSolfeggioFrequencyInput = { content: string categoryId: number price?: number + userProclamations?: Prisma.UserProclamationsUncheckedCreateNestedManyWithoutProclamationInput } export type ProclamationCreateOrConnectWithoutSolfeggioFrequencyInput = { @@ -549,6 +629,7 @@ export type ProclamationCreateWithoutCategoryInput = { content: string price?: number solfeggioFrequency: Prisma.SolfeggioFrequencyCreateNestedOneWithoutProclamationsInput + userProclamations?: Prisma.UserProclamationsCreateNestedManyWithoutProclamationInput } export type ProclamationUncheckedCreateWithoutCategoryInput = { @@ -557,6 +638,7 @@ export type ProclamationUncheckedCreateWithoutCategoryInput = { content: string solfeggioFrequencyId: number price?: number + userProclamations?: Prisma.UserProclamationsUncheckedCreateNestedManyWithoutProclamationInput } export type ProclamationCreateOrConnectWithoutCategoryInput = { @@ -599,6 +681,7 @@ export type ProclamationUpdateWithoutSolfeggioFrequencyInput = { content?: Prisma.StringFieldUpdateOperationsInput | string price?: Prisma.FloatFieldUpdateOperationsInput | number category?: Prisma.ProclamationCategoryUpdateOneRequiredWithoutProclamationsNestedInput + userProclamations?: Prisma.UserProclamationsUpdateManyWithoutProclamationNestedInput } export type ProclamationUncheckedUpdateWithoutSolfeggioFrequencyInput = { @@ -607,6 +690,7 @@ export type ProclamationUncheckedUpdateWithoutSolfeggioFrequencyInput = { content?: Prisma.StringFieldUpdateOperationsInput | string categoryId?: Prisma.IntFieldUpdateOperationsInput | number price?: Prisma.FloatFieldUpdateOperationsInput | number + userProclamations?: Prisma.UserProclamationsUncheckedUpdateManyWithoutProclamationNestedInput } export type ProclamationUncheckedUpdateManyWithoutSolfeggioFrequencyInput = { @@ -631,6 +715,7 @@ export type ProclamationUpdateWithoutCategoryInput = { content?: Prisma.StringFieldUpdateOperationsInput | string price?: Prisma.FloatFieldUpdateOperationsInput | number solfeggioFrequency?: Prisma.SolfeggioFrequencyUpdateOneRequiredWithoutProclamationsNestedInput + userProclamations?: Prisma.UserProclamationsUpdateManyWithoutProclamationNestedInput } export type ProclamationUncheckedUpdateWithoutCategoryInput = { @@ -639,6 +724,7 @@ export type ProclamationUncheckedUpdateWithoutCategoryInput = { content?: Prisma.StringFieldUpdateOperationsInput | string solfeggioFrequencyId?: Prisma.IntFieldUpdateOperationsInput | number price?: Prisma.FloatFieldUpdateOperationsInput | number + userProclamations?: Prisma.UserProclamationsUncheckedUpdateManyWithoutProclamationNestedInput } export type ProclamationUncheckedUpdateManyWithoutCategoryInput = { @@ -650,6 +736,35 @@ export type ProclamationUncheckedUpdateManyWithoutCategoryInput = { } +/** + * Count Type ProclamationCountOutputType + */ + +export type ProclamationCountOutputType = { + userProclamations: number +} + +export type ProclamationCountOutputTypeSelect = { + userProclamations?: boolean | ProclamationCountOutputTypeCountUserProclamationsArgs +} + +/** + * ProclamationCountOutputType without action + */ +export type ProclamationCountOutputTypeDefaultArgs = { + /** + * Select specific fields to fetch from the ProclamationCountOutputType + */ + select?: Prisma.ProclamationCountOutputTypeSelect | null +} + +/** + * ProclamationCountOutputType without action + */ +export type ProclamationCountOutputTypeCountUserProclamationsArgs = { + where?: Prisma.UserProclamationsWhereInput +} + export type ProclamationSelect = runtime.Types.Extensions.GetSelect<{ id?: boolean @@ -660,6 +775,8 @@ export type ProclamationSelect category?: boolean | Prisma.ProclamationCategoryDefaultArgs + userProclamations?: boolean | Prisma.Proclamation$userProclamationsArgs + _count?: boolean | Prisma.ProclamationCountOutputTypeDefaultArgs }, ExtArgs["result"]["proclamation"]> export type ProclamationSelectCreateManyAndReturn = runtime.Types.Extensions.GetSelect<{ @@ -697,6 +814,8 @@ export type ProclamationOmit = { solfeggioFrequency?: boolean | Prisma.SolfeggioFrequencyDefaultArgs category?: boolean | Prisma.ProclamationCategoryDefaultArgs + userProclamations?: boolean | Prisma.Proclamation$userProclamationsArgs + _count?: boolean | Prisma.ProclamationCountOutputTypeDefaultArgs } export type ProclamationIncludeCreateManyAndReturn = { solfeggioFrequency?: boolean | Prisma.SolfeggioFrequencyDefaultArgs @@ -712,6 +831,7 @@ export type $ProclamationPayload category: Prisma.$ProclamationCategoryPayload + userProclamations: Prisma.$UserProclamationsPayload[] } scalars: runtime.Types.Extensions.GetPayloadResult<{ id: string @@ -1116,6 +1236,7 @@ export interface Prisma__ProclamationClient = {}>(args?: Prisma.Subset>): Prisma.Prisma__SolfeggioFrequencyClient, T, "findUniqueOrThrow", GlobalOmitOptions> | Null, Null, ExtArgs, GlobalOmitOptions> category = {}>(args?: Prisma.Subset>): Prisma.Prisma__ProclamationCategoryClient, T, "findUniqueOrThrow", GlobalOmitOptions> | Null, Null, ExtArgs, GlobalOmitOptions> + userProclamations = {}>(args?: Prisma.Subset>): Prisma.PrismaPromise, T, "findMany", GlobalOmitOptions> | Null> /** * Attaches callbacks for the resolution and/or rejection of the Promise. * @param onfulfilled The callback to execute when the Promise is resolved. @@ -1546,6 +1667,30 @@ export type ProclamationDeleteManyArgs = { + /** + * Select specific fields to fetch from the UserProclamations + */ + select?: Prisma.UserProclamationsSelect | null + /** + * Omit specific fields from the UserProclamations + */ + omit?: Prisma.UserProclamationsOmit | null + /** + * Choose, which related nodes to fetch as well + */ + include?: Prisma.UserProclamationsInclude | null + where?: Prisma.UserProclamationsWhereInput + orderBy?: Prisma.UserProclamationsOrderByWithRelationInput | Prisma.UserProclamationsOrderByWithRelationInput[] + cursor?: Prisma.UserProclamationsWhereUniqueInput + take?: number + skip?: number + distinct?: Prisma.UserProclamationsScalarFieldEnum | Prisma.UserProclamationsScalarFieldEnum[] +} + /** * Proclamation without action */ diff --git a/src/lib/generated/prisma/models/ProclamationCategory.ts b/src/lib/generated/prisma/models/ProclamationCategory.ts index ee5f5f0..69f3c5b 100644 --- a/src/lib/generated/prisma/models/ProclamationCategory.ts +++ b/src/lib/generated/prisma/models/ProclamationCategory.ts @@ -220,15 +220,16 @@ export type ProclamationCategoryOrderByWithRelationInput = { export type ProclamationCategoryWhereUniqueInput = Prisma.AtLeast<{ id?: number - name?: string + parentId_name?: Prisma.ProclamationCategoryParentIdNameCompoundUniqueInput AND?: Prisma.ProclamationCategoryWhereInput | Prisma.ProclamationCategoryWhereInput[] OR?: Prisma.ProclamationCategoryWhereInput[] NOT?: Prisma.ProclamationCategoryWhereInput | Prisma.ProclamationCategoryWhereInput[] + name?: Prisma.StringFilter<"ProclamationCategory"> | string parentId?: Prisma.IntNullableFilter<"ProclamationCategory"> | number | null parent?: Prisma.XOR | null children?: Prisma.ProclamationCategoryListRelationFilter proclamations?: Prisma.ProclamationListRelationFilter -}, "id" | "name"> +}, "id" | "parentId_name"> export type ProclamationCategoryOrderByWithAggregationInput = { id?: Prisma.SortOrder @@ -316,6 +317,11 @@ export type ProclamationCategoryOrderByRelationAggregateInput = { _count?: Prisma.SortOrder } +export type ProclamationCategoryParentIdNameCompoundUniqueInput = { + parentId: number + name: string +} + export type ProclamationCategoryCountOrderByAggregateInput = { id?: Prisma.SortOrder name?: Prisma.SortOrder diff --git a/src/lib/generated/prisma/models/User.ts b/src/lib/generated/prisma/models/User.ts index 9758677..b346593 100644 --- a/src/lib/generated/prisma/models/User.ts +++ b/src/lib/generated/prisma/models/User.ts @@ -245,6 +245,7 @@ export type UserWhereInput = { accounts?: Prisma.AccountListRelationFilter profile?: Prisma.XOR | null licenseKeys?: Prisma.LicenseKeyListRelationFilter + userProclamations?: Prisma.UserProclamationsListRelationFilter } export type UserOrderByWithRelationInput = { @@ -261,6 +262,7 @@ export type UserOrderByWithRelationInput = { accounts?: Prisma.AccountOrderByRelationAggregateInput profile?: Prisma.ProfileOrderByWithRelationInput licenseKeys?: Prisma.LicenseKeyOrderByRelationAggregateInput + userProclamations?: Prisma.UserProclamationsOrderByRelationAggregateInput } export type UserWhereUniqueInput = Prisma.AtLeast<{ @@ -280,6 +282,7 @@ export type UserWhereUniqueInput = Prisma.AtLeast<{ accounts?: Prisma.AccountListRelationFilter profile?: Prisma.XOR | null licenseKeys?: Prisma.LicenseKeyListRelationFilter + userProclamations?: Prisma.UserProclamationsListRelationFilter }, "id" | "email"> export type UserOrderByWithAggregationInput = { @@ -325,6 +328,7 @@ export type UserCreateInput = { accounts?: Prisma.AccountCreateNestedManyWithoutUserInput profile?: Prisma.ProfileCreateNestedOneWithoutUserInput licenseKeys?: Prisma.LicenseKeyCreateNestedManyWithoutUserInput + userProclamations?: Prisma.UserProclamationsCreateNestedManyWithoutUserInput } export type UserUncheckedCreateInput = { @@ -340,6 +344,7 @@ export type UserUncheckedCreateInput = { accounts?: Prisma.AccountUncheckedCreateNestedManyWithoutUserInput profile?: Prisma.ProfileUncheckedCreateNestedOneWithoutUserInput licenseKeys?: Prisma.LicenseKeyUncheckedCreateNestedManyWithoutUserInput + userProclamations?: Prisma.UserProclamationsUncheckedCreateNestedManyWithoutUserInput } export type UserUpdateInput = { @@ -355,6 +360,7 @@ export type UserUpdateInput = { accounts?: Prisma.AccountUpdateManyWithoutUserNestedInput profile?: Prisma.ProfileUpdateOneWithoutUserNestedInput licenseKeys?: Prisma.LicenseKeyUpdateManyWithoutUserNestedInput + userProclamations?: Prisma.UserProclamationsUpdateManyWithoutUserNestedInput } export type UserUncheckedUpdateInput = { @@ -370,6 +376,7 @@ export type UserUncheckedUpdateInput = { accounts?: Prisma.AccountUncheckedUpdateManyWithoutUserNestedInput profile?: Prisma.ProfileUncheckedUpdateOneWithoutUserNestedInput licenseKeys?: Prisma.LicenseKeyUncheckedUpdateManyWithoutUserNestedInput + userProclamations?: Prisma.UserProclamationsUncheckedUpdateManyWithoutUserNestedInput } export type UserCreateManyInput = { @@ -568,6 +575,20 @@ export type UserUncheckedUpdateManyWithoutRoleNestedInput = { deleteMany?: Prisma.UserScalarWhereInput | Prisma.UserScalarWhereInput[] } +export type UserCreateNestedOneWithoutUserProclamationsInput = { + create?: Prisma.XOR + connectOrCreate?: Prisma.UserCreateOrConnectWithoutUserProclamationsInput + connect?: Prisma.UserWhereUniqueInput +} + +export type UserUpdateOneRequiredWithoutUserProclamationsNestedInput = { + create?: Prisma.XOR + connectOrCreate?: Prisma.UserCreateOrConnectWithoutUserProclamationsInput + upsert?: Prisma.UserUpsertWithoutUserProclamationsInput + connect?: Prisma.UserWhereUniqueInput + update?: Prisma.XOR, Prisma.UserUncheckedUpdateWithoutUserProclamationsInput> +} + export type UserCreateNestedOneWithoutLicenseKeysInput = { create?: Prisma.XOR connectOrCreate?: Prisma.UserCreateOrConnectWithoutLicenseKeysInput @@ -594,6 +615,7 @@ export type UserCreateWithoutProfileInput = { sessions?: Prisma.SessionCreateNestedManyWithoutUserInput accounts?: Prisma.AccountCreateNestedManyWithoutUserInput licenseKeys?: Prisma.LicenseKeyCreateNestedManyWithoutUserInput + userProclamations?: Prisma.UserProclamationsCreateNestedManyWithoutUserInput } export type UserUncheckedCreateWithoutProfileInput = { @@ -608,6 +630,7 @@ export type UserUncheckedCreateWithoutProfileInput = { sessions?: Prisma.SessionUncheckedCreateNestedManyWithoutUserInput accounts?: Prisma.AccountUncheckedCreateNestedManyWithoutUserInput licenseKeys?: Prisma.LicenseKeyUncheckedCreateNestedManyWithoutUserInput + userProclamations?: Prisma.UserProclamationsUncheckedCreateNestedManyWithoutUserInput } export type UserCreateOrConnectWithoutProfileInput = { @@ -638,6 +661,7 @@ export type UserUpdateWithoutProfileInput = { sessions?: Prisma.SessionUpdateManyWithoutUserNestedInput accounts?: Prisma.AccountUpdateManyWithoutUserNestedInput licenseKeys?: Prisma.LicenseKeyUpdateManyWithoutUserNestedInput + userProclamations?: Prisma.UserProclamationsUpdateManyWithoutUserNestedInput } export type UserUncheckedUpdateWithoutProfileInput = { @@ -652,6 +676,7 @@ export type UserUncheckedUpdateWithoutProfileInput = { sessions?: Prisma.SessionUncheckedUpdateManyWithoutUserNestedInput accounts?: Prisma.AccountUncheckedUpdateManyWithoutUserNestedInput licenseKeys?: Prisma.LicenseKeyUncheckedUpdateManyWithoutUserNestedInput + userProclamations?: Prisma.UserProclamationsUncheckedUpdateManyWithoutUserNestedInput } export type UserCreateWithoutSessionsInput = { @@ -666,6 +691,7 @@ export type UserCreateWithoutSessionsInput = { accounts?: Prisma.AccountCreateNestedManyWithoutUserInput profile?: Prisma.ProfileCreateNestedOneWithoutUserInput licenseKeys?: Prisma.LicenseKeyCreateNestedManyWithoutUserInput + userProclamations?: Prisma.UserProclamationsCreateNestedManyWithoutUserInput } export type UserUncheckedCreateWithoutSessionsInput = { @@ -680,6 +706,7 @@ export type UserUncheckedCreateWithoutSessionsInput = { accounts?: Prisma.AccountUncheckedCreateNestedManyWithoutUserInput profile?: Prisma.ProfileUncheckedCreateNestedOneWithoutUserInput licenseKeys?: Prisma.LicenseKeyUncheckedCreateNestedManyWithoutUserInput + userProclamations?: Prisma.UserProclamationsUncheckedCreateNestedManyWithoutUserInput } export type UserCreateOrConnectWithoutSessionsInput = { @@ -710,6 +737,7 @@ export type UserUpdateWithoutSessionsInput = { accounts?: Prisma.AccountUpdateManyWithoutUserNestedInput profile?: Prisma.ProfileUpdateOneWithoutUserNestedInput licenseKeys?: Prisma.LicenseKeyUpdateManyWithoutUserNestedInput + userProclamations?: Prisma.UserProclamationsUpdateManyWithoutUserNestedInput } export type UserUncheckedUpdateWithoutSessionsInput = { @@ -724,6 +752,7 @@ export type UserUncheckedUpdateWithoutSessionsInput = { accounts?: Prisma.AccountUncheckedUpdateManyWithoutUserNestedInput profile?: Prisma.ProfileUncheckedUpdateOneWithoutUserNestedInput licenseKeys?: Prisma.LicenseKeyUncheckedUpdateManyWithoutUserNestedInput + userProclamations?: Prisma.UserProclamationsUncheckedUpdateManyWithoutUserNestedInput } export type UserCreateWithoutAccountsInput = { @@ -738,6 +767,7 @@ export type UserCreateWithoutAccountsInput = { sessions?: Prisma.SessionCreateNestedManyWithoutUserInput profile?: Prisma.ProfileCreateNestedOneWithoutUserInput licenseKeys?: Prisma.LicenseKeyCreateNestedManyWithoutUserInput + userProclamations?: Prisma.UserProclamationsCreateNestedManyWithoutUserInput } export type UserUncheckedCreateWithoutAccountsInput = { @@ -752,6 +782,7 @@ export type UserUncheckedCreateWithoutAccountsInput = { sessions?: Prisma.SessionUncheckedCreateNestedManyWithoutUserInput profile?: Prisma.ProfileUncheckedCreateNestedOneWithoutUserInput licenseKeys?: Prisma.LicenseKeyUncheckedCreateNestedManyWithoutUserInput + userProclamations?: Prisma.UserProclamationsUncheckedCreateNestedManyWithoutUserInput } export type UserCreateOrConnectWithoutAccountsInput = { @@ -782,6 +813,7 @@ export type UserUpdateWithoutAccountsInput = { sessions?: Prisma.SessionUpdateManyWithoutUserNestedInput profile?: Prisma.ProfileUpdateOneWithoutUserNestedInput licenseKeys?: Prisma.LicenseKeyUpdateManyWithoutUserNestedInput + userProclamations?: Prisma.UserProclamationsUpdateManyWithoutUserNestedInput } export type UserUncheckedUpdateWithoutAccountsInput = { @@ -796,6 +828,7 @@ export type UserUncheckedUpdateWithoutAccountsInput = { sessions?: Prisma.SessionUncheckedUpdateManyWithoutUserNestedInput profile?: Prisma.ProfileUncheckedUpdateOneWithoutUserNestedInput licenseKeys?: Prisma.LicenseKeyUncheckedUpdateManyWithoutUserNestedInput + userProclamations?: Prisma.UserProclamationsUncheckedUpdateManyWithoutUserNestedInput } export type UserCreateWithoutRoleInput = { @@ -810,6 +843,7 @@ export type UserCreateWithoutRoleInput = { accounts?: Prisma.AccountCreateNestedManyWithoutUserInput profile?: Prisma.ProfileCreateNestedOneWithoutUserInput licenseKeys?: Prisma.LicenseKeyCreateNestedManyWithoutUserInput + userProclamations?: Prisma.UserProclamationsCreateNestedManyWithoutUserInput } export type UserUncheckedCreateWithoutRoleInput = { @@ -824,6 +858,7 @@ export type UserUncheckedCreateWithoutRoleInput = { accounts?: Prisma.AccountUncheckedCreateNestedManyWithoutUserInput profile?: Prisma.ProfileUncheckedCreateNestedOneWithoutUserInput licenseKeys?: Prisma.LicenseKeyUncheckedCreateNestedManyWithoutUserInput + userProclamations?: Prisma.UserProclamationsUncheckedCreateNestedManyWithoutUserInput } export type UserCreateOrConnectWithoutRoleInput = { @@ -866,6 +901,82 @@ export type UserScalarWhereInput = { roleId?: Prisma.IntNullableFilter<"User"> | number | null } +export type UserCreateWithoutUserProclamationsInput = { + id: string + name: string + email: string + emailVerified?: boolean + image?: string | null + createdAt?: Date | string + updatedAt?: Date | string + role?: Prisma.UserRoleCreateNestedOneWithoutUsersInput + sessions?: Prisma.SessionCreateNestedManyWithoutUserInput + accounts?: Prisma.AccountCreateNestedManyWithoutUserInput + profile?: Prisma.ProfileCreateNestedOneWithoutUserInput + licenseKeys?: Prisma.LicenseKeyCreateNestedManyWithoutUserInput +} + +export type UserUncheckedCreateWithoutUserProclamationsInput = { + id: string + name: string + email: string + emailVerified?: boolean + image?: string | null + createdAt?: Date | string + updatedAt?: Date | string + roleId?: number | null + sessions?: Prisma.SessionUncheckedCreateNestedManyWithoutUserInput + accounts?: Prisma.AccountUncheckedCreateNestedManyWithoutUserInput + profile?: Prisma.ProfileUncheckedCreateNestedOneWithoutUserInput + licenseKeys?: Prisma.LicenseKeyUncheckedCreateNestedManyWithoutUserInput +} + +export type UserCreateOrConnectWithoutUserProclamationsInput = { + where: Prisma.UserWhereUniqueInput + create: Prisma.XOR +} + +export type UserUpsertWithoutUserProclamationsInput = { + update: Prisma.XOR + create: Prisma.XOR + where?: Prisma.UserWhereInput +} + +export type UserUpdateToOneWithWhereWithoutUserProclamationsInput = { + where?: Prisma.UserWhereInput + data: Prisma.XOR +} + +export type UserUpdateWithoutUserProclamationsInput = { + id?: Prisma.StringFieldUpdateOperationsInput | string + name?: Prisma.StringFieldUpdateOperationsInput | string + email?: Prisma.StringFieldUpdateOperationsInput | string + emailVerified?: Prisma.BoolFieldUpdateOperationsInput | boolean + image?: Prisma.NullableStringFieldUpdateOperationsInput | string | null + createdAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string + updatedAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string + role?: Prisma.UserRoleUpdateOneWithoutUsersNestedInput + sessions?: Prisma.SessionUpdateManyWithoutUserNestedInput + accounts?: Prisma.AccountUpdateManyWithoutUserNestedInput + profile?: Prisma.ProfileUpdateOneWithoutUserNestedInput + licenseKeys?: Prisma.LicenseKeyUpdateManyWithoutUserNestedInput +} + +export type UserUncheckedUpdateWithoutUserProclamationsInput = { + id?: Prisma.StringFieldUpdateOperationsInput | string + name?: Prisma.StringFieldUpdateOperationsInput | string + email?: Prisma.StringFieldUpdateOperationsInput | string + emailVerified?: Prisma.BoolFieldUpdateOperationsInput | boolean + image?: Prisma.NullableStringFieldUpdateOperationsInput | string | null + createdAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string + updatedAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string + roleId?: Prisma.NullableIntFieldUpdateOperationsInput | number | null + sessions?: Prisma.SessionUncheckedUpdateManyWithoutUserNestedInput + accounts?: Prisma.AccountUncheckedUpdateManyWithoutUserNestedInput + profile?: Prisma.ProfileUncheckedUpdateOneWithoutUserNestedInput + licenseKeys?: Prisma.LicenseKeyUncheckedUpdateManyWithoutUserNestedInput +} + export type UserCreateWithoutLicenseKeysInput = { id: string name: string @@ -878,6 +989,7 @@ export type UserCreateWithoutLicenseKeysInput = { sessions?: Prisma.SessionCreateNestedManyWithoutUserInput accounts?: Prisma.AccountCreateNestedManyWithoutUserInput profile?: Prisma.ProfileCreateNestedOneWithoutUserInput + userProclamations?: Prisma.UserProclamationsCreateNestedManyWithoutUserInput } export type UserUncheckedCreateWithoutLicenseKeysInput = { @@ -892,6 +1004,7 @@ export type UserUncheckedCreateWithoutLicenseKeysInput = { sessions?: Prisma.SessionUncheckedCreateNestedManyWithoutUserInput accounts?: Prisma.AccountUncheckedCreateNestedManyWithoutUserInput profile?: Prisma.ProfileUncheckedCreateNestedOneWithoutUserInput + userProclamations?: Prisma.UserProclamationsUncheckedCreateNestedManyWithoutUserInput } export type UserCreateOrConnectWithoutLicenseKeysInput = { @@ -922,6 +1035,7 @@ export type UserUpdateWithoutLicenseKeysInput = { sessions?: Prisma.SessionUpdateManyWithoutUserNestedInput accounts?: Prisma.AccountUpdateManyWithoutUserNestedInput profile?: Prisma.ProfileUpdateOneWithoutUserNestedInput + userProclamations?: Prisma.UserProclamationsUpdateManyWithoutUserNestedInput } export type UserUncheckedUpdateWithoutLicenseKeysInput = { @@ -936,6 +1050,7 @@ export type UserUncheckedUpdateWithoutLicenseKeysInput = { sessions?: Prisma.SessionUncheckedUpdateManyWithoutUserNestedInput accounts?: Prisma.AccountUncheckedUpdateManyWithoutUserNestedInput profile?: Prisma.ProfileUncheckedUpdateOneWithoutUserNestedInput + userProclamations?: Prisma.UserProclamationsUncheckedUpdateManyWithoutUserNestedInput } export type UserCreateManyRoleInput = { @@ -960,6 +1075,7 @@ export type UserUpdateWithoutRoleInput = { accounts?: Prisma.AccountUpdateManyWithoutUserNestedInput profile?: Prisma.ProfileUpdateOneWithoutUserNestedInput licenseKeys?: Prisma.LicenseKeyUpdateManyWithoutUserNestedInput + userProclamations?: Prisma.UserProclamationsUpdateManyWithoutUserNestedInput } export type UserUncheckedUpdateWithoutRoleInput = { @@ -974,6 +1090,7 @@ export type UserUncheckedUpdateWithoutRoleInput = { accounts?: Prisma.AccountUncheckedUpdateManyWithoutUserNestedInput profile?: Prisma.ProfileUncheckedUpdateOneWithoutUserNestedInput licenseKeys?: Prisma.LicenseKeyUncheckedUpdateManyWithoutUserNestedInput + userProclamations?: Prisma.UserProclamationsUncheckedUpdateManyWithoutUserNestedInput } export type UserUncheckedUpdateManyWithoutRoleInput = { @@ -995,12 +1112,14 @@ export type UserCountOutputType = { sessions: number accounts: number licenseKeys: number + userProclamations: number } export type UserCountOutputTypeSelect = { sessions?: boolean | UserCountOutputTypeCountSessionsArgs accounts?: boolean | UserCountOutputTypeCountAccountsArgs licenseKeys?: boolean | UserCountOutputTypeCountLicenseKeysArgs + userProclamations?: boolean | UserCountOutputTypeCountUserProclamationsArgs } /** @@ -1034,6 +1153,13 @@ export type UserCountOutputTypeCountLicenseKeysArgs = { + where?: Prisma.UserProclamationsWhereInput +} + export type UserSelect = runtime.Types.Extensions.GetSelect<{ id?: boolean @@ -1049,6 +1175,7 @@ export type UserSelect profile?: boolean | Prisma.User$profileArgs licenseKeys?: boolean | Prisma.User$licenseKeysArgs + userProclamations?: boolean | Prisma.User$userProclamationsArgs _count?: boolean | Prisma.UserCountOutputTypeDefaultArgs }, ExtArgs["result"]["user"]> @@ -1094,6 +1221,7 @@ export type UserInclude profile?: boolean | Prisma.User$profileArgs licenseKeys?: boolean | Prisma.User$licenseKeysArgs + userProclamations?: boolean | Prisma.User$userProclamationsArgs _count?: boolean | Prisma.UserCountOutputTypeDefaultArgs } export type UserIncludeCreateManyAndReturn = { @@ -1111,6 +1239,7 @@ export type $UserPayload[] profile: Prisma.$ProfilePayload | null licenseKeys: Prisma.$LicenseKeyPayload[] + userProclamations: Prisma.$UserProclamationsPayload[] } scalars: runtime.Types.Extensions.GetPayloadResult<{ id: string @@ -1520,6 +1649,7 @@ export interface Prisma__UserClient = {}>(args?: Prisma.Subset>): Prisma.PrismaPromise, T, "findMany", GlobalOmitOptions> | Null> profile = {}>(args?: Prisma.Subset>): Prisma.Prisma__ProfileClient, T, "findUniqueOrThrow", GlobalOmitOptions> | null, null, ExtArgs, GlobalOmitOptions> licenseKeys = {}>(args?: Prisma.Subset>): Prisma.PrismaPromise, T, "findMany", GlobalOmitOptions> | Null> + userProclamations = {}>(args?: Prisma.Subset>): Prisma.PrismaPromise, T, "findMany", GlobalOmitOptions> | Null> /** * Attaches callbacks for the resolution and/or rejection of the Promise. * @param onfulfilled The callback to execute when the Promise is resolved. @@ -2062,6 +2192,30 @@ export type User$licenseKeysArgs = { + /** + * Select specific fields to fetch from the UserProclamations + */ + select?: Prisma.UserProclamationsSelect | null + /** + * Omit specific fields from the UserProclamations + */ + omit?: Prisma.UserProclamationsOmit | null + /** + * Choose, which related nodes to fetch as well + */ + include?: Prisma.UserProclamationsInclude | null + where?: Prisma.UserProclamationsWhereInput + orderBy?: Prisma.UserProclamationsOrderByWithRelationInput | Prisma.UserProclamationsOrderByWithRelationInput[] + cursor?: Prisma.UserProclamationsWhereUniqueInput + take?: number + skip?: number + distinct?: Prisma.UserProclamationsScalarFieldEnum | Prisma.UserProclamationsScalarFieldEnum[] +} + /** * User without action */ diff --git a/src/lib/generated/prisma/models/UserProclamations.ts b/src/lib/generated/prisma/models/UserProclamations.ts new file mode 100644 index 0000000..36d432d --- /dev/null +++ b/src/lib/generated/prisma/models/UserProclamations.ts @@ -0,0 +1,1425 @@ + +/* !!! This is code generated by Prisma. Do not edit directly. !!! */ +/* eslint-disable */ +// biome-ignore-all lint: generated file +// @ts-nocheck +/* + * This file exports the `UserProclamations` model and its related types. + * + * 🟢 You can import this file directly. + */ +import type * as runtime from "@prisma/client/runtime/client" +import type * as $Enums from "../enums.ts" +import type * as Prisma from "../internal/prismaNamespace.ts" + +/** + * Model UserProclamations + * + */ +export type UserProclamationsModel = runtime.Types.Result.DefaultSelection + +export type AggregateUserProclamations = { + _count: UserProclamationsCountAggregateOutputType | null + _min: UserProclamationsMinAggregateOutputType | null + _max: UserProclamationsMaxAggregateOutputType | null +} + +export type UserProclamationsMinAggregateOutputType = { + userId: string | null + proclamationId: string | null + createdAt: Date | null + updatedAt: Date | null +} + +export type UserProclamationsMaxAggregateOutputType = { + userId: string | null + proclamationId: string | null + createdAt: Date | null + updatedAt: Date | null +} + +export type UserProclamationsCountAggregateOutputType = { + userId: number + proclamationId: number + createdAt: number + updatedAt: number + _all: number +} + + +export type UserProclamationsMinAggregateInputType = { + userId?: true + proclamationId?: true + createdAt?: true + updatedAt?: true +} + +export type UserProclamationsMaxAggregateInputType = { + userId?: true + proclamationId?: true + createdAt?: true + updatedAt?: true +} + +export type UserProclamationsCountAggregateInputType = { + userId?: true + proclamationId?: true + createdAt?: true + updatedAt?: true + _all?: true +} + +export type UserProclamationsAggregateArgs = { + /** + * Filter which UserProclamations to aggregate. + */ + where?: Prisma.UserProclamationsWhereInput + /** + * {@link https://www.prisma.io/docs/concepts/components/prisma-client/sorting Sorting Docs} + * + * Determine the order of UserProclamations to fetch. + */ + orderBy?: Prisma.UserProclamationsOrderByWithRelationInput | Prisma.UserProclamationsOrderByWithRelationInput[] + /** + * {@link https://www.prisma.io/docs/concepts/components/prisma-client/pagination#cursor-based-pagination Cursor Docs} + * + * Sets the start position + */ + cursor?: Prisma.UserProclamationsWhereUniqueInput + /** + * {@link https://www.prisma.io/docs/concepts/components/prisma-client/pagination Pagination Docs} + * + * Take `±n` UserProclamations from the position of the cursor. + */ + take?: number + /** + * {@link https://www.prisma.io/docs/concepts/components/prisma-client/pagination Pagination Docs} + * + * Skip the first `n` UserProclamations. + */ + skip?: number + /** + * {@link https://www.prisma.io/docs/concepts/components/prisma-client/aggregations Aggregation Docs} + * + * Count returned UserProclamations + **/ + _count?: true | UserProclamationsCountAggregateInputType + /** + * {@link https://www.prisma.io/docs/concepts/components/prisma-client/aggregations Aggregation Docs} + * + * Select which fields to find the minimum value + **/ + _min?: UserProclamationsMinAggregateInputType + /** + * {@link https://www.prisma.io/docs/concepts/components/prisma-client/aggregations Aggregation Docs} + * + * Select which fields to find the maximum value + **/ + _max?: UserProclamationsMaxAggregateInputType +} + +export type GetUserProclamationsAggregateType = { + [P in keyof T & keyof AggregateUserProclamations]: P extends '_count' | 'count' + ? T[P] extends true + ? number + : Prisma.GetScalarType + : Prisma.GetScalarType +} + + + + +export type UserProclamationsGroupByArgs = { + where?: Prisma.UserProclamationsWhereInput + orderBy?: Prisma.UserProclamationsOrderByWithAggregationInput | Prisma.UserProclamationsOrderByWithAggregationInput[] + by: Prisma.UserProclamationsScalarFieldEnum[] | Prisma.UserProclamationsScalarFieldEnum + having?: Prisma.UserProclamationsScalarWhereWithAggregatesInput + take?: number + skip?: number + _count?: UserProclamationsCountAggregateInputType | true + _min?: UserProclamationsMinAggregateInputType + _max?: UserProclamationsMaxAggregateInputType +} + +export type UserProclamationsGroupByOutputType = { + userId: string + proclamationId: string + createdAt: Date + updatedAt: Date + _count: UserProclamationsCountAggregateOutputType | null + _min: UserProclamationsMinAggregateOutputType | null + _max: UserProclamationsMaxAggregateOutputType | null +} + +type GetUserProclamationsGroupByPayload = Prisma.PrismaPromise< + Array< + Prisma.PickEnumerable & + { + [P in ((keyof T) & (keyof UserProclamationsGroupByOutputType))]: P extends '_count' + ? T[P] extends boolean + ? number + : Prisma.GetScalarType + : Prisma.GetScalarType + } + > + > + + + +export type UserProclamationsWhereInput = { + AND?: Prisma.UserProclamationsWhereInput | Prisma.UserProclamationsWhereInput[] + OR?: Prisma.UserProclamationsWhereInput[] + NOT?: Prisma.UserProclamationsWhereInput | Prisma.UserProclamationsWhereInput[] + userId?: Prisma.StringFilter<"UserProclamations"> | string + proclamationId?: Prisma.StringFilter<"UserProclamations"> | string + createdAt?: Prisma.DateTimeFilter<"UserProclamations"> | Date | string + updatedAt?: Prisma.DateTimeFilter<"UserProclamations"> | Date | string + user?: Prisma.XOR + proclamation?: Prisma.XOR +} + +export type UserProclamationsOrderByWithRelationInput = { + userId?: Prisma.SortOrder + proclamationId?: Prisma.SortOrder + createdAt?: Prisma.SortOrder + updatedAt?: Prisma.SortOrder + user?: Prisma.UserOrderByWithRelationInput + proclamation?: Prisma.ProclamationOrderByWithRelationInput +} + +export type UserProclamationsWhereUniqueInput = Prisma.AtLeast<{ + userId_proclamationId?: Prisma.UserProclamationsUserIdProclamationIdCompoundUniqueInput + AND?: Prisma.UserProclamationsWhereInput | Prisma.UserProclamationsWhereInput[] + OR?: Prisma.UserProclamationsWhereInput[] + NOT?: Prisma.UserProclamationsWhereInput | Prisma.UserProclamationsWhereInput[] + userId?: Prisma.StringFilter<"UserProclamations"> | string + proclamationId?: Prisma.StringFilter<"UserProclamations"> | string + createdAt?: Prisma.DateTimeFilter<"UserProclamations"> | Date | string + updatedAt?: Prisma.DateTimeFilter<"UserProclamations"> | Date | string + user?: Prisma.XOR + proclamation?: Prisma.XOR +}, "userId_proclamationId"> + +export type UserProclamationsOrderByWithAggregationInput = { + userId?: Prisma.SortOrder + proclamationId?: Prisma.SortOrder + createdAt?: Prisma.SortOrder + updatedAt?: Prisma.SortOrder + _count?: Prisma.UserProclamationsCountOrderByAggregateInput + _max?: Prisma.UserProclamationsMaxOrderByAggregateInput + _min?: Prisma.UserProclamationsMinOrderByAggregateInput +} + +export type UserProclamationsScalarWhereWithAggregatesInput = { + AND?: Prisma.UserProclamationsScalarWhereWithAggregatesInput | Prisma.UserProclamationsScalarWhereWithAggregatesInput[] + OR?: Prisma.UserProclamationsScalarWhereWithAggregatesInput[] + NOT?: Prisma.UserProclamationsScalarWhereWithAggregatesInput | Prisma.UserProclamationsScalarWhereWithAggregatesInput[] + userId?: Prisma.StringWithAggregatesFilter<"UserProclamations"> | string + proclamationId?: Prisma.StringWithAggregatesFilter<"UserProclamations"> | string + createdAt?: Prisma.DateTimeWithAggregatesFilter<"UserProclamations"> | Date | string + updatedAt?: Prisma.DateTimeWithAggregatesFilter<"UserProclamations"> | Date | string +} + +export type UserProclamationsCreateInput = { + createdAt?: Date | string + updatedAt?: Date | string + user: Prisma.UserCreateNestedOneWithoutUserProclamationsInput + proclamation: Prisma.ProclamationCreateNestedOneWithoutUserProclamationsInput +} + +export type UserProclamationsUncheckedCreateInput = { + userId: string + proclamationId: string + createdAt?: Date | string + updatedAt?: Date | string +} + +export type UserProclamationsUpdateInput = { + createdAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string + updatedAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string + user?: Prisma.UserUpdateOneRequiredWithoutUserProclamationsNestedInput + proclamation?: Prisma.ProclamationUpdateOneRequiredWithoutUserProclamationsNestedInput +} + +export type UserProclamationsUncheckedUpdateInput = { + userId?: Prisma.StringFieldUpdateOperationsInput | string + proclamationId?: Prisma.StringFieldUpdateOperationsInput | string + createdAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string + updatedAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string +} + +export type UserProclamationsCreateManyInput = { + userId: string + proclamationId: string + createdAt?: Date | string + updatedAt?: Date | string +} + +export type UserProclamationsUpdateManyMutationInput = { + createdAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string + updatedAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string +} + +export type UserProclamationsUncheckedUpdateManyInput = { + userId?: Prisma.StringFieldUpdateOperationsInput | string + proclamationId?: Prisma.StringFieldUpdateOperationsInput | string + createdAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string + updatedAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string +} + +export type UserProclamationsListRelationFilter = { + every?: Prisma.UserProclamationsWhereInput + some?: Prisma.UserProclamationsWhereInput + none?: Prisma.UserProclamationsWhereInput +} + +export type UserProclamationsOrderByRelationAggregateInput = { + _count?: Prisma.SortOrder +} + +export type UserProclamationsUserIdProclamationIdCompoundUniqueInput = { + userId: string + proclamationId: string +} + +export type UserProclamationsCountOrderByAggregateInput = { + userId?: Prisma.SortOrder + proclamationId?: Prisma.SortOrder + createdAt?: Prisma.SortOrder + updatedAt?: Prisma.SortOrder +} + +export type UserProclamationsMaxOrderByAggregateInput = { + userId?: Prisma.SortOrder + proclamationId?: Prisma.SortOrder + createdAt?: Prisma.SortOrder + updatedAt?: Prisma.SortOrder +} + +export type UserProclamationsMinOrderByAggregateInput = { + userId?: Prisma.SortOrder + proclamationId?: Prisma.SortOrder + createdAt?: Prisma.SortOrder + updatedAt?: Prisma.SortOrder +} + +export type UserProclamationsCreateNestedManyWithoutUserInput = { + create?: Prisma.XOR | Prisma.UserProclamationsCreateWithoutUserInput[] | Prisma.UserProclamationsUncheckedCreateWithoutUserInput[] + connectOrCreate?: Prisma.UserProclamationsCreateOrConnectWithoutUserInput | Prisma.UserProclamationsCreateOrConnectWithoutUserInput[] + createMany?: Prisma.UserProclamationsCreateManyUserInputEnvelope + connect?: Prisma.UserProclamationsWhereUniqueInput | Prisma.UserProclamationsWhereUniqueInput[] +} + +export type UserProclamationsUncheckedCreateNestedManyWithoutUserInput = { + create?: Prisma.XOR | Prisma.UserProclamationsCreateWithoutUserInput[] | Prisma.UserProclamationsUncheckedCreateWithoutUserInput[] + connectOrCreate?: Prisma.UserProclamationsCreateOrConnectWithoutUserInput | Prisma.UserProclamationsCreateOrConnectWithoutUserInput[] + createMany?: Prisma.UserProclamationsCreateManyUserInputEnvelope + connect?: Prisma.UserProclamationsWhereUniqueInput | Prisma.UserProclamationsWhereUniqueInput[] +} + +export type UserProclamationsUpdateManyWithoutUserNestedInput = { + create?: Prisma.XOR | Prisma.UserProclamationsCreateWithoutUserInput[] | Prisma.UserProclamationsUncheckedCreateWithoutUserInput[] + connectOrCreate?: Prisma.UserProclamationsCreateOrConnectWithoutUserInput | Prisma.UserProclamationsCreateOrConnectWithoutUserInput[] + upsert?: Prisma.UserProclamationsUpsertWithWhereUniqueWithoutUserInput | Prisma.UserProclamationsUpsertWithWhereUniqueWithoutUserInput[] + createMany?: Prisma.UserProclamationsCreateManyUserInputEnvelope + set?: Prisma.UserProclamationsWhereUniqueInput | Prisma.UserProclamationsWhereUniqueInput[] + disconnect?: Prisma.UserProclamationsWhereUniqueInput | Prisma.UserProclamationsWhereUniqueInput[] + delete?: Prisma.UserProclamationsWhereUniqueInput | Prisma.UserProclamationsWhereUniqueInput[] + connect?: Prisma.UserProclamationsWhereUniqueInput | Prisma.UserProclamationsWhereUniqueInput[] + update?: Prisma.UserProclamationsUpdateWithWhereUniqueWithoutUserInput | Prisma.UserProclamationsUpdateWithWhereUniqueWithoutUserInput[] + updateMany?: Prisma.UserProclamationsUpdateManyWithWhereWithoutUserInput | Prisma.UserProclamationsUpdateManyWithWhereWithoutUserInput[] + deleteMany?: Prisma.UserProclamationsScalarWhereInput | Prisma.UserProclamationsScalarWhereInput[] +} + +export type UserProclamationsUncheckedUpdateManyWithoutUserNestedInput = { + create?: Prisma.XOR | Prisma.UserProclamationsCreateWithoutUserInput[] | Prisma.UserProclamationsUncheckedCreateWithoutUserInput[] + connectOrCreate?: Prisma.UserProclamationsCreateOrConnectWithoutUserInput | Prisma.UserProclamationsCreateOrConnectWithoutUserInput[] + upsert?: Prisma.UserProclamationsUpsertWithWhereUniqueWithoutUserInput | Prisma.UserProclamationsUpsertWithWhereUniqueWithoutUserInput[] + createMany?: Prisma.UserProclamationsCreateManyUserInputEnvelope + set?: Prisma.UserProclamationsWhereUniqueInput | Prisma.UserProclamationsWhereUniqueInput[] + disconnect?: Prisma.UserProclamationsWhereUniqueInput | Prisma.UserProclamationsWhereUniqueInput[] + delete?: Prisma.UserProclamationsWhereUniqueInput | Prisma.UserProclamationsWhereUniqueInput[] + connect?: Prisma.UserProclamationsWhereUniqueInput | Prisma.UserProclamationsWhereUniqueInput[] + update?: Prisma.UserProclamationsUpdateWithWhereUniqueWithoutUserInput | Prisma.UserProclamationsUpdateWithWhereUniqueWithoutUserInput[] + updateMany?: Prisma.UserProclamationsUpdateManyWithWhereWithoutUserInput | Prisma.UserProclamationsUpdateManyWithWhereWithoutUserInput[] + deleteMany?: Prisma.UserProclamationsScalarWhereInput | Prisma.UserProclamationsScalarWhereInput[] +} + +export type UserProclamationsCreateNestedManyWithoutProclamationInput = { + create?: Prisma.XOR | Prisma.UserProclamationsCreateWithoutProclamationInput[] | Prisma.UserProclamationsUncheckedCreateWithoutProclamationInput[] + connectOrCreate?: Prisma.UserProclamationsCreateOrConnectWithoutProclamationInput | Prisma.UserProclamationsCreateOrConnectWithoutProclamationInput[] + createMany?: Prisma.UserProclamationsCreateManyProclamationInputEnvelope + connect?: Prisma.UserProclamationsWhereUniqueInput | Prisma.UserProclamationsWhereUniqueInput[] +} + +export type UserProclamationsUncheckedCreateNestedManyWithoutProclamationInput = { + create?: Prisma.XOR | Prisma.UserProclamationsCreateWithoutProclamationInput[] | Prisma.UserProclamationsUncheckedCreateWithoutProclamationInput[] + connectOrCreate?: Prisma.UserProclamationsCreateOrConnectWithoutProclamationInput | Prisma.UserProclamationsCreateOrConnectWithoutProclamationInput[] + createMany?: Prisma.UserProclamationsCreateManyProclamationInputEnvelope + connect?: Prisma.UserProclamationsWhereUniqueInput | Prisma.UserProclamationsWhereUniqueInput[] +} + +export type UserProclamationsUpdateManyWithoutProclamationNestedInput = { + create?: Prisma.XOR | Prisma.UserProclamationsCreateWithoutProclamationInput[] | Prisma.UserProclamationsUncheckedCreateWithoutProclamationInput[] + connectOrCreate?: Prisma.UserProclamationsCreateOrConnectWithoutProclamationInput | Prisma.UserProclamationsCreateOrConnectWithoutProclamationInput[] + upsert?: Prisma.UserProclamationsUpsertWithWhereUniqueWithoutProclamationInput | Prisma.UserProclamationsUpsertWithWhereUniqueWithoutProclamationInput[] + createMany?: Prisma.UserProclamationsCreateManyProclamationInputEnvelope + set?: Prisma.UserProclamationsWhereUniqueInput | Prisma.UserProclamationsWhereUniqueInput[] + disconnect?: Prisma.UserProclamationsWhereUniqueInput | Prisma.UserProclamationsWhereUniqueInput[] + delete?: Prisma.UserProclamationsWhereUniqueInput | Prisma.UserProclamationsWhereUniqueInput[] + connect?: Prisma.UserProclamationsWhereUniqueInput | Prisma.UserProclamationsWhereUniqueInput[] + update?: Prisma.UserProclamationsUpdateWithWhereUniqueWithoutProclamationInput | Prisma.UserProclamationsUpdateWithWhereUniqueWithoutProclamationInput[] + updateMany?: Prisma.UserProclamationsUpdateManyWithWhereWithoutProclamationInput | Prisma.UserProclamationsUpdateManyWithWhereWithoutProclamationInput[] + deleteMany?: Prisma.UserProclamationsScalarWhereInput | Prisma.UserProclamationsScalarWhereInput[] +} + +export type UserProclamationsUncheckedUpdateManyWithoutProclamationNestedInput = { + create?: Prisma.XOR | Prisma.UserProclamationsCreateWithoutProclamationInput[] | Prisma.UserProclamationsUncheckedCreateWithoutProclamationInput[] + connectOrCreate?: Prisma.UserProclamationsCreateOrConnectWithoutProclamationInput | Prisma.UserProclamationsCreateOrConnectWithoutProclamationInput[] + upsert?: Prisma.UserProclamationsUpsertWithWhereUniqueWithoutProclamationInput | Prisma.UserProclamationsUpsertWithWhereUniqueWithoutProclamationInput[] + createMany?: Prisma.UserProclamationsCreateManyProclamationInputEnvelope + set?: Prisma.UserProclamationsWhereUniqueInput | Prisma.UserProclamationsWhereUniqueInput[] + disconnect?: Prisma.UserProclamationsWhereUniqueInput | Prisma.UserProclamationsWhereUniqueInput[] + delete?: Prisma.UserProclamationsWhereUniqueInput | Prisma.UserProclamationsWhereUniqueInput[] + connect?: Prisma.UserProclamationsWhereUniqueInput | Prisma.UserProclamationsWhereUniqueInput[] + update?: Prisma.UserProclamationsUpdateWithWhereUniqueWithoutProclamationInput | Prisma.UserProclamationsUpdateWithWhereUniqueWithoutProclamationInput[] + updateMany?: Prisma.UserProclamationsUpdateManyWithWhereWithoutProclamationInput | Prisma.UserProclamationsUpdateManyWithWhereWithoutProclamationInput[] + deleteMany?: Prisma.UserProclamationsScalarWhereInput | Prisma.UserProclamationsScalarWhereInput[] +} + +export type UserProclamationsCreateWithoutUserInput = { + createdAt?: Date | string + updatedAt?: Date | string + proclamation: Prisma.ProclamationCreateNestedOneWithoutUserProclamationsInput +} + +export type UserProclamationsUncheckedCreateWithoutUserInput = { + proclamationId: string + createdAt?: Date | string + updatedAt?: Date | string +} + +export type UserProclamationsCreateOrConnectWithoutUserInput = { + where: Prisma.UserProclamationsWhereUniqueInput + create: Prisma.XOR +} + +export type UserProclamationsCreateManyUserInputEnvelope = { + data: Prisma.UserProclamationsCreateManyUserInput | Prisma.UserProclamationsCreateManyUserInput[] + skipDuplicates?: boolean +} + +export type UserProclamationsUpsertWithWhereUniqueWithoutUserInput = { + where: Prisma.UserProclamationsWhereUniqueInput + update: Prisma.XOR + create: Prisma.XOR +} + +export type UserProclamationsUpdateWithWhereUniqueWithoutUserInput = { + where: Prisma.UserProclamationsWhereUniqueInput + data: Prisma.XOR +} + +export type UserProclamationsUpdateManyWithWhereWithoutUserInput = { + where: Prisma.UserProclamationsScalarWhereInput + data: Prisma.XOR +} + +export type UserProclamationsScalarWhereInput = { + AND?: Prisma.UserProclamationsScalarWhereInput | Prisma.UserProclamationsScalarWhereInput[] + OR?: Prisma.UserProclamationsScalarWhereInput[] + NOT?: Prisma.UserProclamationsScalarWhereInput | Prisma.UserProclamationsScalarWhereInput[] + userId?: Prisma.StringFilter<"UserProclamations"> | string + proclamationId?: Prisma.StringFilter<"UserProclamations"> | string + createdAt?: Prisma.DateTimeFilter<"UserProclamations"> | Date | string + updatedAt?: Prisma.DateTimeFilter<"UserProclamations"> | Date | string +} + +export type UserProclamationsCreateWithoutProclamationInput = { + createdAt?: Date | string + updatedAt?: Date | string + user: Prisma.UserCreateNestedOneWithoutUserProclamationsInput +} + +export type UserProclamationsUncheckedCreateWithoutProclamationInput = { + userId: string + createdAt?: Date | string + updatedAt?: Date | string +} + +export type UserProclamationsCreateOrConnectWithoutProclamationInput = { + where: Prisma.UserProclamationsWhereUniqueInput + create: Prisma.XOR +} + +export type UserProclamationsCreateManyProclamationInputEnvelope = { + data: Prisma.UserProclamationsCreateManyProclamationInput | Prisma.UserProclamationsCreateManyProclamationInput[] + skipDuplicates?: boolean +} + +export type UserProclamationsUpsertWithWhereUniqueWithoutProclamationInput = { + where: Prisma.UserProclamationsWhereUniqueInput + update: Prisma.XOR + create: Prisma.XOR +} + +export type UserProclamationsUpdateWithWhereUniqueWithoutProclamationInput = { + where: Prisma.UserProclamationsWhereUniqueInput + data: Prisma.XOR +} + +export type UserProclamationsUpdateManyWithWhereWithoutProclamationInput = { + where: Prisma.UserProclamationsScalarWhereInput + data: Prisma.XOR +} + +export type UserProclamationsCreateManyUserInput = { + proclamationId: string + createdAt?: Date | string + updatedAt?: Date | string +} + +export type UserProclamationsUpdateWithoutUserInput = { + createdAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string + updatedAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string + proclamation?: Prisma.ProclamationUpdateOneRequiredWithoutUserProclamationsNestedInput +} + +export type UserProclamationsUncheckedUpdateWithoutUserInput = { + proclamationId?: Prisma.StringFieldUpdateOperationsInput | string + createdAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string + updatedAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string +} + +export type UserProclamationsUncheckedUpdateManyWithoutUserInput = { + proclamationId?: Prisma.StringFieldUpdateOperationsInput | string + createdAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string + updatedAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string +} + +export type UserProclamationsCreateManyProclamationInput = { + userId: string + createdAt?: Date | string + updatedAt?: Date | string +} + +export type UserProclamationsUpdateWithoutProclamationInput = { + createdAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string + updatedAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string + user?: Prisma.UserUpdateOneRequiredWithoutUserProclamationsNestedInput +} + +export type UserProclamationsUncheckedUpdateWithoutProclamationInput = { + userId?: Prisma.StringFieldUpdateOperationsInput | string + createdAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string + updatedAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string +} + +export type UserProclamationsUncheckedUpdateManyWithoutProclamationInput = { + userId?: Prisma.StringFieldUpdateOperationsInput | string + createdAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string + updatedAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string +} + + + +export type UserProclamationsSelect = runtime.Types.Extensions.GetSelect<{ + userId?: boolean + proclamationId?: boolean + createdAt?: boolean + updatedAt?: boolean + user?: boolean | Prisma.UserDefaultArgs + proclamation?: boolean | Prisma.ProclamationDefaultArgs +}, ExtArgs["result"]["userProclamations"]> + +export type UserProclamationsSelectCreateManyAndReturn = runtime.Types.Extensions.GetSelect<{ + userId?: boolean + proclamationId?: boolean + createdAt?: boolean + updatedAt?: boolean + user?: boolean | Prisma.UserDefaultArgs + proclamation?: boolean | Prisma.ProclamationDefaultArgs +}, ExtArgs["result"]["userProclamations"]> + +export type UserProclamationsSelectUpdateManyAndReturn = runtime.Types.Extensions.GetSelect<{ + userId?: boolean + proclamationId?: boolean + createdAt?: boolean + updatedAt?: boolean + user?: boolean | Prisma.UserDefaultArgs + proclamation?: boolean | Prisma.ProclamationDefaultArgs +}, ExtArgs["result"]["userProclamations"]> + +export type UserProclamationsSelectScalar = { + userId?: boolean + proclamationId?: boolean + createdAt?: boolean + updatedAt?: boolean +} + +export type UserProclamationsOmit = runtime.Types.Extensions.GetOmit<"userId" | "proclamationId" | "createdAt" | "updatedAt", ExtArgs["result"]["userProclamations"]> +export type UserProclamationsInclude = { + user?: boolean | Prisma.UserDefaultArgs + proclamation?: boolean | Prisma.ProclamationDefaultArgs +} +export type UserProclamationsIncludeCreateManyAndReturn = { + user?: boolean | Prisma.UserDefaultArgs + proclamation?: boolean | Prisma.ProclamationDefaultArgs +} +export type UserProclamationsIncludeUpdateManyAndReturn = { + user?: boolean | Prisma.UserDefaultArgs + proclamation?: boolean | Prisma.ProclamationDefaultArgs +} + +export type $UserProclamationsPayload = { + name: "UserProclamations" + objects: { + user: Prisma.$UserPayload + proclamation: Prisma.$ProclamationPayload + } + scalars: runtime.Types.Extensions.GetPayloadResult<{ + userId: string + proclamationId: string + createdAt: Date + updatedAt: Date + }, ExtArgs["result"]["userProclamations"]> + composites: {} +} + +export type UserProclamationsGetPayload = runtime.Types.Result.GetResult + +export type UserProclamationsCountArgs = + Omit & { + select?: UserProclamationsCountAggregateInputType | true + } + +export interface UserProclamationsDelegate { + [K: symbol]: { types: Prisma.TypeMap['model']['UserProclamations'], meta: { name: 'UserProclamations' } } + /** + * Find zero or one UserProclamations that matches the filter. + * @param {UserProclamationsFindUniqueArgs} args - Arguments to find a UserProclamations + * @example + * // Get one UserProclamations + * const userProclamations = await prisma.userProclamations.findUnique({ + * where: { + * // ... provide filter here + * } + * }) + */ + findUnique(args: Prisma.SelectSubset>): Prisma.Prisma__UserProclamationsClient, T, "findUnique", GlobalOmitOptions> | null, null, ExtArgs, GlobalOmitOptions> + + /** + * Find one UserProclamations that matches the filter or throw an error with `error.code='P2025'` + * if no matches were found. + * @param {UserProclamationsFindUniqueOrThrowArgs} args - Arguments to find a UserProclamations + * @example + * // Get one UserProclamations + * const userProclamations = await prisma.userProclamations.findUniqueOrThrow({ + * where: { + * // ... provide filter here + * } + * }) + */ + findUniqueOrThrow(args: Prisma.SelectSubset>): Prisma.Prisma__UserProclamationsClient, T, "findUniqueOrThrow", GlobalOmitOptions>, never, ExtArgs, GlobalOmitOptions> + + /** + * Find the first UserProclamations that matches the filter. + * Note, that providing `undefined` is treated as the value not being there. + * Read more here: https://pris.ly/d/null-undefined + * @param {UserProclamationsFindFirstArgs} args - Arguments to find a UserProclamations + * @example + * // Get one UserProclamations + * const userProclamations = await prisma.userProclamations.findFirst({ + * where: { + * // ... provide filter here + * } + * }) + */ + findFirst(args?: Prisma.SelectSubset>): Prisma.Prisma__UserProclamationsClient, T, "findFirst", GlobalOmitOptions> | null, null, ExtArgs, GlobalOmitOptions> + + /** + * Find the first UserProclamations that matches the filter or + * throw `PrismaKnownClientError` with `P2025` code if no matches were found. + * Note, that providing `undefined` is treated as the value not being there. + * Read more here: https://pris.ly/d/null-undefined + * @param {UserProclamationsFindFirstOrThrowArgs} args - Arguments to find a UserProclamations + * @example + * // Get one UserProclamations + * const userProclamations = await prisma.userProclamations.findFirstOrThrow({ + * where: { + * // ... provide filter here + * } + * }) + */ + findFirstOrThrow(args?: Prisma.SelectSubset>): Prisma.Prisma__UserProclamationsClient, T, "findFirstOrThrow", GlobalOmitOptions>, never, ExtArgs, GlobalOmitOptions> + + /** + * Find zero or more UserProclamations that matches the filter. + * Note, that providing `undefined` is treated as the value not being there. + * Read more here: https://pris.ly/d/null-undefined + * @param {UserProclamationsFindManyArgs} args - Arguments to filter and select certain fields only. + * @example + * // Get all UserProclamations + * const userProclamations = await prisma.userProclamations.findMany() + * + * // Get first 10 UserProclamations + * const userProclamations = await prisma.userProclamations.findMany({ take: 10 }) + * + * // Only select the `userId` + * const userProclamationsWithUserIdOnly = await prisma.userProclamations.findMany({ select: { userId: true } }) + * + */ + findMany(args?: Prisma.SelectSubset>): Prisma.PrismaPromise, T, "findMany", GlobalOmitOptions>> + + /** + * Create a UserProclamations. + * @param {UserProclamationsCreateArgs} args - Arguments to create a UserProclamations. + * @example + * // Create one UserProclamations + * const UserProclamations = await prisma.userProclamations.create({ + * data: { + * // ... data to create a UserProclamations + * } + * }) + * + */ + create(args: Prisma.SelectSubset>): Prisma.Prisma__UserProclamationsClient, T, "create", GlobalOmitOptions>, never, ExtArgs, GlobalOmitOptions> + + /** + * Create many UserProclamations. + * @param {UserProclamationsCreateManyArgs} args - Arguments to create many UserProclamations. + * @example + * // Create many UserProclamations + * const userProclamations = await prisma.userProclamations.createMany({ + * data: [ + * // ... provide data here + * ] + * }) + * + */ + createMany(args?: Prisma.SelectSubset>): Prisma.PrismaPromise + + /** + * Create many UserProclamations and returns the data saved in the database. + * @param {UserProclamationsCreateManyAndReturnArgs} args - Arguments to create many UserProclamations. + * @example + * // Create many UserProclamations + * const userProclamations = await prisma.userProclamations.createManyAndReturn({ + * data: [ + * // ... provide data here + * ] + * }) + * + * // Create many UserProclamations and only return the `userId` + * const userProclamationsWithUserIdOnly = await prisma.userProclamations.createManyAndReturn({ + * select: { userId: true }, + * data: [ + * // ... provide data here + * ] + * }) + * Note, that providing `undefined` is treated as the value not being there. + * Read more here: https://pris.ly/d/null-undefined + * + */ + createManyAndReturn(args?: Prisma.SelectSubset>): Prisma.PrismaPromise, T, "createManyAndReturn", GlobalOmitOptions>> + + /** + * Delete a UserProclamations. + * @param {UserProclamationsDeleteArgs} args - Arguments to delete one UserProclamations. + * @example + * // Delete one UserProclamations + * const UserProclamations = await prisma.userProclamations.delete({ + * where: { + * // ... filter to delete one UserProclamations + * } + * }) + * + */ + delete(args: Prisma.SelectSubset>): Prisma.Prisma__UserProclamationsClient, T, "delete", GlobalOmitOptions>, never, ExtArgs, GlobalOmitOptions> + + /** + * Update one UserProclamations. + * @param {UserProclamationsUpdateArgs} args - Arguments to update one UserProclamations. + * @example + * // Update one UserProclamations + * const userProclamations = await prisma.userProclamations.update({ + * where: { + * // ... provide filter here + * }, + * data: { + * // ... provide data here + * } + * }) + * + */ + update(args: Prisma.SelectSubset>): Prisma.Prisma__UserProclamationsClient, T, "update", GlobalOmitOptions>, never, ExtArgs, GlobalOmitOptions> + + /** + * Delete zero or more UserProclamations. + * @param {UserProclamationsDeleteManyArgs} args - Arguments to filter UserProclamations to delete. + * @example + * // Delete a few UserProclamations + * const { count } = await prisma.userProclamations.deleteMany({ + * where: { + * // ... provide filter here + * } + * }) + * + */ + deleteMany(args?: Prisma.SelectSubset>): Prisma.PrismaPromise + + /** + * Update zero or more UserProclamations. + * Note, that providing `undefined` is treated as the value not being there. + * Read more here: https://pris.ly/d/null-undefined + * @param {UserProclamationsUpdateManyArgs} args - Arguments to update one or more rows. + * @example + * // Update many UserProclamations + * const userProclamations = await prisma.userProclamations.updateMany({ + * where: { + * // ... provide filter here + * }, + * data: { + * // ... provide data here + * } + * }) + * + */ + updateMany(args: Prisma.SelectSubset>): Prisma.PrismaPromise + + /** + * Update zero or more UserProclamations and returns the data updated in the database. + * @param {UserProclamationsUpdateManyAndReturnArgs} args - Arguments to update many UserProclamations. + * @example + * // Update many UserProclamations + * const userProclamations = await prisma.userProclamations.updateManyAndReturn({ + * where: { + * // ... provide filter here + * }, + * data: [ + * // ... provide data here + * ] + * }) + * + * // Update zero or more UserProclamations and only return the `userId` + * const userProclamationsWithUserIdOnly = await prisma.userProclamations.updateManyAndReturn({ + * select: { userId: true }, + * where: { + * // ... provide filter here + * }, + * data: [ + * // ... provide data here + * ] + * }) + * Note, that providing `undefined` is treated as the value not being there. + * Read more here: https://pris.ly/d/null-undefined + * + */ + updateManyAndReturn(args: Prisma.SelectSubset>): Prisma.PrismaPromise, T, "updateManyAndReturn", GlobalOmitOptions>> + + /** + * Create or update one UserProclamations. + * @param {UserProclamationsUpsertArgs} args - Arguments to update or create a UserProclamations. + * @example + * // Update or create a UserProclamations + * const userProclamations = await prisma.userProclamations.upsert({ + * create: { + * // ... data to create a UserProclamations + * }, + * update: { + * // ... in case it already exists, update + * }, + * where: { + * // ... the filter for the UserProclamations we want to update + * } + * }) + */ + upsert(args: Prisma.SelectSubset>): Prisma.Prisma__UserProclamationsClient, T, "upsert", GlobalOmitOptions>, never, ExtArgs, GlobalOmitOptions> + + + /** + * Count the number of UserProclamations. + * Note, that providing `undefined` is treated as the value not being there. + * Read more here: https://pris.ly/d/null-undefined + * @param {UserProclamationsCountArgs} args - Arguments to filter UserProclamations to count. + * @example + * // Count the number of UserProclamations + * const count = await prisma.userProclamations.count({ + * where: { + * // ... the filter for the UserProclamations we want to count + * } + * }) + **/ + count( + args?: Prisma.Subset, + ): Prisma.PrismaPromise< + T extends runtime.Types.Utils.Record<'select', any> + ? T['select'] extends true + ? number + : Prisma.GetScalarType + : number + > + + /** + * Allows you to perform aggregations operations on a UserProclamations. + * Note, that providing `undefined` is treated as the value not being there. + * Read more here: https://pris.ly/d/null-undefined + * @param {UserProclamationsAggregateArgs} args - Select which aggregations you would like to apply and on what fields. + * @example + * // Ordered by age ascending + * // Where email contains prisma.io + * // Limited to the 10 users + * const aggregations = await prisma.user.aggregate({ + * _avg: { + * age: true, + * }, + * where: { + * email: { + * contains: "prisma.io", + * }, + * }, + * orderBy: { + * age: "asc", + * }, + * take: 10, + * }) + **/ + aggregate(args: Prisma.Subset): Prisma.PrismaPromise> + + /** + * Group by UserProclamations. + * Note, that providing `undefined` is treated as the value not being there. + * Read more here: https://pris.ly/d/null-undefined + * @param {UserProclamationsGroupByArgs} args - Group by arguments. + * @example + * // Group by city, order by createdAt, get count + * const result = await prisma.user.groupBy({ + * by: ['city', 'createdAt'], + * orderBy: { + * createdAt: true + * }, + * _count: { + * _all: true + * }, + * }) + * + **/ + groupBy< + T extends UserProclamationsGroupByArgs, + HasSelectOrTake extends Prisma.Or< + Prisma.Extends<'skip', Prisma.Keys>, + Prisma.Extends<'take', Prisma.Keys> + >, + OrderByArg extends Prisma.True extends HasSelectOrTake + ? { orderBy: UserProclamationsGroupByArgs['orderBy'] } + : { orderBy?: UserProclamationsGroupByArgs['orderBy'] }, + OrderFields extends Prisma.ExcludeUnderscoreKeys>>, + ByFields extends Prisma.MaybeTupleToUnion, + ByValid extends Prisma.Has, + HavingFields extends Prisma.GetHavingFields, + HavingValid extends Prisma.Has, + ByEmpty extends T['by'] extends never[] ? Prisma.True : Prisma.False, + InputErrors extends ByEmpty extends Prisma.True + ? `Error: "by" must not be empty.` + : HavingValid extends Prisma.False + ? { + [P in HavingFields]: P extends ByFields + ? never + : P extends string + ? `Error: Field "${P}" used in "having" needs to be provided in "by".` + : [ + Error, + 'Field ', + P, + ` in "having" needs to be provided in "by"`, + ] + }[HavingFields] + : 'take' extends Prisma.Keys + ? 'orderBy' extends Prisma.Keys + ? ByValid extends Prisma.True + ? {} + : { + [P in OrderFields]: P extends ByFields + ? never + : `Error: Field "${P}" in "orderBy" needs to be provided in "by"` + }[OrderFields] + : 'Error: If you provide "take", you also need to provide "orderBy"' + : 'skip' extends Prisma.Keys + ? 'orderBy' extends Prisma.Keys + ? ByValid extends Prisma.True + ? {} + : { + [P in OrderFields]: P extends ByFields + ? never + : `Error: Field "${P}" in "orderBy" needs to be provided in "by"` + }[OrderFields] + : 'Error: If you provide "skip", you also need to provide "orderBy"' + : ByValid extends Prisma.True + ? {} + : { + [P in OrderFields]: P extends ByFields + ? never + : `Error: Field "${P}" in "orderBy" needs to be provided in "by"` + }[OrderFields] + >(args: Prisma.SubsetIntersection & InputErrors): {} extends InputErrors ? GetUserProclamationsGroupByPayload : Prisma.PrismaPromise +/** + * Fields of the UserProclamations model + */ +readonly fields: UserProclamationsFieldRefs; +} + +/** + * The delegate class that acts as a "Promise-like" for UserProclamations. + * Why is this prefixed with `Prisma__`? + * Because we want to prevent naming conflicts as mentioned in + * https://github.com/prisma/prisma-client-js/issues/707 + */ +export interface Prisma__UserProclamationsClient extends Prisma.PrismaPromise { + readonly [Symbol.toStringTag]: "PrismaPromise" + user = {}>(args?: Prisma.Subset>): Prisma.Prisma__UserClient, T, "findUniqueOrThrow", GlobalOmitOptions> | Null, Null, ExtArgs, GlobalOmitOptions> + proclamation = {}>(args?: Prisma.Subset>): Prisma.Prisma__ProclamationClient, T, "findUniqueOrThrow", GlobalOmitOptions> | Null, Null, ExtArgs, GlobalOmitOptions> + /** + * Attaches callbacks for the resolution and/or rejection of the Promise. + * @param onfulfilled The callback to execute when the Promise is resolved. + * @param onrejected The callback to execute when the Promise is rejected. + * @returns A Promise for the completion of which ever callback is executed. + */ + then(onfulfilled?: ((value: T) => TResult1 | PromiseLike) | undefined | null, onrejected?: ((reason: any) => TResult2 | PromiseLike) | undefined | null): runtime.Types.Utils.JsPromise + /** + * Attaches a callback for only the rejection of the Promise. + * @param onrejected The callback to execute when the Promise is rejected. + * @returns A Promise for the completion of the callback. + */ + catch(onrejected?: ((reason: any) => TResult | PromiseLike) | undefined | null): runtime.Types.Utils.JsPromise + /** + * Attaches a callback that is invoked when the Promise is settled (fulfilled or rejected). The + * resolved value cannot be modified from the callback. + * @param onfinally The callback to execute when the Promise is settled (fulfilled or rejected). + * @returns A Promise for the completion of the callback. + */ + finally(onfinally?: (() => void) | undefined | null): runtime.Types.Utils.JsPromise +} + + + + +/** + * Fields of the UserProclamations model + */ +export interface UserProclamationsFieldRefs { + readonly userId: Prisma.FieldRef<"UserProclamations", 'String'> + readonly proclamationId: Prisma.FieldRef<"UserProclamations", 'String'> + readonly createdAt: Prisma.FieldRef<"UserProclamations", 'DateTime'> + readonly updatedAt: Prisma.FieldRef<"UserProclamations", 'DateTime'> +} + + +// Custom InputTypes +/** + * UserProclamations findUnique + */ +export type UserProclamationsFindUniqueArgs = { + /** + * Select specific fields to fetch from the UserProclamations + */ + select?: Prisma.UserProclamationsSelect | null + /** + * Omit specific fields from the UserProclamations + */ + omit?: Prisma.UserProclamationsOmit | null + /** + * Choose, which related nodes to fetch as well + */ + include?: Prisma.UserProclamationsInclude | null + /** + * Filter, which UserProclamations to fetch. + */ + where: Prisma.UserProclamationsWhereUniqueInput +} + +/** + * UserProclamations findUniqueOrThrow + */ +export type UserProclamationsFindUniqueOrThrowArgs = { + /** + * Select specific fields to fetch from the UserProclamations + */ + select?: Prisma.UserProclamationsSelect | null + /** + * Omit specific fields from the UserProclamations + */ + omit?: Prisma.UserProclamationsOmit | null + /** + * Choose, which related nodes to fetch as well + */ + include?: Prisma.UserProclamationsInclude | null + /** + * Filter, which UserProclamations to fetch. + */ + where: Prisma.UserProclamationsWhereUniqueInput +} + +/** + * UserProclamations findFirst + */ +export type UserProclamationsFindFirstArgs = { + /** + * Select specific fields to fetch from the UserProclamations + */ + select?: Prisma.UserProclamationsSelect | null + /** + * Omit specific fields from the UserProclamations + */ + omit?: Prisma.UserProclamationsOmit | null + /** + * Choose, which related nodes to fetch as well + */ + include?: Prisma.UserProclamationsInclude | null + /** + * Filter, which UserProclamations to fetch. + */ + where?: Prisma.UserProclamationsWhereInput + /** + * {@link https://www.prisma.io/docs/concepts/components/prisma-client/sorting Sorting Docs} + * + * Determine the order of UserProclamations to fetch. + */ + orderBy?: Prisma.UserProclamationsOrderByWithRelationInput | Prisma.UserProclamationsOrderByWithRelationInput[] + /** + * {@link https://www.prisma.io/docs/concepts/components/prisma-client/pagination#cursor-based-pagination Cursor Docs} + * + * Sets the position for searching for UserProclamations. + */ + cursor?: Prisma.UserProclamationsWhereUniqueInput + /** + * {@link https://www.prisma.io/docs/concepts/components/prisma-client/pagination Pagination Docs} + * + * Take `±n` UserProclamations from the position of the cursor. + */ + take?: number + /** + * {@link https://www.prisma.io/docs/concepts/components/prisma-client/pagination Pagination Docs} + * + * Skip the first `n` UserProclamations. + */ + skip?: number + /** + * {@link https://www.prisma.io/docs/concepts/components/prisma-client/distinct Distinct Docs} + * + * Filter by unique combinations of UserProclamations. + */ + distinct?: Prisma.UserProclamationsScalarFieldEnum | Prisma.UserProclamationsScalarFieldEnum[] +} + +/** + * UserProclamations findFirstOrThrow + */ +export type UserProclamationsFindFirstOrThrowArgs = { + /** + * Select specific fields to fetch from the UserProclamations + */ + select?: Prisma.UserProclamationsSelect | null + /** + * Omit specific fields from the UserProclamations + */ + omit?: Prisma.UserProclamationsOmit | null + /** + * Choose, which related nodes to fetch as well + */ + include?: Prisma.UserProclamationsInclude | null + /** + * Filter, which UserProclamations to fetch. + */ + where?: Prisma.UserProclamationsWhereInput + /** + * {@link https://www.prisma.io/docs/concepts/components/prisma-client/sorting Sorting Docs} + * + * Determine the order of UserProclamations to fetch. + */ + orderBy?: Prisma.UserProclamationsOrderByWithRelationInput | Prisma.UserProclamationsOrderByWithRelationInput[] + /** + * {@link https://www.prisma.io/docs/concepts/components/prisma-client/pagination#cursor-based-pagination Cursor Docs} + * + * Sets the position for searching for UserProclamations. + */ + cursor?: Prisma.UserProclamationsWhereUniqueInput + /** + * {@link https://www.prisma.io/docs/concepts/components/prisma-client/pagination Pagination Docs} + * + * Take `±n` UserProclamations from the position of the cursor. + */ + take?: number + /** + * {@link https://www.prisma.io/docs/concepts/components/prisma-client/pagination Pagination Docs} + * + * Skip the first `n` UserProclamations. + */ + skip?: number + /** + * {@link https://www.prisma.io/docs/concepts/components/prisma-client/distinct Distinct Docs} + * + * Filter by unique combinations of UserProclamations. + */ + distinct?: Prisma.UserProclamationsScalarFieldEnum | Prisma.UserProclamationsScalarFieldEnum[] +} + +/** + * UserProclamations findMany + */ +export type UserProclamationsFindManyArgs = { + /** + * Select specific fields to fetch from the UserProclamations + */ + select?: Prisma.UserProclamationsSelect | null + /** + * Omit specific fields from the UserProclamations + */ + omit?: Prisma.UserProclamationsOmit | null + /** + * Choose, which related nodes to fetch as well + */ + include?: Prisma.UserProclamationsInclude | null + /** + * Filter, which UserProclamations to fetch. + */ + where?: Prisma.UserProclamationsWhereInput + /** + * {@link https://www.prisma.io/docs/concepts/components/prisma-client/sorting Sorting Docs} + * + * Determine the order of UserProclamations to fetch. + */ + orderBy?: Prisma.UserProclamationsOrderByWithRelationInput | Prisma.UserProclamationsOrderByWithRelationInput[] + /** + * {@link https://www.prisma.io/docs/concepts/components/prisma-client/pagination#cursor-based-pagination Cursor Docs} + * + * Sets the position for listing UserProclamations. + */ + cursor?: Prisma.UserProclamationsWhereUniqueInput + /** + * {@link https://www.prisma.io/docs/concepts/components/prisma-client/pagination Pagination Docs} + * + * Take `±n` UserProclamations from the position of the cursor. + */ + take?: number + /** + * {@link https://www.prisma.io/docs/concepts/components/prisma-client/pagination Pagination Docs} + * + * Skip the first `n` UserProclamations. + */ + skip?: number + distinct?: Prisma.UserProclamationsScalarFieldEnum | Prisma.UserProclamationsScalarFieldEnum[] +} + +/** + * UserProclamations create + */ +export type UserProclamationsCreateArgs = { + /** + * Select specific fields to fetch from the UserProclamations + */ + select?: Prisma.UserProclamationsSelect | null + /** + * Omit specific fields from the UserProclamations + */ + omit?: Prisma.UserProclamationsOmit | null + /** + * Choose, which related nodes to fetch as well + */ + include?: Prisma.UserProclamationsInclude | null + /** + * The data needed to create a UserProclamations. + */ + data: Prisma.XOR +} + +/** + * UserProclamations createMany + */ +export type UserProclamationsCreateManyArgs = { + /** + * The data used to create many UserProclamations. + */ + data: Prisma.UserProclamationsCreateManyInput | Prisma.UserProclamationsCreateManyInput[] + skipDuplicates?: boolean +} + +/** + * UserProclamations createManyAndReturn + */ +export type UserProclamationsCreateManyAndReturnArgs = { + /** + * Select specific fields to fetch from the UserProclamations + */ + select?: Prisma.UserProclamationsSelectCreateManyAndReturn | null + /** + * Omit specific fields from the UserProclamations + */ + omit?: Prisma.UserProclamationsOmit | null + /** + * The data used to create many UserProclamations. + */ + data: Prisma.UserProclamationsCreateManyInput | Prisma.UserProclamationsCreateManyInput[] + skipDuplicates?: boolean + /** + * Choose, which related nodes to fetch as well + */ + include?: Prisma.UserProclamationsIncludeCreateManyAndReturn | null +} + +/** + * UserProclamations update + */ +export type UserProclamationsUpdateArgs = { + /** + * Select specific fields to fetch from the UserProclamations + */ + select?: Prisma.UserProclamationsSelect | null + /** + * Omit specific fields from the UserProclamations + */ + omit?: Prisma.UserProclamationsOmit | null + /** + * Choose, which related nodes to fetch as well + */ + include?: Prisma.UserProclamationsInclude | null + /** + * The data needed to update a UserProclamations. + */ + data: Prisma.XOR + /** + * Choose, which UserProclamations to update. + */ + where: Prisma.UserProclamationsWhereUniqueInput +} + +/** + * UserProclamations updateMany + */ +export type UserProclamationsUpdateManyArgs = { + /** + * The data used to update UserProclamations. + */ + data: Prisma.XOR + /** + * Filter which UserProclamations to update + */ + where?: Prisma.UserProclamationsWhereInput + /** + * Limit how many UserProclamations to update. + */ + limit?: number +} + +/** + * UserProclamations updateManyAndReturn + */ +export type UserProclamationsUpdateManyAndReturnArgs = { + /** + * Select specific fields to fetch from the UserProclamations + */ + select?: Prisma.UserProclamationsSelectUpdateManyAndReturn | null + /** + * Omit specific fields from the UserProclamations + */ + omit?: Prisma.UserProclamationsOmit | null + /** + * The data used to update UserProclamations. + */ + data: Prisma.XOR + /** + * Filter which UserProclamations to update + */ + where?: Prisma.UserProclamationsWhereInput + /** + * Limit how many UserProclamations to update. + */ + limit?: number + /** + * Choose, which related nodes to fetch as well + */ + include?: Prisma.UserProclamationsIncludeUpdateManyAndReturn | null +} + +/** + * UserProclamations upsert + */ +export type UserProclamationsUpsertArgs = { + /** + * Select specific fields to fetch from the UserProclamations + */ + select?: Prisma.UserProclamationsSelect | null + /** + * Omit specific fields from the UserProclamations + */ + omit?: Prisma.UserProclamationsOmit | null + /** + * Choose, which related nodes to fetch as well + */ + include?: Prisma.UserProclamationsInclude | null + /** + * The filter to search for the UserProclamations to update in case it exists. + */ + where: Prisma.UserProclamationsWhereUniqueInput + /** + * In case the UserProclamations found by the `where` argument doesn't exist, create a new UserProclamations with this data. + */ + create: Prisma.XOR + /** + * In case the UserProclamations was found with the provided `where` argument, update it with this data. + */ + update: Prisma.XOR +} + +/** + * UserProclamations delete + */ +export type UserProclamationsDeleteArgs = { + /** + * Select specific fields to fetch from the UserProclamations + */ + select?: Prisma.UserProclamationsSelect | null + /** + * Omit specific fields from the UserProclamations + */ + omit?: Prisma.UserProclamationsOmit | null + /** + * Choose, which related nodes to fetch as well + */ + include?: Prisma.UserProclamationsInclude | null + /** + * Filter which UserProclamations to delete. + */ + where: Prisma.UserProclamationsWhereUniqueInput +} + +/** + * UserProclamations deleteMany + */ +export type UserProclamationsDeleteManyArgs = { + /** + * Filter which UserProclamations to delete + */ + where?: Prisma.UserProclamationsWhereInput + /** + * Limit how many UserProclamations to delete. + */ + limit?: number +} + +/** + * UserProclamations without action + */ +export type UserProclamationsDefaultArgs = { + /** + * Select specific fields to fetch from the UserProclamations + */ + select?: Prisma.UserProclamationsSelect | null + /** + * Omit specific fields from the UserProclamations + */ + omit?: Prisma.UserProclamationsOmit | null + /** + * Choose, which related nodes to fetch as well + */ + include?: Prisma.UserProclamationsInclude | null +} diff --git a/src/lib/svelte-admin/README.md b/src/lib/svelte-admin/README.md index 7d9e330..340082d 100644 --- a/src/lib/svelte-admin/README.md +++ b/src/lib/svelte-admin/README.md @@ -83,23 +83,23 @@ No new route files, no new components. The registry is the only thing you touch. ### AdminModelConfig -| Field | Type | Required | Description | -|---|---|---|---| -| `slug` | `string` | Yes | URL segment (kebab-case). Used in `/admin/{slug}`. | -| `modelName` | `string` | Yes | Prisma model name (PascalCase, **singular**). Maps to `prisma[lcfirst(modelName)]`. | -| `displayName` | `string` | Yes | Plural display name for headings and navigation. | -| `displayNameSingular` | `string` | Yes | Singular name for edit page headings. | -| `idType` | `'String' \| 'Int'` | Yes | Primary key type. Controls how the `id` URL param is parsed. | -| `include` | `Record` | No | Prisma `include` clause for eager-loading relations. | -| `listFields` | `string[]` | Yes | Table columns. Supports dot-notation for relations (e.g., `'role.name'`). | -| `searchFields` | `string[]` | Yes | Fields searched by the client-side search filter. | -| `formFields` | `string[]` | Yes | Fields rendered in create/edit forms, in display order. | -| `readonlyFields` | `string[]` | No | Fields shown as read-only on the edit page. | -| `listOnly` | `boolean` | No | If `true`, suppresses edit links in the table. | -| `fieldTypes` | `Record` | Yes | Maps field names to scalar types. Controls input rendering and FormData parsing. | -| `relationOptions` | `Record` | No | FK fields that render as ComboBox dropdowns. | -| `relatedRecords` | `RelatedRecordConfig[]` | No | Has-one/has-many panels shown on edit pages. | -| `accessFilter` | `(viewerRoleId: number) => where \| undefined` | No | Returns a Prisma `where` clause to filter records by viewer role. `undefined` = no filter. | +| Field | Type | Required | Description | +| --------------------- | ---------------------------------------------- | -------- | ------------------------------------------------------------------------------------------ | +| `slug` | `string` | Yes | URL segment (kebab-case). Used in `/admin/{slug}`. | +| `modelName` | `string` | Yes | Prisma model name (PascalCase, **singular**). Maps to `prisma[lcfirst(modelName)]`. | +| `displayName` | `string` | Yes | Plural display name for headings and navigation. | +| `displayNameSingular` | `string` | Yes | Singular name for edit page headings. | +| `idType` | `'String' \| 'Int'` | Yes | Primary key type. Controls how the `id` URL param is parsed. | +| `include` | `Record` | No | Prisma `include` clause for eager-loading relations. | +| `listFields` | `string[]` | Yes | Table columns. Supports dot-notation for relations (e.g., `'role.name'`). | +| `searchFields` | `string[]` | Yes | Fields searched by the client-side search filter. | +| `formFields` | `string[]` | Yes | Fields rendered in create/edit forms, in display order. | +| `readonlyFields` | `string[]` | No | Fields shown as read-only on the edit page. | +| `listOnly` | `boolean` | No | If `true`, suppresses edit links in the table. | +| `fieldTypes` | `Record` | Yes | Maps field names to scalar types. Controls input rendering and FormData parsing. | +| `relationOptions` | `Record` | No | FK fields that render as ComboBox dropdowns. | +| `relatedRecords` | `RelatedRecordConfig[]` | No | Has-one/has-many panels shown on edit pages. | +| `accessFilter` | `(viewerRoleId: number) => where \| undefined` | No | Returns a Prisma `where` clause to filter records by viewer role. `undefined` = no filter. | ### PrismaScalarType @@ -107,13 +107,13 @@ No new route files, no new components. The registry is the only thing you touch. Controls both form input rendering and FormData parsing: -| Type | HTML Input | Parse Logic | -|---|---|---| -| `String` | `` | `raw.toString()` | -| `Int` | `` | `parseInt()`, empty → `null` | -| `Float` | `` | `parseFloat()`, empty → `null` | -| `Boolean` | `` | `'on'` or `'true'` → `true` | -| `DateTime` | `` | `new Date()`, empty → `null` | +| Type | HTML Input | Parse Logic | +| ---------- | ----------------------------------- | ------------------------------ | +| `String` | `` | `raw.toString()` | +| `Int` | `` | `parseInt()`, empty → `null` | +| `Float` | `` | `parseFloat()`, empty → `null` | +| `Boolean` | `` | `'on'` or `'true'` → `true` | +| `DateTime` | `` | `new Date()`, empty → `null` | ### RelationOptionConfig @@ -184,20 +184,20 @@ Display has-one or has-many related records as panels on the edit page using `re ```ts relatedRecords: [ - { - relationKey: 'profile', - label: 'Profile', - type: 'has-one', - displayFields: ['firstName', 'lastName'], - editSlug: 'profiles' // links to /admin/profiles/{id} - }, - { - relationKey: 'licenseKeys', - label: 'License Keys', - type: 'has-many', - displayFields: ['key', 'active', 'level'] - } -] + { + relationKey: 'profile', + label: 'Profile', + type: 'has-one', + displayFields: ['firstName', 'lastName'], + editSlug: 'profiles' // links to /admin/profiles/{id} + }, + { + relationKey: 'licenseKeys', + label: 'License Keys', + type: 'has-many', + displayFields: ['key', 'active', 'level'] + } +]; ``` The `relationKey` must match a key in `include` so the data is actually loaded. `has-one` renders @@ -210,12 +210,12 @@ support an optional `editSlug` to link to the related record's edit page. Defined in `roles.ts`. Lower numbers = higher privilege: -| Constant | Value | Access Level | -|---|---|---| -| `ROLES.SUPER` | 1 | Full access, sees all users | -| `ROLES.ADMIN` | 2 | Admin access, sees staff and below | -| `ROLES.STAFF` | 3 | Staff access (minimum for admin panel) | -| `ROLES.USER` | 4 | Regular user (no admin access) | +| Constant | Value | Access Level | +| ------------- | ----- | -------------------------------------- | +| `ROLES.SUPER` | 1 | Full access, sees all users | +| `ROLES.ADMIN` | 2 | Admin access, sees staff and below | +| `ROLES.STAFF` | 3 | Staff access (minimum for admin panel) | +| `ROLES.USER` | 4 | Regular user (no admin access) | ### Layout Guard @@ -228,12 +228,12 @@ Use `accessFilter` to restrict which records a viewer can see: ```ts accessFilter: (viewerRoleId: number) => { - if (viewerRoleId <= ROLES.SUPER) return undefined; // no filter - if (viewerRoleId <= ROLES.ADMIN) { - return { roleId: { gte: ROLES.STAFF } }; // can't see other admins - } - return { roleId: { gt: ROLES.STAFF } }; // staff sees only regular users -} + if (viewerRoleId <= ROLES.SUPER) return undefined; // no filter + if (viewerRoleId <= ROLES.ADMIN) { + return { roleId: { gte: ROLES.STAFF } }; // can't see other admins + } + return { roleId: { gt: ROLES.STAFF } }; // staff sees only regular users +}; ``` ## How Dynamic Routing Works @@ -250,74 +250,74 @@ accessFilter: (viewerRoleId: number) => { ### AdminTable -| Prop | Type | Description | -|---|---|---| -| `records` | `Record[]` | Data rows | -| `listFields` | `string[]` | Column keys (dot-notation supported) | -| `searchFields` | `string[]` | Fields for client-side search | -| `modelSlug` | `string` | Used for building edit links | -| `listOnly` | `boolean?` | Suppress edit links | +| Prop | Type | Description | +| -------------- | --------------------------- | ------------------------------------ | +| `records` | `Record[]` | Data rows | +| `listFields` | `string[]` | Column keys (dot-notation supported) | +| `searchFields` | `string[]` | Fields for client-side search | +| `modelSlug` | `string` | Used for building edit links | +| `listOnly` | `boolean?` | Suppress edit links | Features: client-side search, click-to-sort columns, auto-formatted cells (dates, booleans, decimals), filtered count display. ### AdminForm -| Prop | Type | Description | -|---|---|---| -| `fields` | `string[]` | Field names to render | -| `fieldTypes` | `Record` | Type mapping for inputs | -| `relationOptions` | `Record?` | FK dropdown configs | -| `relationOptionsData` | `Record?` | Loaded dropdown options | -| `record` | `Record?` | Pre-fill values (edit mode) | -| `form` | `ActionData?` | Carries validation errors | -| `action` | `string` | Form action (e.g., `'?/create'`) | -| `submitLabel` | `string?` | Button text | +| Prop | Type | Description | +| --------------------- | --------------------------------------- | -------------------------------- | +| `fields` | `string[]` | Field names to render | +| `fieldTypes` | `Record` | Type mapping for inputs | +| `relationOptions` | `Record?` | FK dropdown configs | +| `relationOptionsData` | `Record?` | Loaded dropdown options | +| `record` | `Record?` | Pre-fill values (edit mode) | +| `form` | `ActionData?` | Carries validation errors | +| `action` | `string` | Form action (e.g., `'?/create'`) | +| `submitLabel` | `string?` | Button text | ### ComboBox -| Prop | Type | Description | -|---|---|---| -| `id` | `string` | Element ID | -| `name` | `string` | Form field name | -| `options` | `{ label; value }[]` | Dropdown items | -| `placeholder` | `string?` | Placeholder text | -| `value` | `string \| number?` | Pre-selected value | +| Prop | Type | Description | +| ------------- | -------------------- | ------------------ | +| `id` | `string` | Element ID | +| `name` | `string` | Form field name | +| `options` | `{ label; value }[]` | Dropdown items | +| `placeholder` | `string?` | Placeholder text | +| `value` | `string \| number?` | Pre-selected value | Features: type-to-search filtering, keyboard navigation (ArrowUp/Down, Enter, Escape), clear button, scroll-to-highlight. ### RelatedHasOne -| Prop | Type | Description | -|---|---|---| -| `label` | `string` | Section heading | -| `record` | `Record \| null` | Related record | -| `displayFields` | `string[]` | Fields to display as key-value pairs | -| `editSlug` | `string?` | Links to edit the related record | +| Prop | Type | Description | +| --------------- | --------------------------------- | ------------------------------------ | +| `label` | `string` | Section heading | +| `record` | `Record \| null` | Related record | +| `displayFields` | `string[]` | Fields to display as key-value pairs | +| `editSlug` | `string?` | Links to edit the related record | ### RelatedHasMany -| Prop | Type | Description | -|---|---|---| -| `label` | `string` | Section heading (shows count) | -| `records` | `Record[]` | Related records | -| `displayFields` | `string[]` | Table columns | -| `editSlug` | `string?` | Per-row edit links | +| Prop | Type | Description | +| --------------- | --------------------------- | ----------------------------- | +| `label` | `string` | Section heading (shows count) | +| `records` | `Record[]` | Related records | +| `displayFields` | `string[]` | Table columns | +| `editSlug` | `string?` | Per-row edit links | ## Utility Functions -| Function | Module | Description | -|---|---|---| -| `fieldNameToLabel(name)` | `introspect.ts` | `'solfeggioFrequencyId'` → `'Solfeggio Frequency'` (strips `Id`, adds spaces) | -| `resolveFieldValue(record, path)` | `introspect.ts` | Resolves dot-notation paths like `'category.name'` on nested objects | -| `extractFormData(formData, fields, types)` | `form-data.ts` | Parses `FormData` with type-aware conversion per `PrismaScalarType` | -| `getDelegate(config)` | `prisma-delegate.ts` | Returns `prisma[lcfirst(modelName)]` delegate | -| `parseId(config, raw)` | `prisma-delegate.ts` | Parses string to `number` when `idType` is `'Int'` | -| `getModelConfig(slug)` | `registry.ts` | Looks up config by URL slug | -| `getAllModelConfigs()` | `registry.ts` | Returns all registered model configs | -| `hasRole(roleId, required)` | `roles.ts` | `true` if `roleId <= required` | -| `canAccessAdmin(roleId)` | `roles.ts` | `true` if `roleId <= ROLES.STAFF` | +| Function | Module | Description | +| ------------------------------------------ | -------------------- | ----------------------------------------------------------------------------- | +| `fieldNameToLabel(name)` | `introspect.ts` | `'solfeggioFrequencyId'` → `'Solfeggio Frequency'` (strips `Id`, adds spaces) | +| `resolveFieldValue(record, path)` | `introspect.ts` | Resolves dot-notation paths like `'category.name'` on nested objects | +| `extractFormData(formData, fields, types)` | `form-data.ts` | Parses `FormData` with type-aware conversion per `PrismaScalarType` | +| `getDelegate(config)` | `prisma-delegate.ts` | Returns `prisma[lcfirst(modelName)]` delegate | +| `parseId(config, raw)` | `prisma-delegate.ts` | Parses string to `number` when `idType` is `'Int'` | +| `getModelConfig(slug)` | `registry.ts` | Looks up config by URL slug | +| `getAllModelConfigs()` | `registry.ts` | Returns all registered model configs | +| `hasRole(roleId, required)` | `roles.ts` | `true` if `roleId <= required` | +| `canAccessAdmin(roleId)` | `roles.ts` | `true` if `roleId <= ROLES.STAFF` | ## Complete Example diff --git a/src/routes/api/v1/proclamations/+server.ts b/src/routes/api/v1/proclamations/+server.ts index 9600d60..3406667 100644 --- a/src/routes/api/v1/proclamations/+server.ts +++ b/src/routes/api/v1/proclamations/+server.ts @@ -2,6 +2,11 @@ import { error } from '@sveltejs/kit'; import type { RequestHandler } from './$types'; import { prisma } from '$lib/db'; +// /api/v1/proclamations +// GET only +// ?email, ?key (license key) +// Returns all proclamations without email and key, else returns proclamations +// associated with the user associated with the key and email export const GET: RequestHandler = async ({ url }) => { const key = url.searchParams.get('key') ?? ''; const email = url.searchParams.get('email') ?? ''; @@ -20,11 +25,38 @@ export const GET: RequestHandler = async ({ url }) => { } // Check that the key exists - // Check that the email exists - // Check that the email belongs to a user - // Check that the key belongs to the user - // Write a helper function for this - // Return all proclamations attached to the user + const verifiedKey = await prisma.licenseKey.findUnique({ + where: { + key: key + } + }); + if (!verifiedKey) { + return error(400, 'not-authorized'); + } - return new Response(JSON.stringify({ error: 'not implemented' }), { status: 501 }); + // Check that the email exists + const existingUser = await prisma.user.findUnique({ + where: { + email: email + }, + include: { + licenseKeys: true + } + }); + if (!existingUser) { + return error(400, 'not-authorized'); + } + // Check that the key belongs to the user + if (!existingUser.licenseKeys.includes(verifiedKey)) { + return error(400, "this key doesn't appear to belong to you"); + } + + // Return all proclamations attached to the user + const userProclamations = await prisma.userProclamations.findMany({ + where: { + userId: existingUser.id + } + }); + + return new Response(JSON.stringify(userProclamations)); };