diff --git a/prisma/migrations/20260219181248_init_migration/migration.sql b/prisma/migrations/20260219181248_init_migration/migration.sql new file mode 100644 index 0000000..3ac7e55 --- /dev/null +++ b/prisma/migrations/20260219181248_init_migration/migration.sql @@ -0,0 +1,13 @@ +-- CreateTable +CREATE TABLE "LicenseKey" ( + "id" TEXT NOT NULL, + "key" TEXT NOT NULL, + "active" BOOLEAN NOT NULL, + "level" TEXT NOT NULL, + "userId" TEXT NOT NULL, + + CONSTRAINT "LicenseKey_pkey" PRIMARY KEY ("id") +); + +-- AddForeignKey +ALTER TABLE "LicenseKey" ADD CONSTRAINT "LicenseKey_userId_fkey" FOREIGN KEY ("userId") REFERENCES "user"("id") ON DELETE RESTRICT ON UPDATE CASCADE; diff --git a/prisma/schema.prisma b/prisma/schema.prisma index 8c14f4a..e3eecfc 100644 --- a/prisma/schema.prisma +++ b/prisma/schema.prisma @@ -14,18 +14,19 @@ datasource db { } model User { - id String @id + id String @id name String email String - emailVerified Boolean @default(false) + emailVerified Boolean @default(false) image String? - createdAt DateTime @default(now()) - updatedAt DateTime @updatedAt + createdAt DateTime @default(now()) + updatedAt DateTime @updatedAt roleId Int? - role UserRole? @relation(fields: [roleId], references: [id]) + role UserRole? @relation(fields: [roleId], references: [id]) sessions Session[] accounts Account[] profile Profile? + licenseKeys LicenseKey[] @@unique([email]) @@map("user") @@ -131,3 +132,12 @@ model AffirmationCategory { name String @unique affirmations Affirmation[] } + +model LicenseKey { + id String @id @default(uuid()) + key String + active Boolean + level String + userId String + user User @relation(fields: [userId], references: [id]) +} diff --git a/src/lib/generated/prisma/browser.ts b/src/lib/generated/prisma/browser.ts index b9e6df9..984941f 100644 --- a/src/lib/generated/prisma/browser.ts +++ b/src/lib/generated/prisma/browser.ts @@ -67,3 +67,8 @@ export type SolfeggioFrequency = Prisma.SolfeggioFrequencyModel * */ export type AffirmationCategory = Prisma.AffirmationCategoryModel +/** + * Model LicenseKey + * + */ +export type LicenseKey = Prisma.LicenseKeyModel diff --git a/src/lib/generated/prisma/client.ts b/src/lib/generated/prisma/client.ts index 82ae90e..8dcd242 100644 --- a/src/lib/generated/prisma/client.ts +++ b/src/lib/generated/prisma/client.ts @@ -89,3 +89,8 @@ export type SolfeggioFrequency = Prisma.SolfeggioFrequencyModel * */ export type AffirmationCategory = Prisma.AffirmationCategoryModel +/** + * Model LicenseKey + * + */ +export type LicenseKey = Prisma.LicenseKeyModel diff --git a/src/lib/generated/prisma/internal/class.ts b/src/lib/generated/prisma/internal/class.ts index 31783ad..78f59fd 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\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 Affirmation {\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 AffirmationCategory @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 affirmations Affirmation[]\n}\n\nmodel AffirmationCategory {\n id Int @id @default(autoincrement())\n name String @unique\n affirmations Affirmation[]\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\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 Affirmation {\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 AffirmationCategory @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 affirmations Affirmation[]\n}\n\nmodel AffirmationCategory {\n id Int @id @default(autoincrement())\n name String @unique\n affirmations Affirmation[]\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", "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\"}],\"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\"},\"Affirmation\":{\"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\":\"AffirmationToSolfeggioFrequency\"},{\"name\":\"categoryId\",\"kind\":\"scalar\",\"type\":\"Int\"},{\"name\":\"category\",\"kind\":\"object\",\"type\":\"AffirmationCategory\",\"relationName\":\"AffirmationToAffirmationCategory\"},{\"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\":\"affirmations\",\"kind\":\"object\",\"type\":\"Affirmation\",\"relationName\":\"AffirmationToSolfeggioFrequency\"}],\"dbName\":null},\"AffirmationCategory\":{\"fields\":[{\"name\":\"id\",\"kind\":\"scalar\",\"type\":\"Int\"},{\"name\":\"name\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"affirmations\",\"kind\":\"object\",\"type\":\"Affirmation\",\"relationName\":\"AffirmationToAffirmationCategory\"}],\"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\"}],\"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\"},\"Affirmation\":{\"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\":\"AffirmationToSolfeggioFrequency\"},{\"name\":\"categoryId\",\"kind\":\"scalar\",\"type\":\"Int\"},{\"name\":\"category\",\"kind\":\"object\",\"type\":\"AffirmationCategory\",\"relationName\":\"AffirmationToAffirmationCategory\"},{\"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\":\"affirmations\",\"kind\":\"object\",\"type\":\"Affirmation\",\"relationName\":\"AffirmationToSolfeggioFrequency\"}],\"dbName\":null},\"AffirmationCategory\":{\"fields\":[{\"name\":\"id\",\"kind\":\"scalar\",\"type\":\"Int\"},{\"name\":\"name\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"affirmations\",\"kind\":\"object\",\"type\":\"Affirmation\",\"relationName\":\"AffirmationToAffirmationCategory\"}],\"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') @@ -273,6 +273,16 @@ export interface PrismaClient< * ``` */ get affirmationCategory(): Prisma.AffirmationCategoryDelegate; + + /** + * `prisma.licenseKey`: Exposes CRUD operations for the **LicenseKey** model. + * Example usage: + * ```ts + * // Fetch zero or more LicenseKeys + * const licenseKeys = await prisma.licenseKey.findMany() + * ``` + */ + get licenseKey(): Prisma.LicenseKeyDelegate; } export function getPrismaClientClass(): PrismaClientConstructor { diff --git a/src/lib/generated/prisma/internal/prismaNamespace.ts b/src/lib/generated/prisma/internal/prismaNamespace.ts index bb25266..86a4b07 100644 --- a/src/lib/generated/prisma/internal/prismaNamespace.ts +++ b/src/lib/generated/prisma/internal/prismaNamespace.ts @@ -393,7 +393,8 @@ export const ModelName = { Verification: 'Verification', Affirmation: 'Affirmation', SolfeggioFrequency: 'SolfeggioFrequency', - AffirmationCategory: 'AffirmationCategory' + AffirmationCategory: 'AffirmationCategory', + LicenseKey: 'LicenseKey' } as const export type ModelName = (typeof ModelName)[keyof typeof ModelName] @@ -409,7 +410,7 @@ export type TypeMap + fields: Prisma.LicenseKeyFieldRefs + operations: { + findUnique: { + args: Prisma.LicenseKeyFindUniqueArgs + result: runtime.Types.Utils.PayloadToResult | null + } + findUniqueOrThrow: { + args: Prisma.LicenseKeyFindUniqueOrThrowArgs + result: runtime.Types.Utils.PayloadToResult + } + findFirst: { + args: Prisma.LicenseKeyFindFirstArgs + result: runtime.Types.Utils.PayloadToResult | null + } + findFirstOrThrow: { + args: Prisma.LicenseKeyFindFirstOrThrowArgs + result: runtime.Types.Utils.PayloadToResult + } + findMany: { + args: Prisma.LicenseKeyFindManyArgs + result: runtime.Types.Utils.PayloadToResult[] + } + create: { + args: Prisma.LicenseKeyCreateArgs + result: runtime.Types.Utils.PayloadToResult + } + createMany: { + args: Prisma.LicenseKeyCreateManyArgs + result: BatchPayload + } + createManyAndReturn: { + args: Prisma.LicenseKeyCreateManyAndReturnArgs + result: runtime.Types.Utils.PayloadToResult[] + } + delete: { + args: Prisma.LicenseKeyDeleteArgs + result: runtime.Types.Utils.PayloadToResult + } + update: { + args: Prisma.LicenseKeyUpdateArgs + result: runtime.Types.Utils.PayloadToResult + } + deleteMany: { + args: Prisma.LicenseKeyDeleteManyArgs + result: BatchPayload + } + updateMany: { + args: Prisma.LicenseKeyUpdateManyArgs + result: BatchPayload + } + updateManyAndReturn: { + args: Prisma.LicenseKeyUpdateManyAndReturnArgs + result: runtime.Types.Utils.PayloadToResult[] + } + upsert: { + args: Prisma.LicenseKeyUpsertArgs + result: runtime.Types.Utils.PayloadToResult + } + aggregate: { + args: Prisma.LicenseKeyAggregateArgs + result: runtime.Types.Utils.Optional + } + groupBy: { + args: Prisma.LicenseKeyGroupByArgs + result: runtime.Types.Utils.Optional[] + } + count: { + args: Prisma.LicenseKeyCountArgs + result: runtime.Types.Utils.Optional | number + } + } + } } } & { other: { @@ -1312,6 +1387,17 @@ export const AffirmationCategoryScalarFieldEnum = { export type AffirmationCategoryScalarFieldEnum = (typeof AffirmationCategoryScalarFieldEnum)[keyof typeof AffirmationCategoryScalarFieldEnum] +export const LicenseKeyScalarFieldEnum = { + id: 'id', + key: 'key', + active: 'active', + level: 'level', + userId: 'userId' +} as const + +export type LicenseKeyScalarFieldEnum = (typeof LicenseKeyScalarFieldEnum)[keyof typeof LicenseKeyScalarFieldEnum] + + export const SortOrder = { asc: 'asc', desc: 'desc' @@ -1509,6 +1595,7 @@ export type GlobalOmitConfig = { affirmation?: Prisma.AffirmationOmit solfeggioFrequency?: Prisma.SolfeggioFrequencyOmit affirmationCategory?: Prisma.AffirmationCategoryOmit + licenseKey?: Prisma.LicenseKeyOmit } /* Types for Logging */ diff --git a/src/lib/generated/prisma/internal/prismaNamespaceBrowser.ts b/src/lib/generated/prisma/internal/prismaNamespaceBrowser.ts index a5dd52e..26708ef 100644 --- a/src/lib/generated/prisma/internal/prismaNamespaceBrowser.ts +++ b/src/lib/generated/prisma/internal/prismaNamespaceBrowser.ts @@ -60,7 +60,8 @@ export const ModelName = { Verification: 'Verification', Affirmation: 'Affirmation', SolfeggioFrequency: 'SolfeggioFrequency', - AffirmationCategory: 'AffirmationCategory' + AffirmationCategory: 'AffirmationCategory', + LicenseKey: 'LicenseKey' } as const export type ModelName = (typeof ModelName)[keyof typeof ModelName] @@ -199,6 +200,17 @@ export const AffirmationCategoryScalarFieldEnum = { export type AffirmationCategoryScalarFieldEnum = (typeof AffirmationCategoryScalarFieldEnum)[keyof typeof AffirmationCategoryScalarFieldEnum] +export const LicenseKeyScalarFieldEnum = { + id: 'id', + key: 'key', + active: 'active', + level: 'level', + userId: 'userId' +} as const + +export type LicenseKeyScalarFieldEnum = (typeof LicenseKeyScalarFieldEnum)[keyof typeof LicenseKeyScalarFieldEnum] + + export const SortOrder = { asc: 'asc', desc: 'desc' diff --git a/src/lib/generated/prisma/models.ts b/src/lib/generated/prisma/models.ts index 06b33ff..bf0a140 100644 --- a/src/lib/generated/prisma/models.ts +++ b/src/lib/generated/prisma/models.ts @@ -18,4 +18,5 @@ export type * from './models/Verification.ts' export type * from './models/Affirmation.ts' export type * from './models/SolfeggioFrequency.ts' export type * from './models/AffirmationCategory.ts' +export type * from './models/LicenseKey.ts' export type * from './commonInputTypes.ts' \ No newline at end of file diff --git a/src/lib/generated/prisma/models/LicenseKey.ts b/src/lib/generated/prisma/models/LicenseKey.ts new file mode 100644 index 0000000..1850322 --- /dev/null +++ b/src/lib/generated/prisma/models/LicenseKey.ts @@ -0,0 +1,1340 @@ + +/* !!! This is code generated by Prisma. Do not edit directly. !!! */ +/* eslint-disable */ +// biome-ignore-all lint: generated file +// @ts-nocheck +/* + * This file exports the `LicenseKey` 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 LicenseKey + * + */ +export type LicenseKeyModel = runtime.Types.Result.DefaultSelection + +export type AggregateLicenseKey = { + _count: LicenseKeyCountAggregateOutputType | null + _min: LicenseKeyMinAggregateOutputType | null + _max: LicenseKeyMaxAggregateOutputType | null +} + +export type LicenseKeyMinAggregateOutputType = { + id: string | null + key: string | null + active: boolean | null + level: string | null + userId: string | null +} + +export type LicenseKeyMaxAggregateOutputType = { + id: string | null + key: string | null + active: boolean | null + level: string | null + userId: string | null +} + +export type LicenseKeyCountAggregateOutputType = { + id: number + key: number + active: number + level: number + userId: number + _all: number +} + + +export type LicenseKeyMinAggregateInputType = { + id?: true + key?: true + active?: true + level?: true + userId?: true +} + +export type LicenseKeyMaxAggregateInputType = { + id?: true + key?: true + active?: true + level?: true + userId?: true +} + +export type LicenseKeyCountAggregateInputType = { + id?: true + key?: true + active?: true + level?: true + userId?: true + _all?: true +} + +export type LicenseKeyAggregateArgs = { + /** + * Filter which LicenseKey to aggregate. + */ + where?: Prisma.LicenseKeyWhereInput + /** + * {@link https://www.prisma.io/docs/concepts/components/prisma-client/sorting Sorting Docs} + * + * Determine the order of LicenseKeys to fetch. + */ + orderBy?: Prisma.LicenseKeyOrderByWithRelationInput | Prisma.LicenseKeyOrderByWithRelationInput[] + /** + * {@link https://www.prisma.io/docs/concepts/components/prisma-client/pagination#cursor-based-pagination Cursor Docs} + * + * Sets the start position + */ + cursor?: Prisma.LicenseKeyWhereUniqueInput + /** + * {@link https://www.prisma.io/docs/concepts/components/prisma-client/pagination Pagination Docs} + * + * Take `±n` LicenseKeys 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` LicenseKeys. + */ + skip?: number + /** + * {@link https://www.prisma.io/docs/concepts/components/prisma-client/aggregations Aggregation Docs} + * + * Count returned LicenseKeys + **/ + _count?: true | LicenseKeyCountAggregateInputType + /** + * {@link https://www.prisma.io/docs/concepts/components/prisma-client/aggregations Aggregation Docs} + * + * Select which fields to find the minimum value + **/ + _min?: LicenseKeyMinAggregateInputType + /** + * {@link https://www.prisma.io/docs/concepts/components/prisma-client/aggregations Aggregation Docs} + * + * Select which fields to find the maximum value + **/ + _max?: LicenseKeyMaxAggregateInputType +} + +export type GetLicenseKeyAggregateType = { + [P in keyof T & keyof AggregateLicenseKey]: P extends '_count' | 'count' + ? T[P] extends true + ? number + : Prisma.GetScalarType + : Prisma.GetScalarType +} + + + + +export type LicenseKeyGroupByArgs = { + where?: Prisma.LicenseKeyWhereInput + orderBy?: Prisma.LicenseKeyOrderByWithAggregationInput | Prisma.LicenseKeyOrderByWithAggregationInput[] + by: Prisma.LicenseKeyScalarFieldEnum[] | Prisma.LicenseKeyScalarFieldEnum + having?: Prisma.LicenseKeyScalarWhereWithAggregatesInput + take?: number + skip?: number + _count?: LicenseKeyCountAggregateInputType | true + _min?: LicenseKeyMinAggregateInputType + _max?: LicenseKeyMaxAggregateInputType +} + +export type LicenseKeyGroupByOutputType = { + id: string + key: string + active: boolean + level: string + userId: string + _count: LicenseKeyCountAggregateOutputType | null + _min: LicenseKeyMinAggregateOutputType | null + _max: LicenseKeyMaxAggregateOutputType | null +} + +type GetLicenseKeyGroupByPayload = Prisma.PrismaPromise< + Array< + Prisma.PickEnumerable & + { + [P in ((keyof T) & (keyof LicenseKeyGroupByOutputType))]: P extends '_count' + ? T[P] extends boolean + ? number + : Prisma.GetScalarType + : Prisma.GetScalarType + } + > + > + + + +export type LicenseKeyWhereInput = { + AND?: Prisma.LicenseKeyWhereInput | Prisma.LicenseKeyWhereInput[] + OR?: Prisma.LicenseKeyWhereInput[] + NOT?: Prisma.LicenseKeyWhereInput | Prisma.LicenseKeyWhereInput[] + id?: Prisma.StringFilter<"LicenseKey"> | string + key?: Prisma.StringFilter<"LicenseKey"> | string + active?: Prisma.BoolFilter<"LicenseKey"> | boolean + level?: Prisma.StringFilter<"LicenseKey"> | string + userId?: Prisma.StringFilter<"LicenseKey"> | string + user?: Prisma.XOR +} + +export type LicenseKeyOrderByWithRelationInput = { + id?: Prisma.SortOrder + key?: Prisma.SortOrder + active?: Prisma.SortOrder + level?: Prisma.SortOrder + userId?: Prisma.SortOrder + user?: Prisma.UserOrderByWithRelationInput +} + +export type LicenseKeyWhereUniqueInput = Prisma.AtLeast<{ + id?: 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"> + +export type LicenseKeyOrderByWithAggregationInput = { + id?: Prisma.SortOrder + key?: Prisma.SortOrder + active?: Prisma.SortOrder + level?: Prisma.SortOrder + userId?: Prisma.SortOrder + _count?: Prisma.LicenseKeyCountOrderByAggregateInput + _max?: Prisma.LicenseKeyMaxOrderByAggregateInput + _min?: Prisma.LicenseKeyMinOrderByAggregateInput +} + +export type LicenseKeyScalarWhereWithAggregatesInput = { + AND?: Prisma.LicenseKeyScalarWhereWithAggregatesInput | Prisma.LicenseKeyScalarWhereWithAggregatesInput[] + OR?: Prisma.LicenseKeyScalarWhereWithAggregatesInput[] + NOT?: Prisma.LicenseKeyScalarWhereWithAggregatesInput | Prisma.LicenseKeyScalarWhereWithAggregatesInput[] + id?: Prisma.StringWithAggregatesFilter<"LicenseKey"> | string + key?: Prisma.StringWithAggregatesFilter<"LicenseKey"> | string + active?: Prisma.BoolWithAggregatesFilter<"LicenseKey"> | boolean + level?: Prisma.StringWithAggregatesFilter<"LicenseKey"> | string + userId?: Prisma.StringWithAggregatesFilter<"LicenseKey"> | string +} + +export type LicenseKeyCreateInput = { + id?: string + key: string + active: boolean + level: string + user: Prisma.UserCreateNestedOneWithoutLicenseKeysInput +} + +export type LicenseKeyUncheckedCreateInput = { + id?: string + key: string + active: boolean + level: string + userId: string +} + +export type LicenseKeyUpdateInput = { + id?: Prisma.StringFieldUpdateOperationsInput | string + key?: Prisma.StringFieldUpdateOperationsInput | string + active?: Prisma.BoolFieldUpdateOperationsInput | boolean + level?: Prisma.StringFieldUpdateOperationsInput | string + user?: Prisma.UserUpdateOneRequiredWithoutLicenseKeysNestedInput +} + +export type LicenseKeyUncheckedUpdateInput = { + id?: Prisma.StringFieldUpdateOperationsInput | string + key?: Prisma.StringFieldUpdateOperationsInput | string + active?: Prisma.BoolFieldUpdateOperationsInput | boolean + level?: Prisma.StringFieldUpdateOperationsInput | string + userId?: Prisma.StringFieldUpdateOperationsInput | string +} + +export type LicenseKeyCreateManyInput = { + id?: string + key: string + active: boolean + level: string + userId: string +} + +export type LicenseKeyUpdateManyMutationInput = { + id?: Prisma.StringFieldUpdateOperationsInput | string + key?: Prisma.StringFieldUpdateOperationsInput | string + active?: Prisma.BoolFieldUpdateOperationsInput | boolean + level?: Prisma.StringFieldUpdateOperationsInput | string +} + +export type LicenseKeyUncheckedUpdateManyInput = { + id?: Prisma.StringFieldUpdateOperationsInput | string + key?: Prisma.StringFieldUpdateOperationsInput | string + active?: Prisma.BoolFieldUpdateOperationsInput | boolean + level?: Prisma.StringFieldUpdateOperationsInput | string + userId?: Prisma.StringFieldUpdateOperationsInput | string +} + +export type LicenseKeyListRelationFilter = { + every?: Prisma.LicenseKeyWhereInput + some?: Prisma.LicenseKeyWhereInput + none?: Prisma.LicenseKeyWhereInput +} + +export type LicenseKeyOrderByRelationAggregateInput = { + _count?: Prisma.SortOrder +} + +export type LicenseKeyCountOrderByAggregateInput = { + id?: Prisma.SortOrder + key?: Prisma.SortOrder + active?: Prisma.SortOrder + level?: Prisma.SortOrder + userId?: Prisma.SortOrder +} + +export type LicenseKeyMaxOrderByAggregateInput = { + id?: Prisma.SortOrder + key?: Prisma.SortOrder + active?: Prisma.SortOrder + level?: Prisma.SortOrder + userId?: Prisma.SortOrder +} + +export type LicenseKeyMinOrderByAggregateInput = { + id?: Prisma.SortOrder + key?: Prisma.SortOrder + active?: Prisma.SortOrder + level?: Prisma.SortOrder + userId?: Prisma.SortOrder +} + +export type LicenseKeyCreateNestedManyWithoutUserInput = { + create?: Prisma.XOR | Prisma.LicenseKeyCreateWithoutUserInput[] | Prisma.LicenseKeyUncheckedCreateWithoutUserInput[] + connectOrCreate?: Prisma.LicenseKeyCreateOrConnectWithoutUserInput | Prisma.LicenseKeyCreateOrConnectWithoutUserInput[] + createMany?: Prisma.LicenseKeyCreateManyUserInputEnvelope + connect?: Prisma.LicenseKeyWhereUniqueInput | Prisma.LicenseKeyWhereUniqueInput[] +} + +export type LicenseKeyUncheckedCreateNestedManyWithoutUserInput = { + create?: Prisma.XOR | Prisma.LicenseKeyCreateWithoutUserInput[] | Prisma.LicenseKeyUncheckedCreateWithoutUserInput[] + connectOrCreate?: Prisma.LicenseKeyCreateOrConnectWithoutUserInput | Prisma.LicenseKeyCreateOrConnectWithoutUserInput[] + createMany?: Prisma.LicenseKeyCreateManyUserInputEnvelope + connect?: Prisma.LicenseKeyWhereUniqueInput | Prisma.LicenseKeyWhereUniqueInput[] +} + +export type LicenseKeyUpdateManyWithoutUserNestedInput = { + create?: Prisma.XOR | Prisma.LicenseKeyCreateWithoutUserInput[] | Prisma.LicenseKeyUncheckedCreateWithoutUserInput[] + connectOrCreate?: Prisma.LicenseKeyCreateOrConnectWithoutUserInput | Prisma.LicenseKeyCreateOrConnectWithoutUserInput[] + upsert?: Prisma.LicenseKeyUpsertWithWhereUniqueWithoutUserInput | Prisma.LicenseKeyUpsertWithWhereUniqueWithoutUserInput[] + createMany?: Prisma.LicenseKeyCreateManyUserInputEnvelope + set?: Prisma.LicenseKeyWhereUniqueInput | Prisma.LicenseKeyWhereUniqueInput[] + disconnect?: Prisma.LicenseKeyWhereUniqueInput | Prisma.LicenseKeyWhereUniqueInput[] + delete?: Prisma.LicenseKeyWhereUniqueInput | Prisma.LicenseKeyWhereUniqueInput[] + connect?: Prisma.LicenseKeyWhereUniqueInput | Prisma.LicenseKeyWhereUniqueInput[] + update?: Prisma.LicenseKeyUpdateWithWhereUniqueWithoutUserInput | Prisma.LicenseKeyUpdateWithWhereUniqueWithoutUserInput[] + updateMany?: Prisma.LicenseKeyUpdateManyWithWhereWithoutUserInput | Prisma.LicenseKeyUpdateManyWithWhereWithoutUserInput[] + deleteMany?: Prisma.LicenseKeyScalarWhereInput | Prisma.LicenseKeyScalarWhereInput[] +} + +export type LicenseKeyUncheckedUpdateManyWithoutUserNestedInput = { + create?: Prisma.XOR | Prisma.LicenseKeyCreateWithoutUserInput[] | Prisma.LicenseKeyUncheckedCreateWithoutUserInput[] + connectOrCreate?: Prisma.LicenseKeyCreateOrConnectWithoutUserInput | Prisma.LicenseKeyCreateOrConnectWithoutUserInput[] + upsert?: Prisma.LicenseKeyUpsertWithWhereUniqueWithoutUserInput | Prisma.LicenseKeyUpsertWithWhereUniqueWithoutUserInput[] + createMany?: Prisma.LicenseKeyCreateManyUserInputEnvelope + set?: Prisma.LicenseKeyWhereUniqueInput | Prisma.LicenseKeyWhereUniqueInput[] + disconnect?: Prisma.LicenseKeyWhereUniqueInput | Prisma.LicenseKeyWhereUniqueInput[] + delete?: Prisma.LicenseKeyWhereUniqueInput | Prisma.LicenseKeyWhereUniqueInput[] + connect?: Prisma.LicenseKeyWhereUniqueInput | Prisma.LicenseKeyWhereUniqueInput[] + update?: Prisma.LicenseKeyUpdateWithWhereUniqueWithoutUserInput | Prisma.LicenseKeyUpdateWithWhereUniqueWithoutUserInput[] + updateMany?: Prisma.LicenseKeyUpdateManyWithWhereWithoutUserInput | Prisma.LicenseKeyUpdateManyWithWhereWithoutUserInput[] + deleteMany?: Prisma.LicenseKeyScalarWhereInput | Prisma.LicenseKeyScalarWhereInput[] +} + +export type LicenseKeyCreateWithoutUserInput = { + id?: string + key: string + active: boolean + level: string +} + +export type LicenseKeyUncheckedCreateWithoutUserInput = { + id?: string + key: string + active: boolean + level: string +} + +export type LicenseKeyCreateOrConnectWithoutUserInput = { + where: Prisma.LicenseKeyWhereUniqueInput + create: Prisma.XOR +} + +export type LicenseKeyCreateManyUserInputEnvelope = { + data: Prisma.LicenseKeyCreateManyUserInput | Prisma.LicenseKeyCreateManyUserInput[] + skipDuplicates?: boolean +} + +export type LicenseKeyUpsertWithWhereUniqueWithoutUserInput = { + where: Prisma.LicenseKeyWhereUniqueInput + update: Prisma.XOR + create: Prisma.XOR +} + +export type LicenseKeyUpdateWithWhereUniqueWithoutUserInput = { + where: Prisma.LicenseKeyWhereUniqueInput + data: Prisma.XOR +} + +export type LicenseKeyUpdateManyWithWhereWithoutUserInput = { + where: Prisma.LicenseKeyScalarWhereInput + data: Prisma.XOR +} + +export type LicenseKeyScalarWhereInput = { + AND?: Prisma.LicenseKeyScalarWhereInput | Prisma.LicenseKeyScalarWhereInput[] + OR?: Prisma.LicenseKeyScalarWhereInput[] + NOT?: Prisma.LicenseKeyScalarWhereInput | Prisma.LicenseKeyScalarWhereInput[] + id?: Prisma.StringFilter<"LicenseKey"> | string + key?: Prisma.StringFilter<"LicenseKey"> | string + active?: Prisma.BoolFilter<"LicenseKey"> | boolean + level?: Prisma.StringFilter<"LicenseKey"> | string + userId?: Prisma.StringFilter<"LicenseKey"> | string +} + +export type LicenseKeyCreateManyUserInput = { + id?: string + key: string + active: boolean + level: string +} + +export type LicenseKeyUpdateWithoutUserInput = { + id?: Prisma.StringFieldUpdateOperationsInput | string + key?: Prisma.StringFieldUpdateOperationsInput | string + active?: Prisma.BoolFieldUpdateOperationsInput | boolean + level?: Prisma.StringFieldUpdateOperationsInput | string +} + +export type LicenseKeyUncheckedUpdateWithoutUserInput = { + id?: Prisma.StringFieldUpdateOperationsInput | string + key?: Prisma.StringFieldUpdateOperationsInput | string + active?: Prisma.BoolFieldUpdateOperationsInput | boolean + level?: Prisma.StringFieldUpdateOperationsInput | string +} + +export type LicenseKeyUncheckedUpdateManyWithoutUserInput = { + id?: Prisma.StringFieldUpdateOperationsInput | string + key?: Prisma.StringFieldUpdateOperationsInput | string + active?: Prisma.BoolFieldUpdateOperationsInput | boolean + level?: Prisma.StringFieldUpdateOperationsInput | string +} + + + +export type LicenseKeySelect = runtime.Types.Extensions.GetSelect<{ + id?: boolean + key?: boolean + active?: boolean + level?: boolean + userId?: boolean + user?: boolean | Prisma.UserDefaultArgs +}, ExtArgs["result"]["licenseKey"]> + +export type LicenseKeySelectCreateManyAndReturn = runtime.Types.Extensions.GetSelect<{ + id?: boolean + key?: boolean + active?: boolean + level?: boolean + userId?: boolean + user?: boolean | Prisma.UserDefaultArgs +}, ExtArgs["result"]["licenseKey"]> + +export type LicenseKeySelectUpdateManyAndReturn = runtime.Types.Extensions.GetSelect<{ + id?: boolean + key?: boolean + active?: boolean + level?: boolean + userId?: boolean + user?: boolean | Prisma.UserDefaultArgs +}, ExtArgs["result"]["licenseKey"]> + +export type LicenseKeySelectScalar = { + id?: boolean + key?: boolean + active?: boolean + level?: boolean + userId?: boolean +} + +export type LicenseKeyOmit = runtime.Types.Extensions.GetOmit<"id" | "key" | "active" | "level" | "userId", ExtArgs["result"]["licenseKey"]> +export type LicenseKeyInclude = { + user?: boolean | Prisma.UserDefaultArgs +} +export type LicenseKeyIncludeCreateManyAndReturn = { + user?: boolean | Prisma.UserDefaultArgs +} +export type LicenseKeyIncludeUpdateManyAndReturn = { + user?: boolean | Prisma.UserDefaultArgs +} + +export type $LicenseKeyPayload = { + name: "LicenseKey" + objects: { + user: Prisma.$UserPayload + } + scalars: runtime.Types.Extensions.GetPayloadResult<{ + id: string + key: string + active: boolean + level: string + userId: string + }, ExtArgs["result"]["licenseKey"]> + composites: {} +} + +export type LicenseKeyGetPayload = runtime.Types.Result.GetResult + +export type LicenseKeyCountArgs = + Omit & { + select?: LicenseKeyCountAggregateInputType | true + } + +export interface LicenseKeyDelegate { + [K: symbol]: { types: Prisma.TypeMap['model']['LicenseKey'], meta: { name: 'LicenseKey' } } + /** + * Find zero or one LicenseKey that matches the filter. + * @param {LicenseKeyFindUniqueArgs} args - Arguments to find a LicenseKey + * @example + * // Get one LicenseKey + * const licenseKey = await prisma.licenseKey.findUnique({ + * where: { + * // ... provide filter here + * } + * }) + */ + findUnique(args: Prisma.SelectSubset>): Prisma.Prisma__LicenseKeyClient, T, "findUnique", GlobalOmitOptions> | null, null, ExtArgs, GlobalOmitOptions> + + /** + * Find one LicenseKey that matches the filter or throw an error with `error.code='P2025'` + * if no matches were found. + * @param {LicenseKeyFindUniqueOrThrowArgs} args - Arguments to find a LicenseKey + * @example + * // Get one LicenseKey + * const licenseKey = await prisma.licenseKey.findUniqueOrThrow({ + * where: { + * // ... provide filter here + * } + * }) + */ + findUniqueOrThrow(args: Prisma.SelectSubset>): Prisma.Prisma__LicenseKeyClient, T, "findUniqueOrThrow", GlobalOmitOptions>, never, ExtArgs, GlobalOmitOptions> + + /** + * Find the first LicenseKey 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 {LicenseKeyFindFirstArgs} args - Arguments to find a LicenseKey + * @example + * // Get one LicenseKey + * const licenseKey = await prisma.licenseKey.findFirst({ + * where: { + * // ... provide filter here + * } + * }) + */ + findFirst(args?: Prisma.SelectSubset>): Prisma.Prisma__LicenseKeyClient, T, "findFirst", GlobalOmitOptions> | null, null, ExtArgs, GlobalOmitOptions> + + /** + * Find the first LicenseKey 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 {LicenseKeyFindFirstOrThrowArgs} args - Arguments to find a LicenseKey + * @example + * // Get one LicenseKey + * const licenseKey = await prisma.licenseKey.findFirstOrThrow({ + * where: { + * // ... provide filter here + * } + * }) + */ + findFirstOrThrow(args?: Prisma.SelectSubset>): Prisma.Prisma__LicenseKeyClient, T, "findFirstOrThrow", GlobalOmitOptions>, never, ExtArgs, GlobalOmitOptions> + + /** + * Find zero or more LicenseKeys 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 {LicenseKeyFindManyArgs} args - Arguments to filter and select certain fields only. + * @example + * // Get all LicenseKeys + * const licenseKeys = await prisma.licenseKey.findMany() + * + * // Get first 10 LicenseKeys + * const licenseKeys = await prisma.licenseKey.findMany({ take: 10 }) + * + * // Only select the `id` + * const licenseKeyWithIdOnly = await prisma.licenseKey.findMany({ select: { id: true } }) + * + */ + findMany(args?: Prisma.SelectSubset>): Prisma.PrismaPromise, T, "findMany", GlobalOmitOptions>> + + /** + * Create a LicenseKey. + * @param {LicenseKeyCreateArgs} args - Arguments to create a LicenseKey. + * @example + * // Create one LicenseKey + * const LicenseKey = await prisma.licenseKey.create({ + * data: { + * // ... data to create a LicenseKey + * } + * }) + * + */ + create(args: Prisma.SelectSubset>): Prisma.Prisma__LicenseKeyClient, T, "create", GlobalOmitOptions>, never, ExtArgs, GlobalOmitOptions> + + /** + * Create many LicenseKeys. + * @param {LicenseKeyCreateManyArgs} args - Arguments to create many LicenseKeys. + * @example + * // Create many LicenseKeys + * const licenseKey = await prisma.licenseKey.createMany({ + * data: [ + * // ... provide data here + * ] + * }) + * + */ + createMany(args?: Prisma.SelectSubset>): Prisma.PrismaPromise + + /** + * Create many LicenseKeys and returns the data saved in the database. + * @param {LicenseKeyCreateManyAndReturnArgs} args - Arguments to create many LicenseKeys. + * @example + * // Create many LicenseKeys + * const licenseKey = await prisma.licenseKey.createManyAndReturn({ + * data: [ + * // ... provide data here + * ] + * }) + * + * // Create many LicenseKeys and only return the `id` + * const licenseKeyWithIdOnly = await prisma.licenseKey.createManyAndReturn({ + * select: { id: 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 LicenseKey. + * @param {LicenseKeyDeleteArgs} args - Arguments to delete one LicenseKey. + * @example + * // Delete one LicenseKey + * const LicenseKey = await prisma.licenseKey.delete({ + * where: { + * // ... filter to delete one LicenseKey + * } + * }) + * + */ + delete(args: Prisma.SelectSubset>): Prisma.Prisma__LicenseKeyClient, T, "delete", GlobalOmitOptions>, never, ExtArgs, GlobalOmitOptions> + + /** + * Update one LicenseKey. + * @param {LicenseKeyUpdateArgs} args - Arguments to update one LicenseKey. + * @example + * // Update one LicenseKey + * const licenseKey = await prisma.licenseKey.update({ + * where: { + * // ... provide filter here + * }, + * data: { + * // ... provide data here + * } + * }) + * + */ + update(args: Prisma.SelectSubset>): Prisma.Prisma__LicenseKeyClient, T, "update", GlobalOmitOptions>, never, ExtArgs, GlobalOmitOptions> + + /** + * Delete zero or more LicenseKeys. + * @param {LicenseKeyDeleteManyArgs} args - Arguments to filter LicenseKeys to delete. + * @example + * // Delete a few LicenseKeys + * const { count } = await prisma.licenseKey.deleteMany({ + * where: { + * // ... provide filter here + * } + * }) + * + */ + deleteMany(args?: Prisma.SelectSubset>): Prisma.PrismaPromise + + /** + * Update zero or more LicenseKeys. + * Note, that providing `undefined` is treated as the value not being there. + * Read more here: https://pris.ly/d/null-undefined + * @param {LicenseKeyUpdateManyArgs} args - Arguments to update one or more rows. + * @example + * // Update many LicenseKeys + * const licenseKey = await prisma.licenseKey.updateMany({ + * where: { + * // ... provide filter here + * }, + * data: { + * // ... provide data here + * } + * }) + * + */ + updateMany(args: Prisma.SelectSubset>): Prisma.PrismaPromise + + /** + * Update zero or more LicenseKeys and returns the data updated in the database. + * @param {LicenseKeyUpdateManyAndReturnArgs} args - Arguments to update many LicenseKeys. + * @example + * // Update many LicenseKeys + * const licenseKey = await prisma.licenseKey.updateManyAndReturn({ + * where: { + * // ... provide filter here + * }, + * data: [ + * // ... provide data here + * ] + * }) + * + * // Update zero or more LicenseKeys and only return the `id` + * const licenseKeyWithIdOnly = await prisma.licenseKey.updateManyAndReturn({ + * select: { id: 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 LicenseKey. + * @param {LicenseKeyUpsertArgs} args - Arguments to update or create a LicenseKey. + * @example + * // Update or create a LicenseKey + * const licenseKey = await prisma.licenseKey.upsert({ + * create: { + * // ... data to create a LicenseKey + * }, + * update: { + * // ... in case it already exists, update + * }, + * where: { + * // ... the filter for the LicenseKey we want to update + * } + * }) + */ + upsert(args: Prisma.SelectSubset>): Prisma.Prisma__LicenseKeyClient, T, "upsert", GlobalOmitOptions>, never, ExtArgs, GlobalOmitOptions> + + + /** + * Count the number of LicenseKeys. + * Note, that providing `undefined` is treated as the value not being there. + * Read more here: https://pris.ly/d/null-undefined + * @param {LicenseKeyCountArgs} args - Arguments to filter LicenseKeys to count. + * @example + * // Count the number of LicenseKeys + * const count = await prisma.licenseKey.count({ + * where: { + * // ... the filter for the LicenseKeys 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 LicenseKey. + * Note, that providing `undefined` is treated as the value not being there. + * Read more here: https://pris.ly/d/null-undefined + * @param {LicenseKeyAggregateArgs} 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 LicenseKey. + * Note, that providing `undefined` is treated as the value not being there. + * Read more here: https://pris.ly/d/null-undefined + * @param {LicenseKeyGroupByArgs} 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 LicenseKeyGroupByArgs, + HasSelectOrTake extends Prisma.Or< + Prisma.Extends<'skip', Prisma.Keys>, + Prisma.Extends<'take', Prisma.Keys> + >, + OrderByArg extends Prisma.True extends HasSelectOrTake + ? { orderBy: LicenseKeyGroupByArgs['orderBy'] } + : { orderBy?: LicenseKeyGroupByArgs['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 ? GetLicenseKeyGroupByPayload : Prisma.PrismaPromise +/** + * Fields of the LicenseKey model + */ +readonly fields: LicenseKeyFieldRefs; +} + +/** + * The delegate class that acts as a "Promise-like" for LicenseKey. + * 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__LicenseKeyClient extends Prisma.PrismaPromise { + readonly [Symbol.toStringTag]: "PrismaPromise" + user = {}>(args?: Prisma.Subset>): Prisma.Prisma__UserClient, 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 LicenseKey model + */ +export interface LicenseKeyFieldRefs { + readonly id: Prisma.FieldRef<"LicenseKey", 'String'> + readonly key: Prisma.FieldRef<"LicenseKey", 'String'> + readonly active: Prisma.FieldRef<"LicenseKey", 'Boolean'> + readonly level: Prisma.FieldRef<"LicenseKey", 'String'> + readonly userId: Prisma.FieldRef<"LicenseKey", 'String'> +} + + +// Custom InputTypes +/** + * LicenseKey findUnique + */ +export type LicenseKeyFindUniqueArgs = { + /** + * Select specific fields to fetch from the LicenseKey + */ + select?: Prisma.LicenseKeySelect | null + /** + * Omit specific fields from the LicenseKey + */ + omit?: Prisma.LicenseKeyOmit | null + /** + * Choose, which related nodes to fetch as well + */ + include?: Prisma.LicenseKeyInclude | null + /** + * Filter, which LicenseKey to fetch. + */ + where: Prisma.LicenseKeyWhereUniqueInput +} + +/** + * LicenseKey findUniqueOrThrow + */ +export type LicenseKeyFindUniqueOrThrowArgs = { + /** + * Select specific fields to fetch from the LicenseKey + */ + select?: Prisma.LicenseKeySelect | null + /** + * Omit specific fields from the LicenseKey + */ + omit?: Prisma.LicenseKeyOmit | null + /** + * Choose, which related nodes to fetch as well + */ + include?: Prisma.LicenseKeyInclude | null + /** + * Filter, which LicenseKey to fetch. + */ + where: Prisma.LicenseKeyWhereUniqueInput +} + +/** + * LicenseKey findFirst + */ +export type LicenseKeyFindFirstArgs = { + /** + * Select specific fields to fetch from the LicenseKey + */ + select?: Prisma.LicenseKeySelect | null + /** + * Omit specific fields from the LicenseKey + */ + omit?: Prisma.LicenseKeyOmit | null + /** + * Choose, which related nodes to fetch as well + */ + include?: Prisma.LicenseKeyInclude | null + /** + * Filter, which LicenseKey to fetch. + */ + where?: Prisma.LicenseKeyWhereInput + /** + * {@link https://www.prisma.io/docs/concepts/components/prisma-client/sorting Sorting Docs} + * + * Determine the order of LicenseKeys to fetch. + */ + orderBy?: Prisma.LicenseKeyOrderByWithRelationInput | Prisma.LicenseKeyOrderByWithRelationInput[] + /** + * {@link https://www.prisma.io/docs/concepts/components/prisma-client/pagination#cursor-based-pagination Cursor Docs} + * + * Sets the position for searching for LicenseKeys. + */ + cursor?: Prisma.LicenseKeyWhereUniqueInput + /** + * {@link https://www.prisma.io/docs/concepts/components/prisma-client/pagination Pagination Docs} + * + * Take `±n` LicenseKeys 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` LicenseKeys. + */ + skip?: number + /** + * {@link https://www.prisma.io/docs/concepts/components/prisma-client/distinct Distinct Docs} + * + * Filter by unique combinations of LicenseKeys. + */ + distinct?: Prisma.LicenseKeyScalarFieldEnum | Prisma.LicenseKeyScalarFieldEnum[] +} + +/** + * LicenseKey findFirstOrThrow + */ +export type LicenseKeyFindFirstOrThrowArgs = { + /** + * Select specific fields to fetch from the LicenseKey + */ + select?: Prisma.LicenseKeySelect | null + /** + * Omit specific fields from the LicenseKey + */ + omit?: Prisma.LicenseKeyOmit | null + /** + * Choose, which related nodes to fetch as well + */ + include?: Prisma.LicenseKeyInclude | null + /** + * Filter, which LicenseKey to fetch. + */ + where?: Prisma.LicenseKeyWhereInput + /** + * {@link https://www.prisma.io/docs/concepts/components/prisma-client/sorting Sorting Docs} + * + * Determine the order of LicenseKeys to fetch. + */ + orderBy?: Prisma.LicenseKeyOrderByWithRelationInput | Prisma.LicenseKeyOrderByWithRelationInput[] + /** + * {@link https://www.prisma.io/docs/concepts/components/prisma-client/pagination#cursor-based-pagination Cursor Docs} + * + * Sets the position for searching for LicenseKeys. + */ + cursor?: Prisma.LicenseKeyWhereUniqueInput + /** + * {@link https://www.prisma.io/docs/concepts/components/prisma-client/pagination Pagination Docs} + * + * Take `±n` LicenseKeys 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` LicenseKeys. + */ + skip?: number + /** + * {@link https://www.prisma.io/docs/concepts/components/prisma-client/distinct Distinct Docs} + * + * Filter by unique combinations of LicenseKeys. + */ + distinct?: Prisma.LicenseKeyScalarFieldEnum | Prisma.LicenseKeyScalarFieldEnum[] +} + +/** + * LicenseKey findMany + */ +export type LicenseKeyFindManyArgs = { + /** + * Select specific fields to fetch from the LicenseKey + */ + select?: Prisma.LicenseKeySelect | null + /** + * Omit specific fields from the LicenseKey + */ + omit?: Prisma.LicenseKeyOmit | null + /** + * Choose, which related nodes to fetch as well + */ + include?: Prisma.LicenseKeyInclude | null + /** + * Filter, which LicenseKeys to fetch. + */ + where?: Prisma.LicenseKeyWhereInput + /** + * {@link https://www.prisma.io/docs/concepts/components/prisma-client/sorting Sorting Docs} + * + * Determine the order of LicenseKeys to fetch. + */ + orderBy?: Prisma.LicenseKeyOrderByWithRelationInput | Prisma.LicenseKeyOrderByWithRelationInput[] + /** + * {@link https://www.prisma.io/docs/concepts/components/prisma-client/pagination#cursor-based-pagination Cursor Docs} + * + * Sets the position for listing LicenseKeys. + */ + cursor?: Prisma.LicenseKeyWhereUniqueInput + /** + * {@link https://www.prisma.io/docs/concepts/components/prisma-client/pagination Pagination Docs} + * + * Take `±n` LicenseKeys 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` LicenseKeys. + */ + skip?: number + distinct?: Prisma.LicenseKeyScalarFieldEnum | Prisma.LicenseKeyScalarFieldEnum[] +} + +/** + * LicenseKey create + */ +export type LicenseKeyCreateArgs = { + /** + * Select specific fields to fetch from the LicenseKey + */ + select?: Prisma.LicenseKeySelect | null + /** + * Omit specific fields from the LicenseKey + */ + omit?: Prisma.LicenseKeyOmit | null + /** + * Choose, which related nodes to fetch as well + */ + include?: Prisma.LicenseKeyInclude | null + /** + * The data needed to create a LicenseKey. + */ + data: Prisma.XOR +} + +/** + * LicenseKey createMany + */ +export type LicenseKeyCreateManyArgs = { + /** + * The data used to create many LicenseKeys. + */ + data: Prisma.LicenseKeyCreateManyInput | Prisma.LicenseKeyCreateManyInput[] + skipDuplicates?: boolean +} + +/** + * LicenseKey createManyAndReturn + */ +export type LicenseKeyCreateManyAndReturnArgs = { + /** + * Select specific fields to fetch from the LicenseKey + */ + select?: Prisma.LicenseKeySelectCreateManyAndReturn | null + /** + * Omit specific fields from the LicenseKey + */ + omit?: Prisma.LicenseKeyOmit | null + /** + * The data used to create many LicenseKeys. + */ + data: Prisma.LicenseKeyCreateManyInput | Prisma.LicenseKeyCreateManyInput[] + skipDuplicates?: boolean + /** + * Choose, which related nodes to fetch as well + */ + include?: Prisma.LicenseKeyIncludeCreateManyAndReturn | null +} + +/** + * LicenseKey update + */ +export type LicenseKeyUpdateArgs = { + /** + * Select specific fields to fetch from the LicenseKey + */ + select?: Prisma.LicenseKeySelect | null + /** + * Omit specific fields from the LicenseKey + */ + omit?: Prisma.LicenseKeyOmit | null + /** + * Choose, which related nodes to fetch as well + */ + include?: Prisma.LicenseKeyInclude | null + /** + * The data needed to update a LicenseKey. + */ + data: Prisma.XOR + /** + * Choose, which LicenseKey to update. + */ + where: Prisma.LicenseKeyWhereUniqueInput +} + +/** + * LicenseKey updateMany + */ +export type LicenseKeyUpdateManyArgs = { + /** + * The data used to update LicenseKeys. + */ + data: Prisma.XOR + /** + * Filter which LicenseKeys to update + */ + where?: Prisma.LicenseKeyWhereInput + /** + * Limit how many LicenseKeys to update. + */ + limit?: number +} + +/** + * LicenseKey updateManyAndReturn + */ +export type LicenseKeyUpdateManyAndReturnArgs = { + /** + * Select specific fields to fetch from the LicenseKey + */ + select?: Prisma.LicenseKeySelectUpdateManyAndReturn | null + /** + * Omit specific fields from the LicenseKey + */ + omit?: Prisma.LicenseKeyOmit | null + /** + * The data used to update LicenseKeys. + */ + data: Prisma.XOR + /** + * Filter which LicenseKeys to update + */ + where?: Prisma.LicenseKeyWhereInput + /** + * Limit how many LicenseKeys to update. + */ + limit?: number + /** + * Choose, which related nodes to fetch as well + */ + include?: Prisma.LicenseKeyIncludeUpdateManyAndReturn | null +} + +/** + * LicenseKey upsert + */ +export type LicenseKeyUpsertArgs = { + /** + * Select specific fields to fetch from the LicenseKey + */ + select?: Prisma.LicenseKeySelect | null + /** + * Omit specific fields from the LicenseKey + */ + omit?: Prisma.LicenseKeyOmit | null + /** + * Choose, which related nodes to fetch as well + */ + include?: Prisma.LicenseKeyInclude | null + /** + * The filter to search for the LicenseKey to update in case it exists. + */ + where: Prisma.LicenseKeyWhereUniqueInput + /** + * In case the LicenseKey found by the `where` argument doesn't exist, create a new LicenseKey with this data. + */ + create: Prisma.XOR + /** + * In case the LicenseKey was found with the provided `where` argument, update it with this data. + */ + update: Prisma.XOR +} + +/** + * LicenseKey delete + */ +export type LicenseKeyDeleteArgs = { + /** + * Select specific fields to fetch from the LicenseKey + */ + select?: Prisma.LicenseKeySelect | null + /** + * Omit specific fields from the LicenseKey + */ + omit?: Prisma.LicenseKeyOmit | null + /** + * Choose, which related nodes to fetch as well + */ + include?: Prisma.LicenseKeyInclude | null + /** + * Filter which LicenseKey to delete. + */ + where: Prisma.LicenseKeyWhereUniqueInput +} + +/** + * LicenseKey deleteMany + */ +export type LicenseKeyDeleteManyArgs = { + /** + * Filter which LicenseKeys to delete + */ + where?: Prisma.LicenseKeyWhereInput + /** + * Limit how many LicenseKeys to delete. + */ + limit?: number +} + +/** + * LicenseKey without action + */ +export type LicenseKeyDefaultArgs = { + /** + * Select specific fields to fetch from the LicenseKey + */ + select?: Prisma.LicenseKeySelect | null + /** + * Omit specific fields from the LicenseKey + */ + omit?: Prisma.LicenseKeyOmit | null + /** + * Choose, which related nodes to fetch as well + */ + include?: Prisma.LicenseKeyInclude | null +} diff --git a/src/lib/generated/prisma/models/User.ts b/src/lib/generated/prisma/models/User.ts index 904f8fd..9758677 100644 --- a/src/lib/generated/prisma/models/User.ts +++ b/src/lib/generated/prisma/models/User.ts @@ -244,6 +244,7 @@ export type UserWhereInput = { sessions?: Prisma.SessionListRelationFilter accounts?: Prisma.AccountListRelationFilter profile?: Prisma.XOR | null + licenseKeys?: Prisma.LicenseKeyListRelationFilter } export type UserOrderByWithRelationInput = { @@ -259,6 +260,7 @@ export type UserOrderByWithRelationInput = { sessions?: Prisma.SessionOrderByRelationAggregateInput accounts?: Prisma.AccountOrderByRelationAggregateInput profile?: Prisma.ProfileOrderByWithRelationInput + licenseKeys?: Prisma.LicenseKeyOrderByRelationAggregateInput } export type UserWhereUniqueInput = Prisma.AtLeast<{ @@ -277,6 +279,7 @@ export type UserWhereUniqueInput = Prisma.AtLeast<{ sessions?: Prisma.SessionListRelationFilter accounts?: Prisma.AccountListRelationFilter profile?: Prisma.XOR | null + licenseKeys?: Prisma.LicenseKeyListRelationFilter }, "id" | "email"> export type UserOrderByWithAggregationInput = { @@ -321,6 +324,7 @@ export type UserCreateInput = { sessions?: Prisma.SessionCreateNestedManyWithoutUserInput accounts?: Prisma.AccountCreateNestedManyWithoutUserInput profile?: Prisma.ProfileCreateNestedOneWithoutUserInput + licenseKeys?: Prisma.LicenseKeyCreateNestedManyWithoutUserInput } export type UserUncheckedCreateInput = { @@ -335,6 +339,7 @@ export type UserUncheckedCreateInput = { sessions?: Prisma.SessionUncheckedCreateNestedManyWithoutUserInput accounts?: Prisma.AccountUncheckedCreateNestedManyWithoutUserInput profile?: Prisma.ProfileUncheckedCreateNestedOneWithoutUserInput + licenseKeys?: Prisma.LicenseKeyUncheckedCreateNestedManyWithoutUserInput } export type UserUpdateInput = { @@ -349,6 +354,7 @@ export type UserUpdateInput = { sessions?: Prisma.SessionUpdateManyWithoutUserNestedInput accounts?: Prisma.AccountUpdateManyWithoutUserNestedInput profile?: Prisma.ProfileUpdateOneWithoutUserNestedInput + licenseKeys?: Prisma.LicenseKeyUpdateManyWithoutUserNestedInput } export type UserUncheckedUpdateInput = { @@ -363,6 +369,7 @@ export type UserUncheckedUpdateInput = { sessions?: Prisma.SessionUncheckedUpdateManyWithoutUserNestedInput accounts?: Prisma.AccountUncheckedUpdateManyWithoutUserNestedInput profile?: Prisma.ProfileUncheckedUpdateOneWithoutUserNestedInput + licenseKeys?: Prisma.LicenseKeyUncheckedUpdateManyWithoutUserNestedInput } export type UserCreateManyInput = { @@ -561,6 +568,20 @@ export type UserUncheckedUpdateManyWithoutRoleNestedInput = { deleteMany?: Prisma.UserScalarWhereInput | Prisma.UserScalarWhereInput[] } +export type UserCreateNestedOneWithoutLicenseKeysInput = { + create?: Prisma.XOR + connectOrCreate?: Prisma.UserCreateOrConnectWithoutLicenseKeysInput + connect?: Prisma.UserWhereUniqueInput +} + +export type UserUpdateOneRequiredWithoutLicenseKeysNestedInput = { + create?: Prisma.XOR + connectOrCreate?: Prisma.UserCreateOrConnectWithoutLicenseKeysInput + upsert?: Prisma.UserUpsertWithoutLicenseKeysInput + connect?: Prisma.UserWhereUniqueInput + update?: Prisma.XOR, Prisma.UserUncheckedUpdateWithoutLicenseKeysInput> +} + export type UserCreateWithoutProfileInput = { id: string name: string @@ -572,6 +593,7 @@ export type UserCreateWithoutProfileInput = { role?: Prisma.UserRoleCreateNestedOneWithoutUsersInput sessions?: Prisma.SessionCreateNestedManyWithoutUserInput accounts?: Prisma.AccountCreateNestedManyWithoutUserInput + licenseKeys?: Prisma.LicenseKeyCreateNestedManyWithoutUserInput } export type UserUncheckedCreateWithoutProfileInput = { @@ -585,6 +607,7 @@ export type UserUncheckedCreateWithoutProfileInput = { roleId?: number | null sessions?: Prisma.SessionUncheckedCreateNestedManyWithoutUserInput accounts?: Prisma.AccountUncheckedCreateNestedManyWithoutUserInput + licenseKeys?: Prisma.LicenseKeyUncheckedCreateNestedManyWithoutUserInput } export type UserCreateOrConnectWithoutProfileInput = { @@ -614,6 +637,7 @@ export type UserUpdateWithoutProfileInput = { role?: Prisma.UserRoleUpdateOneWithoutUsersNestedInput sessions?: Prisma.SessionUpdateManyWithoutUserNestedInput accounts?: Prisma.AccountUpdateManyWithoutUserNestedInput + licenseKeys?: Prisma.LicenseKeyUpdateManyWithoutUserNestedInput } export type UserUncheckedUpdateWithoutProfileInput = { @@ -627,6 +651,7 @@ export type UserUncheckedUpdateWithoutProfileInput = { roleId?: Prisma.NullableIntFieldUpdateOperationsInput | number | null sessions?: Prisma.SessionUncheckedUpdateManyWithoutUserNestedInput accounts?: Prisma.AccountUncheckedUpdateManyWithoutUserNestedInput + licenseKeys?: Prisma.LicenseKeyUncheckedUpdateManyWithoutUserNestedInput } export type UserCreateWithoutSessionsInput = { @@ -640,6 +665,7 @@ export type UserCreateWithoutSessionsInput = { role?: Prisma.UserRoleCreateNestedOneWithoutUsersInput accounts?: Prisma.AccountCreateNestedManyWithoutUserInput profile?: Prisma.ProfileCreateNestedOneWithoutUserInput + licenseKeys?: Prisma.LicenseKeyCreateNestedManyWithoutUserInput } export type UserUncheckedCreateWithoutSessionsInput = { @@ -653,6 +679,7 @@ export type UserUncheckedCreateWithoutSessionsInput = { roleId?: number | null accounts?: Prisma.AccountUncheckedCreateNestedManyWithoutUserInput profile?: Prisma.ProfileUncheckedCreateNestedOneWithoutUserInput + licenseKeys?: Prisma.LicenseKeyUncheckedCreateNestedManyWithoutUserInput } export type UserCreateOrConnectWithoutSessionsInput = { @@ -682,6 +709,7 @@ export type UserUpdateWithoutSessionsInput = { role?: Prisma.UserRoleUpdateOneWithoutUsersNestedInput accounts?: Prisma.AccountUpdateManyWithoutUserNestedInput profile?: Prisma.ProfileUpdateOneWithoutUserNestedInput + licenseKeys?: Prisma.LicenseKeyUpdateManyWithoutUserNestedInput } export type UserUncheckedUpdateWithoutSessionsInput = { @@ -695,6 +723,7 @@ export type UserUncheckedUpdateWithoutSessionsInput = { roleId?: Prisma.NullableIntFieldUpdateOperationsInput | number | null accounts?: Prisma.AccountUncheckedUpdateManyWithoutUserNestedInput profile?: Prisma.ProfileUncheckedUpdateOneWithoutUserNestedInput + licenseKeys?: Prisma.LicenseKeyUncheckedUpdateManyWithoutUserNestedInput } export type UserCreateWithoutAccountsInput = { @@ -708,6 +737,7 @@ export type UserCreateWithoutAccountsInput = { role?: Prisma.UserRoleCreateNestedOneWithoutUsersInput sessions?: Prisma.SessionCreateNestedManyWithoutUserInput profile?: Prisma.ProfileCreateNestedOneWithoutUserInput + licenseKeys?: Prisma.LicenseKeyCreateNestedManyWithoutUserInput } export type UserUncheckedCreateWithoutAccountsInput = { @@ -721,6 +751,7 @@ export type UserUncheckedCreateWithoutAccountsInput = { roleId?: number | null sessions?: Prisma.SessionUncheckedCreateNestedManyWithoutUserInput profile?: Prisma.ProfileUncheckedCreateNestedOneWithoutUserInput + licenseKeys?: Prisma.LicenseKeyUncheckedCreateNestedManyWithoutUserInput } export type UserCreateOrConnectWithoutAccountsInput = { @@ -750,6 +781,7 @@ export type UserUpdateWithoutAccountsInput = { role?: Prisma.UserRoleUpdateOneWithoutUsersNestedInput sessions?: Prisma.SessionUpdateManyWithoutUserNestedInput profile?: Prisma.ProfileUpdateOneWithoutUserNestedInput + licenseKeys?: Prisma.LicenseKeyUpdateManyWithoutUserNestedInput } export type UserUncheckedUpdateWithoutAccountsInput = { @@ -763,6 +795,7 @@ export type UserUncheckedUpdateWithoutAccountsInput = { roleId?: Prisma.NullableIntFieldUpdateOperationsInput | number | null sessions?: Prisma.SessionUncheckedUpdateManyWithoutUserNestedInput profile?: Prisma.ProfileUncheckedUpdateOneWithoutUserNestedInput + licenseKeys?: Prisma.LicenseKeyUncheckedUpdateManyWithoutUserNestedInput } export type UserCreateWithoutRoleInput = { @@ -776,6 +809,7 @@ export type UserCreateWithoutRoleInput = { sessions?: Prisma.SessionCreateNestedManyWithoutUserInput accounts?: Prisma.AccountCreateNestedManyWithoutUserInput profile?: Prisma.ProfileCreateNestedOneWithoutUserInput + licenseKeys?: Prisma.LicenseKeyCreateNestedManyWithoutUserInput } export type UserUncheckedCreateWithoutRoleInput = { @@ -789,6 +823,7 @@ export type UserUncheckedCreateWithoutRoleInput = { sessions?: Prisma.SessionUncheckedCreateNestedManyWithoutUserInput accounts?: Prisma.AccountUncheckedCreateNestedManyWithoutUserInput profile?: Prisma.ProfileUncheckedCreateNestedOneWithoutUserInput + licenseKeys?: Prisma.LicenseKeyUncheckedCreateNestedManyWithoutUserInput } export type UserCreateOrConnectWithoutRoleInput = { @@ -831,6 +866,78 @@ export type UserScalarWhereInput = { roleId?: Prisma.IntNullableFilter<"User"> | number | null } +export type UserCreateWithoutLicenseKeysInput = { + 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 +} + +export type UserUncheckedCreateWithoutLicenseKeysInput = { + 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 +} + +export type UserCreateOrConnectWithoutLicenseKeysInput = { + where: Prisma.UserWhereUniqueInput + create: Prisma.XOR +} + +export type UserUpsertWithoutLicenseKeysInput = { + update: Prisma.XOR + create: Prisma.XOR + where?: Prisma.UserWhereInput +} + +export type UserUpdateToOneWithWhereWithoutLicenseKeysInput = { + where?: Prisma.UserWhereInput + data: Prisma.XOR +} + +export type UserUpdateWithoutLicenseKeysInput = { + 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 +} + +export type UserUncheckedUpdateWithoutLicenseKeysInput = { + 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 +} + export type UserCreateManyRoleInput = { id: string name: string @@ -852,6 +959,7 @@ export type UserUpdateWithoutRoleInput = { sessions?: Prisma.SessionUpdateManyWithoutUserNestedInput accounts?: Prisma.AccountUpdateManyWithoutUserNestedInput profile?: Prisma.ProfileUpdateOneWithoutUserNestedInput + licenseKeys?: Prisma.LicenseKeyUpdateManyWithoutUserNestedInput } export type UserUncheckedUpdateWithoutRoleInput = { @@ -865,6 +973,7 @@ export type UserUncheckedUpdateWithoutRoleInput = { sessions?: Prisma.SessionUncheckedUpdateManyWithoutUserNestedInput accounts?: Prisma.AccountUncheckedUpdateManyWithoutUserNestedInput profile?: Prisma.ProfileUncheckedUpdateOneWithoutUserNestedInput + licenseKeys?: Prisma.LicenseKeyUncheckedUpdateManyWithoutUserNestedInput } export type UserUncheckedUpdateManyWithoutRoleInput = { @@ -885,11 +994,13 @@ export type UserUncheckedUpdateManyWithoutRoleInput = { export type UserCountOutputType = { sessions: number accounts: number + licenseKeys: number } export type UserCountOutputTypeSelect = { sessions?: boolean | UserCountOutputTypeCountSessionsArgs accounts?: boolean | UserCountOutputTypeCountAccountsArgs + licenseKeys?: boolean | UserCountOutputTypeCountLicenseKeysArgs } /** @@ -916,6 +1027,13 @@ export type UserCountOutputTypeCountAccountsArgs = { + where?: Prisma.LicenseKeyWhereInput +} + export type UserSelect = runtime.Types.Extensions.GetSelect<{ id?: boolean @@ -930,6 +1048,7 @@ export type UserSelect accounts?: boolean | Prisma.User$accountsArgs profile?: boolean | Prisma.User$profileArgs + licenseKeys?: boolean | Prisma.User$licenseKeysArgs _count?: boolean | Prisma.UserCountOutputTypeDefaultArgs }, ExtArgs["result"]["user"]> @@ -974,6 +1093,7 @@ export type UserInclude accounts?: boolean | Prisma.User$accountsArgs profile?: boolean | Prisma.User$profileArgs + licenseKeys?: boolean | Prisma.User$licenseKeysArgs _count?: boolean | Prisma.UserCountOutputTypeDefaultArgs } export type UserIncludeCreateManyAndReturn = { @@ -990,6 +1110,7 @@ export type $UserPayload[] accounts: Prisma.$AccountPayload[] profile: Prisma.$ProfilePayload | null + licenseKeys: Prisma.$LicenseKeyPayload[] } scalars: runtime.Types.Extensions.GetPayloadResult<{ id: string @@ -1398,6 +1519,7 @@ export interface Prisma__UserClient = {}>(args?: Prisma.Subset>): Prisma.PrismaPromise, T, "findMany", GlobalOmitOptions> | Null> accounts = {}>(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> /** * Attaches callbacks for the resolution and/or rejection of the Promise. * @param onfulfilled The callback to execute when the Promise is resolved. @@ -1916,6 +2038,30 @@ export type User$profileArgs = { + /** + * Select specific fields to fetch from the LicenseKey + */ + select?: Prisma.LicenseKeySelect | null + /** + * Omit specific fields from the LicenseKey + */ + omit?: Prisma.LicenseKeyOmit | null + /** + * Choose, which related nodes to fetch as well + */ + include?: Prisma.LicenseKeyInclude | null + where?: Prisma.LicenseKeyWhereInput + orderBy?: Prisma.LicenseKeyOrderByWithRelationInput | Prisma.LicenseKeyOrderByWithRelationInput[] + cursor?: Prisma.LicenseKeyWhereUniqueInput + take?: number + skip?: number + distinct?: Prisma.LicenseKeyScalarFieldEnum | Prisma.LicenseKeyScalarFieldEnum[] +} + /** * User without action */ diff --git a/src/routes/api/v1/license/+server.ts b/src/routes/api/v1/license/+server.ts new file mode 100644 index 0000000..89053db --- /dev/null +++ b/src/routes/api/v1/license/+server.ts @@ -0,0 +1,44 @@ +import { error } from '@sveltejs/kit'; +import type { RequestHandler } from './$types'; +import { prisma } from '$lib/db'; + +// Get the key and email form the URL +// First, check if the key even exists, throw error if not +// Second, check that the email is attached to a real user, throw error +// Third, check that the key retrieved from the database belongs to the user, throw error +// Return response +export const GET: RequestHandler = async ({ url }) => { + const key = url.searchParams.get('key') ?? ''; + const email = url.searchParams.get('email') ?? ''; + if (key === '') { + throw error(400, 'license key required'); + } + + const storedKey = await prisma.licenseKey.findFirst({ + where: { + key: key + } + }); + + if (!storedKey) { + throw error(400, 'license key not found'); + } + + const userAccount = await prisma.user.findUniqueOrThrow({ where: { email: email } }); + + if (!userAccount) { + throw error(400, 'user does not exist'); + } + + if (storedKey.userId != userAccount.id) { + throw error(400, 'key does not belong to specified user'); + } + + return new Response( + JSON.stringify({ + key: storedKey.key, + active: storedKey.active, + level: storedKey.level + }) + ); +};