diff --git a/prisma/migrations/20260112160005_init_better_auth/migration.sql b/prisma/migrations/20260112160005_init_better_auth/migration.sql deleted file mode 100644 index c0feb5c..0000000 --- a/prisma/migrations/20260112160005_init_better_auth/migration.sql +++ /dev/null @@ -1,78 +0,0 @@ --- CreateTable -CREATE TABLE "user" ( - "id" TEXT NOT NULL, - "name" TEXT NOT NULL, - "email" TEXT NOT NULL, - "emailVerified" BOOLEAN NOT NULL DEFAULT false, - "image" TEXT, - "createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP, - "updatedAt" TIMESTAMP(3) NOT NULL, - - CONSTRAINT "user_pkey" PRIMARY KEY ("id") -); - --- CreateTable -CREATE TABLE "session" ( - "id" TEXT NOT NULL, - "expiresAt" TIMESTAMP(3) NOT NULL, - "token" TEXT NOT NULL, - "createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP, - "updatedAt" TIMESTAMP(3) NOT NULL, - "ipAddress" TEXT, - "userAgent" TEXT, - "userId" TEXT NOT NULL, - - CONSTRAINT "session_pkey" PRIMARY KEY ("id") -); - --- CreateTable -CREATE TABLE "account" ( - "id" TEXT NOT NULL, - "accountId" TEXT NOT NULL, - "providerId" TEXT NOT NULL, - "userId" TEXT NOT NULL, - "accessToken" TEXT, - "refreshToken" TEXT, - "idToken" TEXT, - "accessTokenExpiresAt" TIMESTAMP(3), - "refreshTokenExpiresAt" TIMESTAMP(3), - "scope" TEXT, - "password" TEXT, - "createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP, - "updatedAt" TIMESTAMP(3) NOT NULL, - - CONSTRAINT "account_pkey" PRIMARY KEY ("id") -); - --- CreateTable -CREATE TABLE "verification" ( - "id" TEXT NOT NULL, - "identifier" TEXT NOT NULL, - "value" TEXT NOT NULL, - "expiresAt" TIMESTAMP(3) NOT NULL, - "createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP, - "updatedAt" TIMESTAMP(3) NOT NULL, - - CONSTRAINT "verification_pkey" PRIMARY KEY ("id") -); - --- CreateIndex -CREATE UNIQUE INDEX "user_email_key" ON "user"("email"); - --- CreateIndex -CREATE INDEX "session_userId_idx" ON "session"("userId"); - --- CreateIndex -CREATE UNIQUE INDEX "session_token_key" ON "session"("token"); - --- CreateIndex -CREATE INDEX "account_userId_idx" ON "account"("userId"); - --- CreateIndex -CREATE INDEX "verification_identifier_idx" ON "verification"("identifier"); - --- AddForeignKey -ALTER TABLE "session" ADD CONSTRAINT "session_userId_fkey" FOREIGN KEY ("userId") REFERENCES "user"("id") ON DELETE CASCADE ON UPDATE CASCADE; - --- AddForeignKey -ALTER TABLE "account" ADD CONSTRAINT "account_userId_fkey" FOREIGN KEY ("userId") REFERENCES "user"("id") ON DELETE CASCADE ON UPDATE CASCADE; diff --git a/prisma/migrations/20260113135007_add_affirmations/migration.sql b/prisma/migrations/20260113135007_add_affirmations/migration.sql deleted file mode 100644 index bc4ffab..0000000 --- a/prisma/migrations/20260113135007_add_affirmations/migration.sql +++ /dev/null @@ -1,49 +0,0 @@ --- CreateTable -CREATE TABLE "Affirmation" ( - "id" TEXT NOT NULL, - "name" TEXT NOT NULL, - "content" TEXT NOT NULL, - "solfeggioFrequencyId" INTEGER NOT NULL, - "categoryId" INTEGER NOT NULL, - "price" DOUBLE PRECISION NOT NULL DEFAULT 0.99, - - CONSTRAINT "Affirmation_pkey" PRIMARY KEY ("id") -); - --- CreateTable -CREATE TABLE "SolfeggioFrequency" ( - "id" SERIAL NOT NULL, - "name" TEXT NOT NULL, - "value" DOUBLE PRECISION NOT NULL, - - CONSTRAINT "SolfeggioFrequency_pkey" PRIMARY KEY ("id") -); - --- CreateTable -CREATE TABLE "AffirmationCategory" ( - "id" SERIAL NOT NULL, - "name" TEXT NOT NULL, - - CONSTRAINT "AffirmationCategory_pkey" PRIMARY KEY ("id") -); - --- CreateIndex -CREATE UNIQUE INDEX "Affirmation_name_key" ON "Affirmation"("name"); - --- CreateIndex -CREATE UNIQUE INDEX "Affirmation_content_key" ON "Affirmation"("content"); - --- CreateIndex -CREATE UNIQUE INDEX "SolfeggioFrequency_name_key" ON "SolfeggioFrequency"("name"); - --- CreateIndex -CREATE UNIQUE INDEX "SolfeggioFrequency_value_key" ON "SolfeggioFrequency"("value"); - --- CreateIndex -CREATE UNIQUE INDEX "AffirmationCategory_name_key" ON "AffirmationCategory"("name"); - --- AddForeignKey -ALTER TABLE "Affirmation" ADD CONSTRAINT "Affirmation_solfeggioFrequencyId_fkey" FOREIGN KEY ("solfeggioFrequencyId") REFERENCES "SolfeggioFrequency"("id") ON DELETE RESTRICT ON UPDATE CASCADE; - --- AddForeignKey -ALTER TABLE "Affirmation" ADD CONSTRAINT "Affirmation_categoryId_fkey" FOREIGN KEY ("categoryId") REFERENCES "AffirmationCategory"("id") ON DELETE RESTRICT ON UPDATE CASCADE; diff --git a/prisma/migrations/20260113142808_add_user_roles/migration.sql b/prisma/migrations/20260113142808_add_user_roles/migration.sql deleted file mode 100644 index 77fd8e1..0000000 --- a/prisma/migrations/20260113142808_add_user_roles/migration.sql +++ /dev/null @@ -1,13 +0,0 @@ --- AlterTable -ALTER TABLE "user" ADD COLUMN "roleId" INTEGER; - --- CreateTable -CREATE TABLE "UserRole" ( - "id" SERIAL NOT NULL, - "name" TEXT NOT NULL, - - CONSTRAINT "UserRole_pkey" PRIMARY KEY ("id") -); - --- AddForeignKey -ALTER TABLE "user" ADD CONSTRAINT "user_roleId_fkey" FOREIGN KEY ("roleId") REFERENCES "UserRole"("id") ON DELETE SET NULL ON UPDATE CASCADE; diff --git a/prisma/migrations/20260203142023_init_db/migration.sql b/prisma/migrations/20260203142023_init_db/migration.sql new file mode 100644 index 0000000..2f5016c --- /dev/null +++ b/prisma/migrations/20260203142023_init_db/migration.sql @@ -0,0 +1,173 @@ +-- CreateTable +CREATE TABLE "user" ( + "id" TEXT NOT NULL, + "name" TEXT NOT NULL, + "email" TEXT NOT NULL, + "emailVerified" BOOLEAN NOT NULL DEFAULT false, + "image" TEXT, + "createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP, + "updatedAt" TIMESTAMP(3) NOT NULL, + "roleId" INTEGER, + + CONSTRAINT "user_pkey" PRIMARY KEY ("id") +); + +-- CreateTable +CREATE TABLE "Profile" ( + "id" TEXT NOT NULL, + "userId" TEXT NOT NULL, + "firstName" TEXT NOT NULL, + "lastName" TEXT NOT NULL, + "phoneNumber" TEXT NOT NULL, + + CONSTRAINT "Profile_pkey" PRIMARY KEY ("id") +); + +-- CreateTable +CREATE TABLE "Address" ( + "id" TEXT NOT NULL, + "profileId" TEXT NOT NULL, + "street" TEXT NOT NULL, + "city" TEXT NOT NULL, + "state" TEXT NOT NULL, + "postalCode" TEXT NOT NULL, + "country" TEXT NOT NULL, + + CONSTRAINT "Address_pkey" PRIMARY KEY ("id") +); + +-- CreateTable +CREATE TABLE "session" ( + "id" TEXT NOT NULL, + "expiresAt" TIMESTAMP(3) NOT NULL, + "token" TEXT NOT NULL, + "createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP, + "updatedAt" TIMESTAMP(3) NOT NULL, + "ipAddress" TEXT, + "userAgent" TEXT, + "userId" TEXT NOT NULL, + + CONSTRAINT "session_pkey" PRIMARY KEY ("id") +); + +-- CreateTable +CREATE TABLE "account" ( + "id" TEXT NOT NULL, + "accountId" TEXT NOT NULL, + "providerId" TEXT NOT NULL, + "userId" TEXT NOT NULL, + "accessToken" TEXT, + "refreshToken" TEXT, + "idToken" TEXT, + "accessTokenExpiresAt" TIMESTAMP(3), + "refreshTokenExpiresAt" TIMESTAMP(3), + "scope" TEXT, + "password" TEXT, + "createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP, + "updatedAt" TIMESTAMP(3) NOT NULL, + + CONSTRAINT "account_pkey" PRIMARY KEY ("id") +); + +-- CreateTable +CREATE TABLE "UserRole" ( + "id" SERIAL NOT NULL, + "name" TEXT NOT NULL, + + CONSTRAINT "UserRole_pkey" PRIMARY KEY ("id") +); + +-- CreateTable +CREATE TABLE "verification" ( + "id" TEXT NOT NULL, + "identifier" TEXT NOT NULL, + "value" TEXT NOT NULL, + "expiresAt" TIMESTAMP(3) NOT NULL, + "createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP, + "updatedAt" TIMESTAMP(3) NOT NULL, + + CONSTRAINT "verification_pkey" PRIMARY KEY ("id") +); + +-- CreateTable +CREATE TABLE "Affirmation" ( + "id" TEXT NOT NULL, + "name" TEXT NOT NULL, + "content" TEXT NOT NULL, + "solfeggioFrequencyId" INTEGER NOT NULL, + "categoryId" INTEGER NOT NULL, + "price" DOUBLE PRECISION NOT NULL DEFAULT 0.99, + + CONSTRAINT "Affirmation_pkey" PRIMARY KEY ("id") +); + +-- CreateTable +CREATE TABLE "SolfeggioFrequency" ( + "id" SERIAL NOT NULL, + "name" TEXT NOT NULL, + "value" DOUBLE PRECISION NOT NULL, + + CONSTRAINT "SolfeggioFrequency_pkey" PRIMARY KEY ("id") +); + +-- CreateTable +CREATE TABLE "AffirmationCategory" ( + "id" SERIAL NOT NULL, + "name" TEXT NOT NULL, + + CONSTRAINT "AffirmationCategory_pkey" PRIMARY KEY ("id") +); + +-- CreateIndex +CREATE UNIQUE INDEX "user_email_key" ON "user"("email"); + +-- CreateIndex +CREATE UNIQUE INDEX "Profile_userId_key" ON "Profile"("userId"); + +-- CreateIndex +CREATE INDEX "session_userId_idx" ON "session"("userId"); + +-- CreateIndex +CREATE UNIQUE INDEX "session_token_key" ON "session"("token"); + +-- CreateIndex +CREATE INDEX "account_userId_idx" ON "account"("userId"); + +-- CreateIndex +CREATE INDEX "verification_identifier_idx" ON "verification"("identifier"); + +-- CreateIndex +CREATE UNIQUE INDEX "Affirmation_name_key" ON "Affirmation"("name"); + +-- CreateIndex +CREATE UNIQUE INDEX "Affirmation_content_key" ON "Affirmation"("content"); + +-- CreateIndex +CREATE UNIQUE INDEX "SolfeggioFrequency_name_key" ON "SolfeggioFrequency"("name"); + +-- CreateIndex +CREATE UNIQUE INDEX "SolfeggioFrequency_value_key" ON "SolfeggioFrequency"("value"); + +-- CreateIndex +CREATE UNIQUE INDEX "AffirmationCategory_name_key" ON "AffirmationCategory"("name"); + +-- AddForeignKey +ALTER TABLE "user" ADD CONSTRAINT "user_roleId_fkey" FOREIGN KEY ("roleId") REFERENCES "UserRole"("id") ON DELETE SET NULL ON UPDATE CASCADE; + +-- AddForeignKey +ALTER TABLE "Profile" ADD CONSTRAINT "Profile_userId_fkey" FOREIGN KEY ("userId") REFERENCES "user"("id") ON DELETE CASCADE ON UPDATE CASCADE; + +-- AddForeignKey +ALTER TABLE "Address" ADD CONSTRAINT "Address_profileId_fkey" FOREIGN KEY ("profileId") REFERENCES "Profile"("id") ON DELETE CASCADE ON UPDATE CASCADE; + +-- AddForeignKey +ALTER TABLE "session" ADD CONSTRAINT "session_userId_fkey" FOREIGN KEY ("userId") REFERENCES "user"("id") ON DELETE CASCADE ON UPDATE CASCADE; + +-- AddForeignKey +ALTER TABLE "account" ADD CONSTRAINT "account_userId_fkey" FOREIGN KEY ("userId") REFERENCES "user"("id") ON DELETE CASCADE ON UPDATE CASCADE; + +-- AddForeignKey +ALTER TABLE "Affirmation" ADD CONSTRAINT "Affirmation_solfeggioFrequencyId_fkey" FOREIGN KEY ("solfeggioFrequencyId") REFERENCES "SolfeggioFrequency"("id") ON DELETE RESTRICT ON UPDATE CASCADE; + +-- AddForeignKey +ALTER TABLE "Affirmation" ADD CONSTRAINT "Affirmation_categoryId_fkey" FOREIGN KEY ("categoryId") REFERENCES "AffirmationCategory"("id") ON DELETE RESTRICT ON UPDATE CASCADE; diff --git a/prisma/schema.prisma b/prisma/schema.prisma index 2511b31..8c14f4a 100644 --- a/prisma/schema.prisma +++ b/prisma/schema.prisma @@ -31,6 +31,8 @@ model User { @@map("user") } +// I chose to create a Profile table here because honestly, I didn't want to waste +// a bunch of time trying to figure out how to customize the default Better-Auth model. model Profile { id String @id @default(uuid()) userId String @unique diff --git a/src/lib/generated/prisma/browser.ts b/src/lib/generated/prisma/browser.ts index 785bb9d..b9e6df9 100644 --- a/src/lib/generated/prisma/browser.ts +++ b/src/lib/generated/prisma/browser.ts @@ -22,6 +22,16 @@ export * from './enums.ts'; * */ export type User = Prisma.UserModel +/** + * Model Profile + * + */ +export type Profile = Prisma.ProfileModel +/** + * Model Address + * + */ +export type Address = Prisma.AddressModel /** * Model Session * diff --git a/src/lib/generated/prisma/client.ts b/src/lib/generated/prisma/client.ts index 298b717..82ae90e 100644 --- a/src/lib/generated/prisma/client.ts +++ b/src/lib/generated/prisma/client.ts @@ -44,6 +44,16 @@ export { Prisma } * */ export type User = Prisma.UserModel +/** + * Model Profile + * + */ +export type Profile = Prisma.ProfileModel +/** + * Model Address + * + */ +export type Address = Prisma.AddressModel /** * Model Session * diff --git a/src/lib/generated/prisma/internal/class.ts b/src/lib/generated/prisma/internal/class.ts index f58f805..31783ad 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\n @@unique([email])\n @@map(\"user\")\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\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", "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\"}],\"dbName\":\"user\"},\"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\"}],\"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\":{}}") async function decodeBase64AsWasm(wasmBase64: string): Promise { const { Buffer } = await import('node:buffer') @@ -184,6 +184,26 @@ export interface PrismaClient< */ get user(): Prisma.UserDelegate; + /** + * `prisma.profile`: Exposes CRUD operations for the **Profile** model. + * Example usage: + * ```ts + * // Fetch zero or more Profiles + * const profiles = await prisma.profile.findMany() + * ``` + */ + get profile(): Prisma.ProfileDelegate; + + /** + * `prisma.address`: Exposes CRUD operations for the **Address** model. + * Example usage: + * ```ts + * // Fetch zero or more Addresses + * const addresses = await prisma.address.findMany() + * ``` + */ + get address(): Prisma.AddressDelegate; + /** * `prisma.session`: Exposes CRUD operations for the **Session** model. * Example usage: diff --git a/src/lib/generated/prisma/internal/prismaNamespace.ts b/src/lib/generated/prisma/internal/prismaNamespace.ts index 13f0735..bb25266 100644 --- a/src/lib/generated/prisma/internal/prismaNamespace.ts +++ b/src/lib/generated/prisma/internal/prismaNamespace.ts @@ -385,6 +385,8 @@ type FieldRefInputType = Model extends never ? never : FieldRe export const ModelName = { User: 'User', + Profile: 'Profile', + Address: 'Address', Session: 'Session', Account: 'Account', UserRole: 'UserRole', @@ -407,7 +409,7 @@ export type TypeMap + fields: Prisma.ProfileFieldRefs + operations: { + findUnique: { + args: Prisma.ProfileFindUniqueArgs + result: runtime.Types.Utils.PayloadToResult | null + } + findUniqueOrThrow: { + args: Prisma.ProfileFindUniqueOrThrowArgs + result: runtime.Types.Utils.PayloadToResult + } + findFirst: { + args: Prisma.ProfileFindFirstArgs + result: runtime.Types.Utils.PayloadToResult | null + } + findFirstOrThrow: { + args: Prisma.ProfileFindFirstOrThrowArgs + result: runtime.Types.Utils.PayloadToResult + } + findMany: { + args: Prisma.ProfileFindManyArgs + result: runtime.Types.Utils.PayloadToResult[] + } + create: { + args: Prisma.ProfileCreateArgs + result: runtime.Types.Utils.PayloadToResult + } + createMany: { + args: Prisma.ProfileCreateManyArgs + result: BatchPayload + } + createManyAndReturn: { + args: Prisma.ProfileCreateManyAndReturnArgs + result: runtime.Types.Utils.PayloadToResult[] + } + delete: { + args: Prisma.ProfileDeleteArgs + result: runtime.Types.Utils.PayloadToResult + } + update: { + args: Prisma.ProfileUpdateArgs + result: runtime.Types.Utils.PayloadToResult + } + deleteMany: { + args: Prisma.ProfileDeleteManyArgs + result: BatchPayload + } + updateMany: { + args: Prisma.ProfileUpdateManyArgs + result: BatchPayload + } + updateManyAndReturn: { + args: Prisma.ProfileUpdateManyAndReturnArgs + result: runtime.Types.Utils.PayloadToResult[] + } + upsert: { + args: Prisma.ProfileUpsertArgs + result: runtime.Types.Utils.PayloadToResult + } + aggregate: { + args: Prisma.ProfileAggregateArgs + result: runtime.Types.Utils.Optional + } + groupBy: { + args: Prisma.ProfileGroupByArgs + result: runtime.Types.Utils.Optional[] + } + count: { + args: Prisma.ProfileCountArgs + result: runtime.Types.Utils.Optional | number + } + } + } + Address: { + payload: Prisma.$AddressPayload + fields: Prisma.AddressFieldRefs + operations: { + findUnique: { + args: Prisma.AddressFindUniqueArgs + result: runtime.Types.Utils.PayloadToResult | null + } + findUniqueOrThrow: { + args: Prisma.AddressFindUniqueOrThrowArgs + result: runtime.Types.Utils.PayloadToResult + } + findFirst: { + args: Prisma.AddressFindFirstArgs + result: runtime.Types.Utils.PayloadToResult | null + } + findFirstOrThrow: { + args: Prisma.AddressFindFirstOrThrowArgs + result: runtime.Types.Utils.PayloadToResult + } + findMany: { + args: Prisma.AddressFindManyArgs + result: runtime.Types.Utils.PayloadToResult[] + } + create: { + args: Prisma.AddressCreateArgs + result: runtime.Types.Utils.PayloadToResult + } + createMany: { + args: Prisma.AddressCreateManyArgs + result: BatchPayload + } + createManyAndReturn: { + args: Prisma.AddressCreateManyAndReturnArgs + result: runtime.Types.Utils.PayloadToResult[] + } + delete: { + args: Prisma.AddressDeleteArgs + result: runtime.Types.Utils.PayloadToResult + } + update: { + args: Prisma.AddressUpdateArgs + result: runtime.Types.Utils.PayloadToResult + } + deleteMany: { + args: Prisma.AddressDeleteManyArgs + result: BatchPayload + } + updateMany: { + args: Prisma.AddressUpdateManyArgs + result: BatchPayload + } + updateManyAndReturn: { + args: Prisma.AddressUpdateManyAndReturnArgs + result: runtime.Types.Utils.PayloadToResult[] + } + upsert: { + args: Prisma.AddressUpsertArgs + result: runtime.Types.Utils.PayloadToResult + } + aggregate: { + args: Prisma.AddressAggregateArgs + result: runtime.Types.Utils.Optional + } + groupBy: { + args: Prisma.AddressGroupByArgs + result: runtime.Types.Utils.Optional[] + } + count: { + args: Prisma.AddressCountArgs + result: runtime.Types.Utils.Optional | number + } + } + } Session: { payload: Prisma.$SessionPayload fields: Prisma.SessionFieldRefs @@ -1056,6 +1206,30 @@ export const UserScalarFieldEnum = { export type UserScalarFieldEnum = (typeof UserScalarFieldEnum)[keyof typeof UserScalarFieldEnum] +export const ProfileScalarFieldEnum = { + id: 'id', + userId: 'userId', + firstName: 'firstName', + lastName: 'lastName', + phoneNumber: 'phoneNumber' +} as const + +export type ProfileScalarFieldEnum = (typeof ProfileScalarFieldEnum)[keyof typeof ProfileScalarFieldEnum] + + +export const AddressScalarFieldEnum = { + id: 'id', + profileId: 'profileId', + street: 'street', + city: 'city', + state: 'state', + postalCode: 'postalCode', + country: 'country' +} as const + +export type AddressScalarFieldEnum = (typeof AddressScalarFieldEnum)[keyof typeof AddressScalarFieldEnum] + + export const SessionScalarFieldEnum = { id: 'id', expiresAt: 'expiresAt', @@ -1326,6 +1500,8 @@ export type PrismaClientOptions = ({ } export type GlobalOmitConfig = { user?: Prisma.UserOmit + profile?: Prisma.ProfileOmit + address?: Prisma.AddressOmit session?: Prisma.SessionOmit account?: Prisma.AccountOmit userRole?: Prisma.UserRoleOmit diff --git a/src/lib/generated/prisma/internal/prismaNamespaceBrowser.ts b/src/lib/generated/prisma/internal/prismaNamespaceBrowser.ts index 95085f5..a5dd52e 100644 --- a/src/lib/generated/prisma/internal/prismaNamespaceBrowser.ts +++ b/src/lib/generated/prisma/internal/prismaNamespaceBrowser.ts @@ -52,6 +52,8 @@ export const AnyNull = runtime.AnyNull export const ModelName = { User: 'User', + Profile: 'Profile', + Address: 'Address', Session: 'Session', Account: 'Account', UserRole: 'UserRole', @@ -91,6 +93,30 @@ export const UserScalarFieldEnum = { export type UserScalarFieldEnum = (typeof UserScalarFieldEnum)[keyof typeof UserScalarFieldEnum] +export const ProfileScalarFieldEnum = { + id: 'id', + userId: 'userId', + firstName: 'firstName', + lastName: 'lastName', + phoneNumber: 'phoneNumber' +} as const + +export type ProfileScalarFieldEnum = (typeof ProfileScalarFieldEnum)[keyof typeof ProfileScalarFieldEnum] + + +export const AddressScalarFieldEnum = { + id: 'id', + profileId: 'profileId', + street: 'street', + city: 'city', + state: 'state', + postalCode: 'postalCode', + country: 'country' +} as const + +export type AddressScalarFieldEnum = (typeof AddressScalarFieldEnum)[keyof typeof AddressScalarFieldEnum] + + export const SessionScalarFieldEnum = { id: 'id', expiresAt: 'expiresAt', diff --git a/src/lib/generated/prisma/models.ts b/src/lib/generated/prisma/models.ts index 7bcd14b..06b33ff 100644 --- a/src/lib/generated/prisma/models.ts +++ b/src/lib/generated/prisma/models.ts @@ -9,6 +9,8 @@ * 🟢 You can import this file directly. */ export type * from './models/User.ts' +export type * from './models/Profile.ts' +export type * from './models/Address.ts' export type * from './models/Session.ts' export type * from './models/Account.ts' export type * from './models/UserRole.ts' diff --git a/src/lib/generated/prisma/models/Address.ts b/src/lib/generated/prisma/models/Address.ts new file mode 100644 index 0000000..ad8bc47 --- /dev/null +++ b/src/lib/generated/prisma/models/Address.ts @@ -0,0 +1,1410 @@ + +/* !!! This is code generated by Prisma. Do not edit directly. !!! */ +/* eslint-disable */ +// biome-ignore-all lint: generated file +// @ts-nocheck +/* + * This file exports the `Address` 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 Address + * + */ +export type AddressModel = runtime.Types.Result.DefaultSelection + +export type AggregateAddress = { + _count: AddressCountAggregateOutputType | null + _min: AddressMinAggregateOutputType | null + _max: AddressMaxAggregateOutputType | null +} + +export type AddressMinAggregateOutputType = { + id: string | null + profileId: string | null + street: string | null + city: string | null + state: string | null + postalCode: string | null + country: string | null +} + +export type AddressMaxAggregateOutputType = { + id: string | null + profileId: string | null + street: string | null + city: string | null + state: string | null + postalCode: string | null + country: string | null +} + +export type AddressCountAggregateOutputType = { + id: number + profileId: number + street: number + city: number + state: number + postalCode: number + country: number + _all: number +} + + +export type AddressMinAggregateInputType = { + id?: true + profileId?: true + street?: true + city?: true + state?: true + postalCode?: true + country?: true +} + +export type AddressMaxAggregateInputType = { + id?: true + profileId?: true + street?: true + city?: true + state?: true + postalCode?: true + country?: true +} + +export type AddressCountAggregateInputType = { + id?: true + profileId?: true + street?: true + city?: true + state?: true + postalCode?: true + country?: true + _all?: true +} + +export type AddressAggregateArgs = { + /** + * Filter which Address to aggregate. + */ + where?: Prisma.AddressWhereInput + /** + * {@link https://www.prisma.io/docs/concepts/components/prisma-client/sorting Sorting Docs} + * + * Determine the order of Addresses to fetch. + */ + orderBy?: Prisma.AddressOrderByWithRelationInput | Prisma.AddressOrderByWithRelationInput[] + /** + * {@link https://www.prisma.io/docs/concepts/components/prisma-client/pagination#cursor-based-pagination Cursor Docs} + * + * Sets the start position + */ + cursor?: Prisma.AddressWhereUniqueInput + /** + * {@link https://www.prisma.io/docs/concepts/components/prisma-client/pagination Pagination Docs} + * + * Take `±n` Addresses 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` Addresses. + */ + skip?: number + /** + * {@link https://www.prisma.io/docs/concepts/components/prisma-client/aggregations Aggregation Docs} + * + * Count returned Addresses + **/ + _count?: true | AddressCountAggregateInputType + /** + * {@link https://www.prisma.io/docs/concepts/components/prisma-client/aggregations Aggregation Docs} + * + * Select which fields to find the minimum value + **/ + _min?: AddressMinAggregateInputType + /** + * {@link https://www.prisma.io/docs/concepts/components/prisma-client/aggregations Aggregation Docs} + * + * Select which fields to find the maximum value + **/ + _max?: AddressMaxAggregateInputType +} + +export type GetAddressAggregateType = { + [P in keyof T & keyof AggregateAddress]: P extends '_count' | 'count' + ? T[P] extends true + ? number + : Prisma.GetScalarType + : Prisma.GetScalarType +} + + + + +export type AddressGroupByArgs = { + where?: Prisma.AddressWhereInput + orderBy?: Prisma.AddressOrderByWithAggregationInput | Prisma.AddressOrderByWithAggregationInput[] + by: Prisma.AddressScalarFieldEnum[] | Prisma.AddressScalarFieldEnum + having?: Prisma.AddressScalarWhereWithAggregatesInput + take?: number + skip?: number + _count?: AddressCountAggregateInputType | true + _min?: AddressMinAggregateInputType + _max?: AddressMaxAggregateInputType +} + +export type AddressGroupByOutputType = { + id: string + profileId: string + street: string + city: string + state: string + postalCode: string + country: string + _count: AddressCountAggregateOutputType | null + _min: AddressMinAggregateOutputType | null + _max: AddressMaxAggregateOutputType | null +} + +type GetAddressGroupByPayload = Prisma.PrismaPromise< + Array< + Prisma.PickEnumerable & + { + [P in ((keyof T) & (keyof AddressGroupByOutputType))]: P extends '_count' + ? T[P] extends boolean + ? number + : Prisma.GetScalarType + : Prisma.GetScalarType + } + > + > + + + +export type AddressWhereInput = { + AND?: Prisma.AddressWhereInput | Prisma.AddressWhereInput[] + OR?: Prisma.AddressWhereInput[] + NOT?: Prisma.AddressWhereInput | Prisma.AddressWhereInput[] + id?: Prisma.StringFilter<"Address"> | string + profileId?: Prisma.StringFilter<"Address"> | string + street?: Prisma.StringFilter<"Address"> | string + city?: Prisma.StringFilter<"Address"> | string + state?: Prisma.StringFilter<"Address"> | string + postalCode?: Prisma.StringFilter<"Address"> | string + country?: Prisma.StringFilter<"Address"> | string + profile?: Prisma.XOR +} + +export type AddressOrderByWithRelationInput = { + id?: Prisma.SortOrder + profileId?: Prisma.SortOrder + street?: Prisma.SortOrder + city?: Prisma.SortOrder + state?: Prisma.SortOrder + postalCode?: Prisma.SortOrder + country?: Prisma.SortOrder + profile?: Prisma.ProfileOrderByWithRelationInput +} + +export type AddressWhereUniqueInput = Prisma.AtLeast<{ + id?: string + AND?: Prisma.AddressWhereInput | Prisma.AddressWhereInput[] + OR?: Prisma.AddressWhereInput[] + NOT?: Prisma.AddressWhereInput | Prisma.AddressWhereInput[] + profileId?: Prisma.StringFilter<"Address"> | string + street?: Prisma.StringFilter<"Address"> | string + city?: Prisma.StringFilter<"Address"> | string + state?: Prisma.StringFilter<"Address"> | string + postalCode?: Prisma.StringFilter<"Address"> | string + country?: Prisma.StringFilter<"Address"> | string + profile?: Prisma.XOR +}, "id"> + +export type AddressOrderByWithAggregationInput = { + id?: Prisma.SortOrder + profileId?: Prisma.SortOrder + street?: Prisma.SortOrder + city?: Prisma.SortOrder + state?: Prisma.SortOrder + postalCode?: Prisma.SortOrder + country?: Prisma.SortOrder + _count?: Prisma.AddressCountOrderByAggregateInput + _max?: Prisma.AddressMaxOrderByAggregateInput + _min?: Prisma.AddressMinOrderByAggregateInput +} + +export type AddressScalarWhereWithAggregatesInput = { + AND?: Prisma.AddressScalarWhereWithAggregatesInput | Prisma.AddressScalarWhereWithAggregatesInput[] + OR?: Prisma.AddressScalarWhereWithAggregatesInput[] + NOT?: Prisma.AddressScalarWhereWithAggregatesInput | Prisma.AddressScalarWhereWithAggregatesInput[] + id?: Prisma.StringWithAggregatesFilter<"Address"> | string + profileId?: Prisma.StringWithAggregatesFilter<"Address"> | string + street?: Prisma.StringWithAggregatesFilter<"Address"> | string + city?: Prisma.StringWithAggregatesFilter<"Address"> | string + state?: Prisma.StringWithAggregatesFilter<"Address"> | string + postalCode?: Prisma.StringWithAggregatesFilter<"Address"> | string + country?: Prisma.StringWithAggregatesFilter<"Address"> | string +} + +export type AddressCreateInput = { + id?: string + street: string + city: string + state: string + postalCode: string + country: string + profile: Prisma.ProfileCreateNestedOneWithoutAddressesInput +} + +export type AddressUncheckedCreateInput = { + id?: string + profileId: string + street: string + city: string + state: string + postalCode: string + country: string +} + +export type AddressUpdateInput = { + id?: Prisma.StringFieldUpdateOperationsInput | string + street?: Prisma.StringFieldUpdateOperationsInput | string + city?: Prisma.StringFieldUpdateOperationsInput | string + state?: Prisma.StringFieldUpdateOperationsInput | string + postalCode?: Prisma.StringFieldUpdateOperationsInput | string + country?: Prisma.StringFieldUpdateOperationsInput | string + profile?: Prisma.ProfileUpdateOneRequiredWithoutAddressesNestedInput +} + +export type AddressUncheckedUpdateInput = { + id?: Prisma.StringFieldUpdateOperationsInput | string + profileId?: Prisma.StringFieldUpdateOperationsInput | string + street?: Prisma.StringFieldUpdateOperationsInput | string + city?: Prisma.StringFieldUpdateOperationsInput | string + state?: Prisma.StringFieldUpdateOperationsInput | string + postalCode?: Prisma.StringFieldUpdateOperationsInput | string + country?: Prisma.StringFieldUpdateOperationsInput | string +} + +export type AddressCreateManyInput = { + id?: string + profileId: string + street: string + city: string + state: string + postalCode: string + country: string +} + +export type AddressUpdateManyMutationInput = { + id?: Prisma.StringFieldUpdateOperationsInput | string + street?: Prisma.StringFieldUpdateOperationsInput | string + city?: Prisma.StringFieldUpdateOperationsInput | string + state?: Prisma.StringFieldUpdateOperationsInput | string + postalCode?: Prisma.StringFieldUpdateOperationsInput | string + country?: Prisma.StringFieldUpdateOperationsInput | string +} + +export type AddressUncheckedUpdateManyInput = { + id?: Prisma.StringFieldUpdateOperationsInput | string + profileId?: Prisma.StringFieldUpdateOperationsInput | string + street?: Prisma.StringFieldUpdateOperationsInput | string + city?: Prisma.StringFieldUpdateOperationsInput | string + state?: Prisma.StringFieldUpdateOperationsInput | string + postalCode?: Prisma.StringFieldUpdateOperationsInput | string + country?: Prisma.StringFieldUpdateOperationsInput | string +} + +export type AddressListRelationFilter = { + every?: Prisma.AddressWhereInput + some?: Prisma.AddressWhereInput + none?: Prisma.AddressWhereInput +} + +export type AddressOrderByRelationAggregateInput = { + _count?: Prisma.SortOrder +} + +export type AddressCountOrderByAggregateInput = { + id?: Prisma.SortOrder + profileId?: Prisma.SortOrder + street?: Prisma.SortOrder + city?: Prisma.SortOrder + state?: Prisma.SortOrder + postalCode?: Prisma.SortOrder + country?: Prisma.SortOrder +} + +export type AddressMaxOrderByAggregateInput = { + id?: Prisma.SortOrder + profileId?: Prisma.SortOrder + street?: Prisma.SortOrder + city?: Prisma.SortOrder + state?: Prisma.SortOrder + postalCode?: Prisma.SortOrder + country?: Prisma.SortOrder +} + +export type AddressMinOrderByAggregateInput = { + id?: Prisma.SortOrder + profileId?: Prisma.SortOrder + street?: Prisma.SortOrder + city?: Prisma.SortOrder + state?: Prisma.SortOrder + postalCode?: Prisma.SortOrder + country?: Prisma.SortOrder +} + +export type AddressCreateNestedManyWithoutProfileInput = { + create?: Prisma.XOR | Prisma.AddressCreateWithoutProfileInput[] | Prisma.AddressUncheckedCreateWithoutProfileInput[] + connectOrCreate?: Prisma.AddressCreateOrConnectWithoutProfileInput | Prisma.AddressCreateOrConnectWithoutProfileInput[] + createMany?: Prisma.AddressCreateManyProfileInputEnvelope + connect?: Prisma.AddressWhereUniqueInput | Prisma.AddressWhereUniqueInput[] +} + +export type AddressUncheckedCreateNestedManyWithoutProfileInput = { + create?: Prisma.XOR | Prisma.AddressCreateWithoutProfileInput[] | Prisma.AddressUncheckedCreateWithoutProfileInput[] + connectOrCreate?: Prisma.AddressCreateOrConnectWithoutProfileInput | Prisma.AddressCreateOrConnectWithoutProfileInput[] + createMany?: Prisma.AddressCreateManyProfileInputEnvelope + connect?: Prisma.AddressWhereUniqueInput | Prisma.AddressWhereUniqueInput[] +} + +export type AddressUpdateManyWithoutProfileNestedInput = { + create?: Prisma.XOR | Prisma.AddressCreateWithoutProfileInput[] | Prisma.AddressUncheckedCreateWithoutProfileInput[] + connectOrCreate?: Prisma.AddressCreateOrConnectWithoutProfileInput | Prisma.AddressCreateOrConnectWithoutProfileInput[] + upsert?: Prisma.AddressUpsertWithWhereUniqueWithoutProfileInput | Prisma.AddressUpsertWithWhereUniqueWithoutProfileInput[] + createMany?: Prisma.AddressCreateManyProfileInputEnvelope + set?: Prisma.AddressWhereUniqueInput | Prisma.AddressWhereUniqueInput[] + disconnect?: Prisma.AddressWhereUniqueInput | Prisma.AddressWhereUniqueInput[] + delete?: Prisma.AddressWhereUniqueInput | Prisma.AddressWhereUniqueInput[] + connect?: Prisma.AddressWhereUniqueInput | Prisma.AddressWhereUniqueInput[] + update?: Prisma.AddressUpdateWithWhereUniqueWithoutProfileInput | Prisma.AddressUpdateWithWhereUniqueWithoutProfileInput[] + updateMany?: Prisma.AddressUpdateManyWithWhereWithoutProfileInput | Prisma.AddressUpdateManyWithWhereWithoutProfileInput[] + deleteMany?: Prisma.AddressScalarWhereInput | Prisma.AddressScalarWhereInput[] +} + +export type AddressUncheckedUpdateManyWithoutProfileNestedInput = { + create?: Prisma.XOR | Prisma.AddressCreateWithoutProfileInput[] | Prisma.AddressUncheckedCreateWithoutProfileInput[] + connectOrCreate?: Prisma.AddressCreateOrConnectWithoutProfileInput | Prisma.AddressCreateOrConnectWithoutProfileInput[] + upsert?: Prisma.AddressUpsertWithWhereUniqueWithoutProfileInput | Prisma.AddressUpsertWithWhereUniqueWithoutProfileInput[] + createMany?: Prisma.AddressCreateManyProfileInputEnvelope + set?: Prisma.AddressWhereUniqueInput | Prisma.AddressWhereUniqueInput[] + disconnect?: Prisma.AddressWhereUniqueInput | Prisma.AddressWhereUniqueInput[] + delete?: Prisma.AddressWhereUniqueInput | Prisma.AddressWhereUniqueInput[] + connect?: Prisma.AddressWhereUniqueInput | Prisma.AddressWhereUniqueInput[] + update?: Prisma.AddressUpdateWithWhereUniqueWithoutProfileInput | Prisma.AddressUpdateWithWhereUniqueWithoutProfileInput[] + updateMany?: Prisma.AddressUpdateManyWithWhereWithoutProfileInput | Prisma.AddressUpdateManyWithWhereWithoutProfileInput[] + deleteMany?: Prisma.AddressScalarWhereInput | Prisma.AddressScalarWhereInput[] +} + +export type AddressCreateWithoutProfileInput = { + id?: string + street: string + city: string + state: string + postalCode: string + country: string +} + +export type AddressUncheckedCreateWithoutProfileInput = { + id?: string + street: string + city: string + state: string + postalCode: string + country: string +} + +export type AddressCreateOrConnectWithoutProfileInput = { + where: Prisma.AddressWhereUniqueInput + create: Prisma.XOR +} + +export type AddressCreateManyProfileInputEnvelope = { + data: Prisma.AddressCreateManyProfileInput | Prisma.AddressCreateManyProfileInput[] + skipDuplicates?: boolean +} + +export type AddressUpsertWithWhereUniqueWithoutProfileInput = { + where: Prisma.AddressWhereUniqueInput + update: Prisma.XOR + create: Prisma.XOR +} + +export type AddressUpdateWithWhereUniqueWithoutProfileInput = { + where: Prisma.AddressWhereUniqueInput + data: Prisma.XOR +} + +export type AddressUpdateManyWithWhereWithoutProfileInput = { + where: Prisma.AddressScalarWhereInput + data: Prisma.XOR +} + +export type AddressScalarWhereInput = { + AND?: Prisma.AddressScalarWhereInput | Prisma.AddressScalarWhereInput[] + OR?: Prisma.AddressScalarWhereInput[] + NOT?: Prisma.AddressScalarWhereInput | Prisma.AddressScalarWhereInput[] + id?: Prisma.StringFilter<"Address"> | string + profileId?: Prisma.StringFilter<"Address"> | string + street?: Prisma.StringFilter<"Address"> | string + city?: Prisma.StringFilter<"Address"> | string + state?: Prisma.StringFilter<"Address"> | string + postalCode?: Prisma.StringFilter<"Address"> | string + country?: Prisma.StringFilter<"Address"> | string +} + +export type AddressCreateManyProfileInput = { + id?: string + street: string + city: string + state: string + postalCode: string + country: string +} + +export type AddressUpdateWithoutProfileInput = { + id?: Prisma.StringFieldUpdateOperationsInput | string + street?: Prisma.StringFieldUpdateOperationsInput | string + city?: Prisma.StringFieldUpdateOperationsInput | string + state?: Prisma.StringFieldUpdateOperationsInput | string + postalCode?: Prisma.StringFieldUpdateOperationsInput | string + country?: Prisma.StringFieldUpdateOperationsInput | string +} + +export type AddressUncheckedUpdateWithoutProfileInput = { + id?: Prisma.StringFieldUpdateOperationsInput | string + street?: Prisma.StringFieldUpdateOperationsInput | string + city?: Prisma.StringFieldUpdateOperationsInput | string + state?: Prisma.StringFieldUpdateOperationsInput | string + postalCode?: Prisma.StringFieldUpdateOperationsInput | string + country?: Prisma.StringFieldUpdateOperationsInput | string +} + +export type AddressUncheckedUpdateManyWithoutProfileInput = { + id?: Prisma.StringFieldUpdateOperationsInput | string + street?: Prisma.StringFieldUpdateOperationsInput | string + city?: Prisma.StringFieldUpdateOperationsInput | string + state?: Prisma.StringFieldUpdateOperationsInput | string + postalCode?: Prisma.StringFieldUpdateOperationsInput | string + country?: Prisma.StringFieldUpdateOperationsInput | string +} + + + +export type AddressSelect = runtime.Types.Extensions.GetSelect<{ + id?: boolean + profileId?: boolean + street?: boolean + city?: boolean + state?: boolean + postalCode?: boolean + country?: boolean + profile?: boolean | Prisma.ProfileDefaultArgs +}, ExtArgs["result"]["address"]> + +export type AddressSelectCreateManyAndReturn = runtime.Types.Extensions.GetSelect<{ + id?: boolean + profileId?: boolean + street?: boolean + city?: boolean + state?: boolean + postalCode?: boolean + country?: boolean + profile?: boolean | Prisma.ProfileDefaultArgs +}, ExtArgs["result"]["address"]> + +export type AddressSelectUpdateManyAndReturn = runtime.Types.Extensions.GetSelect<{ + id?: boolean + profileId?: boolean + street?: boolean + city?: boolean + state?: boolean + postalCode?: boolean + country?: boolean + profile?: boolean | Prisma.ProfileDefaultArgs +}, ExtArgs["result"]["address"]> + +export type AddressSelectScalar = { + id?: boolean + profileId?: boolean + street?: boolean + city?: boolean + state?: boolean + postalCode?: boolean + country?: boolean +} + +export type AddressOmit = runtime.Types.Extensions.GetOmit<"id" | "profileId" | "street" | "city" | "state" | "postalCode" | "country", ExtArgs["result"]["address"]> +export type AddressInclude = { + profile?: boolean | Prisma.ProfileDefaultArgs +} +export type AddressIncludeCreateManyAndReturn = { + profile?: boolean | Prisma.ProfileDefaultArgs +} +export type AddressIncludeUpdateManyAndReturn = { + profile?: boolean | Prisma.ProfileDefaultArgs +} + +export type $AddressPayload = { + name: "Address" + objects: { + profile: Prisma.$ProfilePayload + } + scalars: runtime.Types.Extensions.GetPayloadResult<{ + id: string + profileId: string + street: string + city: string + state: string + postalCode: string + country: string + }, ExtArgs["result"]["address"]> + composites: {} +} + +export type AddressGetPayload = runtime.Types.Result.GetResult + +export type AddressCountArgs = + Omit & { + select?: AddressCountAggregateInputType | true + } + +export interface AddressDelegate { + [K: symbol]: { types: Prisma.TypeMap['model']['Address'], meta: { name: 'Address' } } + /** + * Find zero or one Address that matches the filter. + * @param {AddressFindUniqueArgs} args - Arguments to find a Address + * @example + * // Get one Address + * const address = await prisma.address.findUnique({ + * where: { + * // ... provide filter here + * } + * }) + */ + findUnique(args: Prisma.SelectSubset>): Prisma.Prisma__AddressClient, T, "findUnique", GlobalOmitOptions> | null, null, ExtArgs, GlobalOmitOptions> + + /** + * Find one Address that matches the filter or throw an error with `error.code='P2025'` + * if no matches were found. + * @param {AddressFindUniqueOrThrowArgs} args - Arguments to find a Address + * @example + * // Get one Address + * const address = await prisma.address.findUniqueOrThrow({ + * where: { + * // ... provide filter here + * } + * }) + */ + findUniqueOrThrow(args: Prisma.SelectSubset>): Prisma.Prisma__AddressClient, T, "findUniqueOrThrow", GlobalOmitOptions>, never, ExtArgs, GlobalOmitOptions> + + /** + * Find the first Address 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 {AddressFindFirstArgs} args - Arguments to find a Address + * @example + * // Get one Address + * const address = await prisma.address.findFirst({ + * where: { + * // ... provide filter here + * } + * }) + */ + findFirst(args?: Prisma.SelectSubset>): Prisma.Prisma__AddressClient, T, "findFirst", GlobalOmitOptions> | null, null, ExtArgs, GlobalOmitOptions> + + /** + * Find the first Address 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 {AddressFindFirstOrThrowArgs} args - Arguments to find a Address + * @example + * // Get one Address + * const address = await prisma.address.findFirstOrThrow({ + * where: { + * // ... provide filter here + * } + * }) + */ + findFirstOrThrow(args?: Prisma.SelectSubset>): Prisma.Prisma__AddressClient, T, "findFirstOrThrow", GlobalOmitOptions>, never, ExtArgs, GlobalOmitOptions> + + /** + * Find zero or more Addresses 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 {AddressFindManyArgs} args - Arguments to filter and select certain fields only. + * @example + * // Get all Addresses + * const addresses = await prisma.address.findMany() + * + * // Get first 10 Addresses + * const addresses = await prisma.address.findMany({ take: 10 }) + * + * // Only select the `id` + * const addressWithIdOnly = await prisma.address.findMany({ select: { id: true } }) + * + */ + findMany(args?: Prisma.SelectSubset>): Prisma.PrismaPromise, T, "findMany", GlobalOmitOptions>> + + /** + * Create a Address. + * @param {AddressCreateArgs} args - Arguments to create a Address. + * @example + * // Create one Address + * const Address = await prisma.address.create({ + * data: { + * // ... data to create a Address + * } + * }) + * + */ + create(args: Prisma.SelectSubset>): Prisma.Prisma__AddressClient, T, "create", GlobalOmitOptions>, never, ExtArgs, GlobalOmitOptions> + + /** + * Create many Addresses. + * @param {AddressCreateManyArgs} args - Arguments to create many Addresses. + * @example + * // Create many Addresses + * const address = await prisma.address.createMany({ + * data: [ + * // ... provide data here + * ] + * }) + * + */ + createMany(args?: Prisma.SelectSubset>): Prisma.PrismaPromise + + /** + * Create many Addresses and returns the data saved in the database. + * @param {AddressCreateManyAndReturnArgs} args - Arguments to create many Addresses. + * @example + * // Create many Addresses + * const address = await prisma.address.createManyAndReturn({ + * data: [ + * // ... provide data here + * ] + * }) + * + * // Create many Addresses and only return the `id` + * const addressWithIdOnly = await prisma.address.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 Address. + * @param {AddressDeleteArgs} args - Arguments to delete one Address. + * @example + * // Delete one Address + * const Address = await prisma.address.delete({ + * where: { + * // ... filter to delete one Address + * } + * }) + * + */ + delete(args: Prisma.SelectSubset>): Prisma.Prisma__AddressClient, T, "delete", GlobalOmitOptions>, never, ExtArgs, GlobalOmitOptions> + + /** + * Update one Address. + * @param {AddressUpdateArgs} args - Arguments to update one Address. + * @example + * // Update one Address + * const address = await prisma.address.update({ + * where: { + * // ... provide filter here + * }, + * data: { + * // ... provide data here + * } + * }) + * + */ + update(args: Prisma.SelectSubset>): Prisma.Prisma__AddressClient, T, "update", GlobalOmitOptions>, never, ExtArgs, GlobalOmitOptions> + + /** + * Delete zero or more Addresses. + * @param {AddressDeleteManyArgs} args - Arguments to filter Addresses to delete. + * @example + * // Delete a few Addresses + * const { count } = await prisma.address.deleteMany({ + * where: { + * // ... provide filter here + * } + * }) + * + */ + deleteMany(args?: Prisma.SelectSubset>): Prisma.PrismaPromise + + /** + * Update zero or more Addresses. + * Note, that providing `undefined` is treated as the value not being there. + * Read more here: https://pris.ly/d/null-undefined + * @param {AddressUpdateManyArgs} args - Arguments to update one or more rows. + * @example + * // Update many Addresses + * const address = await prisma.address.updateMany({ + * where: { + * // ... provide filter here + * }, + * data: { + * // ... provide data here + * } + * }) + * + */ + updateMany(args: Prisma.SelectSubset>): Prisma.PrismaPromise + + /** + * Update zero or more Addresses and returns the data updated in the database. + * @param {AddressUpdateManyAndReturnArgs} args - Arguments to update many Addresses. + * @example + * // Update many Addresses + * const address = await prisma.address.updateManyAndReturn({ + * where: { + * // ... provide filter here + * }, + * data: [ + * // ... provide data here + * ] + * }) + * + * // Update zero or more Addresses and only return the `id` + * const addressWithIdOnly = await prisma.address.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 Address. + * @param {AddressUpsertArgs} args - Arguments to update or create a Address. + * @example + * // Update or create a Address + * const address = await prisma.address.upsert({ + * create: { + * // ... data to create a Address + * }, + * update: { + * // ... in case it already exists, update + * }, + * where: { + * // ... the filter for the Address we want to update + * } + * }) + */ + upsert(args: Prisma.SelectSubset>): Prisma.Prisma__AddressClient, T, "upsert", GlobalOmitOptions>, never, ExtArgs, GlobalOmitOptions> + + + /** + * Count the number of Addresses. + * Note, that providing `undefined` is treated as the value not being there. + * Read more here: https://pris.ly/d/null-undefined + * @param {AddressCountArgs} args - Arguments to filter Addresses to count. + * @example + * // Count the number of Addresses + * const count = await prisma.address.count({ + * where: { + * // ... the filter for the Addresses 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 Address. + * Note, that providing `undefined` is treated as the value not being there. + * Read more here: https://pris.ly/d/null-undefined + * @param {AddressAggregateArgs} 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 Address. + * Note, that providing `undefined` is treated as the value not being there. + * Read more here: https://pris.ly/d/null-undefined + * @param {AddressGroupByArgs} 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 AddressGroupByArgs, + HasSelectOrTake extends Prisma.Or< + Prisma.Extends<'skip', Prisma.Keys>, + Prisma.Extends<'take', Prisma.Keys> + >, + OrderByArg extends Prisma.True extends HasSelectOrTake + ? { orderBy: AddressGroupByArgs['orderBy'] } + : { orderBy?: AddressGroupByArgs['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 ? GetAddressGroupByPayload : Prisma.PrismaPromise +/** + * Fields of the Address model + */ +readonly fields: AddressFieldRefs; +} + +/** + * The delegate class that acts as a "Promise-like" for Address. + * 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__AddressClient extends Prisma.PrismaPromise { + readonly [Symbol.toStringTag]: "PrismaPromise" + profile = {}>(args?: Prisma.Subset>): Prisma.Prisma__ProfileClient, 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 Address model + */ +export interface AddressFieldRefs { + readonly id: Prisma.FieldRef<"Address", 'String'> + readonly profileId: Prisma.FieldRef<"Address", 'String'> + readonly street: Prisma.FieldRef<"Address", 'String'> + readonly city: Prisma.FieldRef<"Address", 'String'> + readonly state: Prisma.FieldRef<"Address", 'String'> + readonly postalCode: Prisma.FieldRef<"Address", 'String'> + readonly country: Prisma.FieldRef<"Address", 'String'> +} + + +// Custom InputTypes +/** + * Address findUnique + */ +export type AddressFindUniqueArgs = { + /** + * Select specific fields to fetch from the Address + */ + select?: Prisma.AddressSelect | null + /** + * Omit specific fields from the Address + */ + omit?: Prisma.AddressOmit | null + /** + * Choose, which related nodes to fetch as well + */ + include?: Prisma.AddressInclude | null + /** + * Filter, which Address to fetch. + */ + where: Prisma.AddressWhereUniqueInput +} + +/** + * Address findUniqueOrThrow + */ +export type AddressFindUniqueOrThrowArgs = { + /** + * Select specific fields to fetch from the Address + */ + select?: Prisma.AddressSelect | null + /** + * Omit specific fields from the Address + */ + omit?: Prisma.AddressOmit | null + /** + * Choose, which related nodes to fetch as well + */ + include?: Prisma.AddressInclude | null + /** + * Filter, which Address to fetch. + */ + where: Prisma.AddressWhereUniqueInput +} + +/** + * Address findFirst + */ +export type AddressFindFirstArgs = { + /** + * Select specific fields to fetch from the Address + */ + select?: Prisma.AddressSelect | null + /** + * Omit specific fields from the Address + */ + omit?: Prisma.AddressOmit | null + /** + * Choose, which related nodes to fetch as well + */ + include?: Prisma.AddressInclude | null + /** + * Filter, which Address to fetch. + */ + where?: Prisma.AddressWhereInput + /** + * {@link https://www.prisma.io/docs/concepts/components/prisma-client/sorting Sorting Docs} + * + * Determine the order of Addresses to fetch. + */ + orderBy?: Prisma.AddressOrderByWithRelationInput | Prisma.AddressOrderByWithRelationInput[] + /** + * {@link https://www.prisma.io/docs/concepts/components/prisma-client/pagination#cursor-based-pagination Cursor Docs} + * + * Sets the position for searching for Addresses. + */ + cursor?: Prisma.AddressWhereUniqueInput + /** + * {@link https://www.prisma.io/docs/concepts/components/prisma-client/pagination Pagination Docs} + * + * Take `±n` Addresses 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` Addresses. + */ + skip?: number + /** + * {@link https://www.prisma.io/docs/concepts/components/prisma-client/distinct Distinct Docs} + * + * Filter by unique combinations of Addresses. + */ + distinct?: Prisma.AddressScalarFieldEnum | Prisma.AddressScalarFieldEnum[] +} + +/** + * Address findFirstOrThrow + */ +export type AddressFindFirstOrThrowArgs = { + /** + * Select specific fields to fetch from the Address + */ + select?: Prisma.AddressSelect | null + /** + * Omit specific fields from the Address + */ + omit?: Prisma.AddressOmit | null + /** + * Choose, which related nodes to fetch as well + */ + include?: Prisma.AddressInclude | null + /** + * Filter, which Address to fetch. + */ + where?: Prisma.AddressWhereInput + /** + * {@link https://www.prisma.io/docs/concepts/components/prisma-client/sorting Sorting Docs} + * + * Determine the order of Addresses to fetch. + */ + orderBy?: Prisma.AddressOrderByWithRelationInput | Prisma.AddressOrderByWithRelationInput[] + /** + * {@link https://www.prisma.io/docs/concepts/components/prisma-client/pagination#cursor-based-pagination Cursor Docs} + * + * Sets the position for searching for Addresses. + */ + cursor?: Prisma.AddressWhereUniqueInput + /** + * {@link https://www.prisma.io/docs/concepts/components/prisma-client/pagination Pagination Docs} + * + * Take `±n` Addresses 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` Addresses. + */ + skip?: number + /** + * {@link https://www.prisma.io/docs/concepts/components/prisma-client/distinct Distinct Docs} + * + * Filter by unique combinations of Addresses. + */ + distinct?: Prisma.AddressScalarFieldEnum | Prisma.AddressScalarFieldEnum[] +} + +/** + * Address findMany + */ +export type AddressFindManyArgs = { + /** + * Select specific fields to fetch from the Address + */ + select?: Prisma.AddressSelect | null + /** + * Omit specific fields from the Address + */ + omit?: Prisma.AddressOmit | null + /** + * Choose, which related nodes to fetch as well + */ + include?: Prisma.AddressInclude | null + /** + * Filter, which Addresses to fetch. + */ + where?: Prisma.AddressWhereInput + /** + * {@link https://www.prisma.io/docs/concepts/components/prisma-client/sorting Sorting Docs} + * + * Determine the order of Addresses to fetch. + */ + orderBy?: Prisma.AddressOrderByWithRelationInput | Prisma.AddressOrderByWithRelationInput[] + /** + * {@link https://www.prisma.io/docs/concepts/components/prisma-client/pagination#cursor-based-pagination Cursor Docs} + * + * Sets the position for listing Addresses. + */ + cursor?: Prisma.AddressWhereUniqueInput + /** + * {@link https://www.prisma.io/docs/concepts/components/prisma-client/pagination Pagination Docs} + * + * Take `±n` Addresses 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` Addresses. + */ + skip?: number + distinct?: Prisma.AddressScalarFieldEnum | Prisma.AddressScalarFieldEnum[] +} + +/** + * Address create + */ +export type AddressCreateArgs = { + /** + * Select specific fields to fetch from the Address + */ + select?: Prisma.AddressSelect | null + /** + * Omit specific fields from the Address + */ + omit?: Prisma.AddressOmit | null + /** + * Choose, which related nodes to fetch as well + */ + include?: Prisma.AddressInclude | null + /** + * The data needed to create a Address. + */ + data: Prisma.XOR +} + +/** + * Address createMany + */ +export type AddressCreateManyArgs = { + /** + * The data used to create many Addresses. + */ + data: Prisma.AddressCreateManyInput | Prisma.AddressCreateManyInput[] + skipDuplicates?: boolean +} + +/** + * Address createManyAndReturn + */ +export type AddressCreateManyAndReturnArgs = { + /** + * Select specific fields to fetch from the Address + */ + select?: Prisma.AddressSelectCreateManyAndReturn | null + /** + * Omit specific fields from the Address + */ + omit?: Prisma.AddressOmit | null + /** + * The data used to create many Addresses. + */ + data: Prisma.AddressCreateManyInput | Prisma.AddressCreateManyInput[] + skipDuplicates?: boolean + /** + * Choose, which related nodes to fetch as well + */ + include?: Prisma.AddressIncludeCreateManyAndReturn | null +} + +/** + * Address update + */ +export type AddressUpdateArgs = { + /** + * Select specific fields to fetch from the Address + */ + select?: Prisma.AddressSelect | null + /** + * Omit specific fields from the Address + */ + omit?: Prisma.AddressOmit | null + /** + * Choose, which related nodes to fetch as well + */ + include?: Prisma.AddressInclude | null + /** + * The data needed to update a Address. + */ + data: Prisma.XOR + /** + * Choose, which Address to update. + */ + where: Prisma.AddressWhereUniqueInput +} + +/** + * Address updateMany + */ +export type AddressUpdateManyArgs = { + /** + * The data used to update Addresses. + */ + data: Prisma.XOR + /** + * Filter which Addresses to update + */ + where?: Prisma.AddressWhereInput + /** + * Limit how many Addresses to update. + */ + limit?: number +} + +/** + * Address updateManyAndReturn + */ +export type AddressUpdateManyAndReturnArgs = { + /** + * Select specific fields to fetch from the Address + */ + select?: Prisma.AddressSelectUpdateManyAndReturn | null + /** + * Omit specific fields from the Address + */ + omit?: Prisma.AddressOmit | null + /** + * The data used to update Addresses. + */ + data: Prisma.XOR + /** + * Filter which Addresses to update + */ + where?: Prisma.AddressWhereInput + /** + * Limit how many Addresses to update. + */ + limit?: number + /** + * Choose, which related nodes to fetch as well + */ + include?: Prisma.AddressIncludeUpdateManyAndReturn | null +} + +/** + * Address upsert + */ +export type AddressUpsertArgs = { + /** + * Select specific fields to fetch from the Address + */ + select?: Prisma.AddressSelect | null + /** + * Omit specific fields from the Address + */ + omit?: Prisma.AddressOmit | null + /** + * Choose, which related nodes to fetch as well + */ + include?: Prisma.AddressInclude | null + /** + * The filter to search for the Address to update in case it exists. + */ + where: Prisma.AddressWhereUniqueInput + /** + * In case the Address found by the `where` argument doesn't exist, create a new Address with this data. + */ + create: Prisma.XOR + /** + * In case the Address was found with the provided `where` argument, update it with this data. + */ + update: Prisma.XOR +} + +/** + * Address delete + */ +export type AddressDeleteArgs = { + /** + * Select specific fields to fetch from the Address + */ + select?: Prisma.AddressSelect | null + /** + * Omit specific fields from the Address + */ + omit?: Prisma.AddressOmit | null + /** + * Choose, which related nodes to fetch as well + */ + include?: Prisma.AddressInclude | null + /** + * Filter which Address to delete. + */ + where: Prisma.AddressWhereUniqueInput +} + +/** + * Address deleteMany + */ +export type AddressDeleteManyArgs = { + /** + * Filter which Addresses to delete + */ + where?: Prisma.AddressWhereInput + /** + * Limit how many Addresses to delete. + */ + limit?: number +} + +/** + * Address without action + */ +export type AddressDefaultArgs = { + /** + * Select specific fields to fetch from the Address + */ + select?: Prisma.AddressSelect | null + /** + * Omit specific fields from the Address + */ + omit?: Prisma.AddressOmit | null + /** + * Choose, which related nodes to fetch as well + */ + include?: Prisma.AddressInclude | null +} diff --git a/src/lib/generated/prisma/models/Profile.ts b/src/lib/generated/prisma/models/Profile.ts new file mode 100644 index 0000000..9fb7e0b --- /dev/null +++ b/src/lib/generated/prisma/models/Profile.ts @@ -0,0 +1,1427 @@ + +/* !!! This is code generated by Prisma. Do not edit directly. !!! */ +/* eslint-disable */ +// biome-ignore-all lint: generated file +// @ts-nocheck +/* + * This file exports the `Profile` 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 Profile + * + */ +export type ProfileModel = runtime.Types.Result.DefaultSelection + +export type AggregateProfile = { + _count: ProfileCountAggregateOutputType | null + _min: ProfileMinAggregateOutputType | null + _max: ProfileMaxAggregateOutputType | null +} + +export type ProfileMinAggregateOutputType = { + id: string | null + userId: string | null + firstName: string | null + lastName: string | null + phoneNumber: string | null +} + +export type ProfileMaxAggregateOutputType = { + id: string | null + userId: string | null + firstName: string | null + lastName: string | null + phoneNumber: string | null +} + +export type ProfileCountAggregateOutputType = { + id: number + userId: number + firstName: number + lastName: number + phoneNumber: number + _all: number +} + + +export type ProfileMinAggregateInputType = { + id?: true + userId?: true + firstName?: true + lastName?: true + phoneNumber?: true +} + +export type ProfileMaxAggregateInputType = { + id?: true + userId?: true + firstName?: true + lastName?: true + phoneNumber?: true +} + +export type ProfileCountAggregateInputType = { + id?: true + userId?: true + firstName?: true + lastName?: true + phoneNumber?: true + _all?: true +} + +export type ProfileAggregateArgs = { + /** + * Filter which Profile to aggregate. + */ + where?: Prisma.ProfileWhereInput + /** + * {@link https://www.prisma.io/docs/concepts/components/prisma-client/sorting Sorting Docs} + * + * Determine the order of Profiles to fetch. + */ + orderBy?: Prisma.ProfileOrderByWithRelationInput | Prisma.ProfileOrderByWithRelationInput[] + /** + * {@link https://www.prisma.io/docs/concepts/components/prisma-client/pagination#cursor-based-pagination Cursor Docs} + * + * Sets the start position + */ + cursor?: Prisma.ProfileWhereUniqueInput + /** + * {@link https://www.prisma.io/docs/concepts/components/prisma-client/pagination Pagination Docs} + * + * Take `±n` Profiles 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` Profiles. + */ + skip?: number + /** + * {@link https://www.prisma.io/docs/concepts/components/prisma-client/aggregations Aggregation Docs} + * + * Count returned Profiles + **/ + _count?: true | ProfileCountAggregateInputType + /** + * {@link https://www.prisma.io/docs/concepts/components/prisma-client/aggregations Aggregation Docs} + * + * Select which fields to find the minimum value + **/ + _min?: ProfileMinAggregateInputType + /** + * {@link https://www.prisma.io/docs/concepts/components/prisma-client/aggregations Aggregation Docs} + * + * Select which fields to find the maximum value + **/ + _max?: ProfileMaxAggregateInputType +} + +export type GetProfileAggregateType = { + [P in keyof T & keyof AggregateProfile]: P extends '_count' | 'count' + ? T[P] extends true + ? number + : Prisma.GetScalarType + : Prisma.GetScalarType +} + + + + +export type ProfileGroupByArgs = { + where?: Prisma.ProfileWhereInput + orderBy?: Prisma.ProfileOrderByWithAggregationInput | Prisma.ProfileOrderByWithAggregationInput[] + by: Prisma.ProfileScalarFieldEnum[] | Prisma.ProfileScalarFieldEnum + having?: Prisma.ProfileScalarWhereWithAggregatesInput + take?: number + skip?: number + _count?: ProfileCountAggregateInputType | true + _min?: ProfileMinAggregateInputType + _max?: ProfileMaxAggregateInputType +} + +export type ProfileGroupByOutputType = { + id: string + userId: string + firstName: string + lastName: string + phoneNumber: string + _count: ProfileCountAggregateOutputType | null + _min: ProfileMinAggregateOutputType | null + _max: ProfileMaxAggregateOutputType | null +} + +type GetProfileGroupByPayload = Prisma.PrismaPromise< + Array< + Prisma.PickEnumerable & + { + [P in ((keyof T) & (keyof ProfileGroupByOutputType))]: P extends '_count' + ? T[P] extends boolean + ? number + : Prisma.GetScalarType + : Prisma.GetScalarType + } + > + > + + + +export type ProfileWhereInput = { + AND?: Prisma.ProfileWhereInput | Prisma.ProfileWhereInput[] + OR?: Prisma.ProfileWhereInput[] + NOT?: Prisma.ProfileWhereInput | Prisma.ProfileWhereInput[] + id?: Prisma.StringFilter<"Profile"> | string + userId?: Prisma.StringFilter<"Profile"> | string + firstName?: Prisma.StringFilter<"Profile"> | string + lastName?: Prisma.StringFilter<"Profile"> | string + phoneNumber?: Prisma.StringFilter<"Profile"> | string + user?: Prisma.XOR + addresses?: Prisma.AddressListRelationFilter +} + +export type ProfileOrderByWithRelationInput = { + id?: Prisma.SortOrder + userId?: Prisma.SortOrder + firstName?: Prisma.SortOrder + lastName?: Prisma.SortOrder + phoneNumber?: Prisma.SortOrder + user?: Prisma.UserOrderByWithRelationInput + addresses?: Prisma.AddressOrderByRelationAggregateInput +} + +export type ProfileWhereUniqueInput = Prisma.AtLeast<{ + id?: string + userId?: string + AND?: Prisma.ProfileWhereInput | Prisma.ProfileWhereInput[] + OR?: Prisma.ProfileWhereInput[] + NOT?: Prisma.ProfileWhereInput | Prisma.ProfileWhereInput[] + firstName?: Prisma.StringFilter<"Profile"> | string + lastName?: Prisma.StringFilter<"Profile"> | string + phoneNumber?: Prisma.StringFilter<"Profile"> | string + user?: Prisma.XOR + addresses?: Prisma.AddressListRelationFilter +}, "id" | "userId"> + +export type ProfileOrderByWithAggregationInput = { + id?: Prisma.SortOrder + userId?: Prisma.SortOrder + firstName?: Prisma.SortOrder + lastName?: Prisma.SortOrder + phoneNumber?: Prisma.SortOrder + _count?: Prisma.ProfileCountOrderByAggregateInput + _max?: Prisma.ProfileMaxOrderByAggregateInput + _min?: Prisma.ProfileMinOrderByAggregateInput +} + +export type ProfileScalarWhereWithAggregatesInput = { + AND?: Prisma.ProfileScalarWhereWithAggregatesInput | Prisma.ProfileScalarWhereWithAggregatesInput[] + OR?: Prisma.ProfileScalarWhereWithAggregatesInput[] + NOT?: Prisma.ProfileScalarWhereWithAggregatesInput | Prisma.ProfileScalarWhereWithAggregatesInput[] + id?: Prisma.StringWithAggregatesFilter<"Profile"> | string + userId?: Prisma.StringWithAggregatesFilter<"Profile"> | string + firstName?: Prisma.StringWithAggregatesFilter<"Profile"> | string + lastName?: Prisma.StringWithAggregatesFilter<"Profile"> | string + phoneNumber?: Prisma.StringWithAggregatesFilter<"Profile"> | string +} + +export type ProfileCreateInput = { + id?: string + firstName: string + lastName: string + phoneNumber: string + user: Prisma.UserCreateNestedOneWithoutProfileInput + addresses?: Prisma.AddressCreateNestedManyWithoutProfileInput +} + +export type ProfileUncheckedCreateInput = { + id?: string + userId: string + firstName: string + lastName: string + phoneNumber: string + addresses?: Prisma.AddressUncheckedCreateNestedManyWithoutProfileInput +} + +export type ProfileUpdateInput = { + id?: Prisma.StringFieldUpdateOperationsInput | string + firstName?: Prisma.StringFieldUpdateOperationsInput | string + lastName?: Prisma.StringFieldUpdateOperationsInput | string + phoneNumber?: Prisma.StringFieldUpdateOperationsInput | string + user?: Prisma.UserUpdateOneRequiredWithoutProfileNestedInput + addresses?: Prisma.AddressUpdateManyWithoutProfileNestedInput +} + +export type ProfileUncheckedUpdateInput = { + id?: Prisma.StringFieldUpdateOperationsInput | string + userId?: Prisma.StringFieldUpdateOperationsInput | string + firstName?: Prisma.StringFieldUpdateOperationsInput | string + lastName?: Prisma.StringFieldUpdateOperationsInput | string + phoneNumber?: Prisma.StringFieldUpdateOperationsInput | string + addresses?: Prisma.AddressUncheckedUpdateManyWithoutProfileNestedInput +} + +export type ProfileCreateManyInput = { + id?: string + userId: string + firstName: string + lastName: string + phoneNumber: string +} + +export type ProfileUpdateManyMutationInput = { + id?: Prisma.StringFieldUpdateOperationsInput | string + firstName?: Prisma.StringFieldUpdateOperationsInput | string + lastName?: Prisma.StringFieldUpdateOperationsInput | string + phoneNumber?: Prisma.StringFieldUpdateOperationsInput | string +} + +export type ProfileUncheckedUpdateManyInput = { + id?: Prisma.StringFieldUpdateOperationsInput | string + userId?: Prisma.StringFieldUpdateOperationsInput | string + firstName?: Prisma.StringFieldUpdateOperationsInput | string + lastName?: Prisma.StringFieldUpdateOperationsInput | string + phoneNumber?: Prisma.StringFieldUpdateOperationsInput | string +} + +export type ProfileNullableScalarRelationFilter = { + is?: Prisma.ProfileWhereInput | null + isNot?: Prisma.ProfileWhereInput | null +} + +export type ProfileCountOrderByAggregateInput = { + id?: Prisma.SortOrder + userId?: Prisma.SortOrder + firstName?: Prisma.SortOrder + lastName?: Prisma.SortOrder + phoneNumber?: Prisma.SortOrder +} + +export type ProfileMaxOrderByAggregateInput = { + id?: Prisma.SortOrder + userId?: Prisma.SortOrder + firstName?: Prisma.SortOrder + lastName?: Prisma.SortOrder + phoneNumber?: Prisma.SortOrder +} + +export type ProfileMinOrderByAggregateInput = { + id?: Prisma.SortOrder + userId?: Prisma.SortOrder + firstName?: Prisma.SortOrder + lastName?: Prisma.SortOrder + phoneNumber?: Prisma.SortOrder +} + +export type ProfileScalarRelationFilter = { + is?: Prisma.ProfileWhereInput + isNot?: Prisma.ProfileWhereInput +} + +export type ProfileCreateNestedOneWithoutUserInput = { + create?: Prisma.XOR + connectOrCreate?: Prisma.ProfileCreateOrConnectWithoutUserInput + connect?: Prisma.ProfileWhereUniqueInput +} + +export type ProfileUncheckedCreateNestedOneWithoutUserInput = { + create?: Prisma.XOR + connectOrCreate?: Prisma.ProfileCreateOrConnectWithoutUserInput + connect?: Prisma.ProfileWhereUniqueInput +} + +export type ProfileUpdateOneWithoutUserNestedInput = { + create?: Prisma.XOR + connectOrCreate?: Prisma.ProfileCreateOrConnectWithoutUserInput + upsert?: Prisma.ProfileUpsertWithoutUserInput + disconnect?: Prisma.ProfileWhereInput | boolean + delete?: Prisma.ProfileWhereInput | boolean + connect?: Prisma.ProfileWhereUniqueInput + update?: Prisma.XOR, Prisma.ProfileUncheckedUpdateWithoutUserInput> +} + +export type ProfileUncheckedUpdateOneWithoutUserNestedInput = { + create?: Prisma.XOR + connectOrCreate?: Prisma.ProfileCreateOrConnectWithoutUserInput + upsert?: Prisma.ProfileUpsertWithoutUserInput + disconnect?: Prisma.ProfileWhereInput | boolean + delete?: Prisma.ProfileWhereInput | boolean + connect?: Prisma.ProfileWhereUniqueInput + update?: Prisma.XOR, Prisma.ProfileUncheckedUpdateWithoutUserInput> +} + +export type ProfileCreateNestedOneWithoutAddressesInput = { + create?: Prisma.XOR + connectOrCreate?: Prisma.ProfileCreateOrConnectWithoutAddressesInput + connect?: Prisma.ProfileWhereUniqueInput +} + +export type ProfileUpdateOneRequiredWithoutAddressesNestedInput = { + create?: Prisma.XOR + connectOrCreate?: Prisma.ProfileCreateOrConnectWithoutAddressesInput + upsert?: Prisma.ProfileUpsertWithoutAddressesInput + connect?: Prisma.ProfileWhereUniqueInput + update?: Prisma.XOR, Prisma.ProfileUncheckedUpdateWithoutAddressesInput> +} + +export type ProfileCreateWithoutUserInput = { + id?: string + firstName: string + lastName: string + phoneNumber: string + addresses?: Prisma.AddressCreateNestedManyWithoutProfileInput +} + +export type ProfileUncheckedCreateWithoutUserInput = { + id?: string + firstName: string + lastName: string + phoneNumber: string + addresses?: Prisma.AddressUncheckedCreateNestedManyWithoutProfileInput +} + +export type ProfileCreateOrConnectWithoutUserInput = { + where: Prisma.ProfileWhereUniqueInput + create: Prisma.XOR +} + +export type ProfileUpsertWithoutUserInput = { + update: Prisma.XOR + create: Prisma.XOR + where?: Prisma.ProfileWhereInput +} + +export type ProfileUpdateToOneWithWhereWithoutUserInput = { + where?: Prisma.ProfileWhereInput + data: Prisma.XOR +} + +export type ProfileUpdateWithoutUserInput = { + id?: Prisma.StringFieldUpdateOperationsInput | string + firstName?: Prisma.StringFieldUpdateOperationsInput | string + lastName?: Prisma.StringFieldUpdateOperationsInput | string + phoneNumber?: Prisma.StringFieldUpdateOperationsInput | string + addresses?: Prisma.AddressUpdateManyWithoutProfileNestedInput +} + +export type ProfileUncheckedUpdateWithoutUserInput = { + id?: Prisma.StringFieldUpdateOperationsInput | string + firstName?: Prisma.StringFieldUpdateOperationsInput | string + lastName?: Prisma.StringFieldUpdateOperationsInput | string + phoneNumber?: Prisma.StringFieldUpdateOperationsInput | string + addresses?: Prisma.AddressUncheckedUpdateManyWithoutProfileNestedInput +} + +export type ProfileCreateWithoutAddressesInput = { + id?: string + firstName: string + lastName: string + phoneNumber: string + user: Prisma.UserCreateNestedOneWithoutProfileInput +} + +export type ProfileUncheckedCreateWithoutAddressesInput = { + id?: string + userId: string + firstName: string + lastName: string + phoneNumber: string +} + +export type ProfileCreateOrConnectWithoutAddressesInput = { + where: Prisma.ProfileWhereUniqueInput + create: Prisma.XOR +} + +export type ProfileUpsertWithoutAddressesInput = { + update: Prisma.XOR + create: Prisma.XOR + where?: Prisma.ProfileWhereInput +} + +export type ProfileUpdateToOneWithWhereWithoutAddressesInput = { + where?: Prisma.ProfileWhereInput + data: Prisma.XOR +} + +export type ProfileUpdateWithoutAddressesInput = { + id?: Prisma.StringFieldUpdateOperationsInput | string + firstName?: Prisma.StringFieldUpdateOperationsInput | string + lastName?: Prisma.StringFieldUpdateOperationsInput | string + phoneNumber?: Prisma.StringFieldUpdateOperationsInput | string + user?: Prisma.UserUpdateOneRequiredWithoutProfileNestedInput +} + +export type ProfileUncheckedUpdateWithoutAddressesInput = { + id?: Prisma.StringFieldUpdateOperationsInput | string + userId?: Prisma.StringFieldUpdateOperationsInput | string + firstName?: Prisma.StringFieldUpdateOperationsInput | string + lastName?: Prisma.StringFieldUpdateOperationsInput | string + phoneNumber?: Prisma.StringFieldUpdateOperationsInput | string +} + + +/** + * Count Type ProfileCountOutputType + */ + +export type ProfileCountOutputType = { + addresses: number +} + +export type ProfileCountOutputTypeSelect = { + addresses?: boolean | ProfileCountOutputTypeCountAddressesArgs +} + +/** + * ProfileCountOutputType without action + */ +export type ProfileCountOutputTypeDefaultArgs = { + /** + * Select specific fields to fetch from the ProfileCountOutputType + */ + select?: Prisma.ProfileCountOutputTypeSelect | null +} + +/** + * ProfileCountOutputType without action + */ +export type ProfileCountOutputTypeCountAddressesArgs = { + where?: Prisma.AddressWhereInput +} + + +export type ProfileSelect = runtime.Types.Extensions.GetSelect<{ + id?: boolean + userId?: boolean + firstName?: boolean + lastName?: boolean + phoneNumber?: boolean + user?: boolean | Prisma.UserDefaultArgs + addresses?: boolean | Prisma.Profile$addressesArgs + _count?: boolean | Prisma.ProfileCountOutputTypeDefaultArgs +}, ExtArgs["result"]["profile"]> + +export type ProfileSelectCreateManyAndReturn = runtime.Types.Extensions.GetSelect<{ + id?: boolean + userId?: boolean + firstName?: boolean + lastName?: boolean + phoneNumber?: boolean + user?: boolean | Prisma.UserDefaultArgs +}, ExtArgs["result"]["profile"]> + +export type ProfileSelectUpdateManyAndReturn = runtime.Types.Extensions.GetSelect<{ + id?: boolean + userId?: boolean + firstName?: boolean + lastName?: boolean + phoneNumber?: boolean + user?: boolean | Prisma.UserDefaultArgs +}, ExtArgs["result"]["profile"]> + +export type ProfileSelectScalar = { + id?: boolean + userId?: boolean + firstName?: boolean + lastName?: boolean + phoneNumber?: boolean +} + +export type ProfileOmit = runtime.Types.Extensions.GetOmit<"id" | "userId" | "firstName" | "lastName" | "phoneNumber", ExtArgs["result"]["profile"]> +export type ProfileInclude = { + user?: boolean | Prisma.UserDefaultArgs + addresses?: boolean | Prisma.Profile$addressesArgs + _count?: boolean | Prisma.ProfileCountOutputTypeDefaultArgs +} +export type ProfileIncludeCreateManyAndReturn = { + user?: boolean | Prisma.UserDefaultArgs +} +export type ProfileIncludeUpdateManyAndReturn = { + user?: boolean | Prisma.UserDefaultArgs +} + +export type $ProfilePayload = { + name: "Profile" + objects: { + user: Prisma.$UserPayload + addresses: Prisma.$AddressPayload[] + } + scalars: runtime.Types.Extensions.GetPayloadResult<{ + id: string + userId: string + firstName: string + lastName: string + phoneNumber: string + }, ExtArgs["result"]["profile"]> + composites: {} +} + +export type ProfileGetPayload = runtime.Types.Result.GetResult + +export type ProfileCountArgs = + Omit & { + select?: ProfileCountAggregateInputType | true + } + +export interface ProfileDelegate { + [K: symbol]: { types: Prisma.TypeMap['model']['Profile'], meta: { name: 'Profile' } } + /** + * Find zero or one Profile that matches the filter. + * @param {ProfileFindUniqueArgs} args - Arguments to find a Profile + * @example + * // Get one Profile + * const profile = await prisma.profile.findUnique({ + * where: { + * // ... provide filter here + * } + * }) + */ + findUnique(args: Prisma.SelectSubset>): Prisma.Prisma__ProfileClient, T, "findUnique", GlobalOmitOptions> | null, null, ExtArgs, GlobalOmitOptions> + + /** + * Find one Profile that matches the filter or throw an error with `error.code='P2025'` + * if no matches were found. + * @param {ProfileFindUniqueOrThrowArgs} args - Arguments to find a Profile + * @example + * // Get one Profile + * const profile = await prisma.profile.findUniqueOrThrow({ + * where: { + * // ... provide filter here + * } + * }) + */ + findUniqueOrThrow(args: Prisma.SelectSubset>): Prisma.Prisma__ProfileClient, T, "findUniqueOrThrow", GlobalOmitOptions>, never, ExtArgs, GlobalOmitOptions> + + /** + * Find the first Profile 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 {ProfileFindFirstArgs} args - Arguments to find a Profile + * @example + * // Get one Profile + * const profile = await prisma.profile.findFirst({ + * where: { + * // ... provide filter here + * } + * }) + */ + findFirst(args?: Prisma.SelectSubset>): Prisma.Prisma__ProfileClient, T, "findFirst", GlobalOmitOptions> | null, null, ExtArgs, GlobalOmitOptions> + + /** + * Find the first Profile 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 {ProfileFindFirstOrThrowArgs} args - Arguments to find a Profile + * @example + * // Get one Profile + * const profile = await prisma.profile.findFirstOrThrow({ + * where: { + * // ... provide filter here + * } + * }) + */ + findFirstOrThrow(args?: Prisma.SelectSubset>): Prisma.Prisma__ProfileClient, T, "findFirstOrThrow", GlobalOmitOptions>, never, ExtArgs, GlobalOmitOptions> + + /** + * Find zero or more Profiles 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 {ProfileFindManyArgs} args - Arguments to filter and select certain fields only. + * @example + * // Get all Profiles + * const profiles = await prisma.profile.findMany() + * + * // Get first 10 Profiles + * const profiles = await prisma.profile.findMany({ take: 10 }) + * + * // Only select the `id` + * const profileWithIdOnly = await prisma.profile.findMany({ select: { id: true } }) + * + */ + findMany(args?: Prisma.SelectSubset>): Prisma.PrismaPromise, T, "findMany", GlobalOmitOptions>> + + /** + * Create a Profile. + * @param {ProfileCreateArgs} args - Arguments to create a Profile. + * @example + * // Create one Profile + * const Profile = await prisma.profile.create({ + * data: { + * // ... data to create a Profile + * } + * }) + * + */ + create(args: Prisma.SelectSubset>): Prisma.Prisma__ProfileClient, T, "create", GlobalOmitOptions>, never, ExtArgs, GlobalOmitOptions> + + /** + * Create many Profiles. + * @param {ProfileCreateManyArgs} args - Arguments to create many Profiles. + * @example + * // Create many Profiles + * const profile = await prisma.profile.createMany({ + * data: [ + * // ... provide data here + * ] + * }) + * + */ + createMany(args?: Prisma.SelectSubset>): Prisma.PrismaPromise + + /** + * Create many Profiles and returns the data saved in the database. + * @param {ProfileCreateManyAndReturnArgs} args - Arguments to create many Profiles. + * @example + * // Create many Profiles + * const profile = await prisma.profile.createManyAndReturn({ + * data: [ + * // ... provide data here + * ] + * }) + * + * // Create many Profiles and only return the `id` + * const profileWithIdOnly = await prisma.profile.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 Profile. + * @param {ProfileDeleteArgs} args - Arguments to delete one Profile. + * @example + * // Delete one Profile + * const Profile = await prisma.profile.delete({ + * where: { + * // ... filter to delete one Profile + * } + * }) + * + */ + delete(args: Prisma.SelectSubset>): Prisma.Prisma__ProfileClient, T, "delete", GlobalOmitOptions>, never, ExtArgs, GlobalOmitOptions> + + /** + * Update one Profile. + * @param {ProfileUpdateArgs} args - Arguments to update one Profile. + * @example + * // Update one Profile + * const profile = await prisma.profile.update({ + * where: { + * // ... provide filter here + * }, + * data: { + * // ... provide data here + * } + * }) + * + */ + update(args: Prisma.SelectSubset>): Prisma.Prisma__ProfileClient, T, "update", GlobalOmitOptions>, never, ExtArgs, GlobalOmitOptions> + + /** + * Delete zero or more Profiles. + * @param {ProfileDeleteManyArgs} args - Arguments to filter Profiles to delete. + * @example + * // Delete a few Profiles + * const { count } = await prisma.profile.deleteMany({ + * where: { + * // ... provide filter here + * } + * }) + * + */ + deleteMany(args?: Prisma.SelectSubset>): Prisma.PrismaPromise + + /** + * Update zero or more Profiles. + * Note, that providing `undefined` is treated as the value not being there. + * Read more here: https://pris.ly/d/null-undefined + * @param {ProfileUpdateManyArgs} args - Arguments to update one or more rows. + * @example + * // Update many Profiles + * const profile = await prisma.profile.updateMany({ + * where: { + * // ... provide filter here + * }, + * data: { + * // ... provide data here + * } + * }) + * + */ + updateMany(args: Prisma.SelectSubset>): Prisma.PrismaPromise + + /** + * Update zero or more Profiles and returns the data updated in the database. + * @param {ProfileUpdateManyAndReturnArgs} args - Arguments to update many Profiles. + * @example + * // Update many Profiles + * const profile = await prisma.profile.updateManyAndReturn({ + * where: { + * // ... provide filter here + * }, + * data: [ + * // ... provide data here + * ] + * }) + * + * // Update zero or more Profiles and only return the `id` + * const profileWithIdOnly = await prisma.profile.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 Profile. + * @param {ProfileUpsertArgs} args - Arguments to update or create a Profile. + * @example + * // Update or create a Profile + * const profile = await prisma.profile.upsert({ + * create: { + * // ... data to create a Profile + * }, + * update: { + * // ... in case it already exists, update + * }, + * where: { + * // ... the filter for the Profile we want to update + * } + * }) + */ + upsert(args: Prisma.SelectSubset>): Prisma.Prisma__ProfileClient, T, "upsert", GlobalOmitOptions>, never, ExtArgs, GlobalOmitOptions> + + + /** + * Count the number of Profiles. + * Note, that providing `undefined` is treated as the value not being there. + * Read more here: https://pris.ly/d/null-undefined + * @param {ProfileCountArgs} args - Arguments to filter Profiles to count. + * @example + * // Count the number of Profiles + * const count = await prisma.profile.count({ + * where: { + * // ... the filter for the Profiles 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 Profile. + * Note, that providing `undefined` is treated as the value not being there. + * Read more here: https://pris.ly/d/null-undefined + * @param {ProfileAggregateArgs} 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 Profile. + * Note, that providing `undefined` is treated as the value not being there. + * Read more here: https://pris.ly/d/null-undefined + * @param {ProfileGroupByArgs} 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 ProfileGroupByArgs, + HasSelectOrTake extends Prisma.Or< + Prisma.Extends<'skip', Prisma.Keys>, + Prisma.Extends<'take', Prisma.Keys> + >, + OrderByArg extends Prisma.True extends HasSelectOrTake + ? { orderBy: ProfileGroupByArgs['orderBy'] } + : { orderBy?: ProfileGroupByArgs['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 ? GetProfileGroupByPayload : Prisma.PrismaPromise +/** + * Fields of the Profile model + */ +readonly fields: ProfileFieldRefs; +} + +/** + * The delegate class that acts as a "Promise-like" for Profile. + * 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__ProfileClient extends Prisma.PrismaPromise { + readonly [Symbol.toStringTag]: "PrismaPromise" + user = {}>(args?: Prisma.Subset>): Prisma.Prisma__UserClient, T, "findUniqueOrThrow", GlobalOmitOptions> | Null, Null, ExtArgs, GlobalOmitOptions> + addresses = {}>(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. + * @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 Profile model + */ +export interface ProfileFieldRefs { + readonly id: Prisma.FieldRef<"Profile", 'String'> + readonly userId: Prisma.FieldRef<"Profile", 'String'> + readonly firstName: Prisma.FieldRef<"Profile", 'String'> + readonly lastName: Prisma.FieldRef<"Profile", 'String'> + readonly phoneNumber: Prisma.FieldRef<"Profile", 'String'> +} + + +// Custom InputTypes +/** + * Profile findUnique + */ +export type ProfileFindUniqueArgs = { + /** + * Select specific fields to fetch from the Profile + */ + select?: Prisma.ProfileSelect | null + /** + * Omit specific fields from the Profile + */ + omit?: Prisma.ProfileOmit | null + /** + * Choose, which related nodes to fetch as well + */ + include?: Prisma.ProfileInclude | null + /** + * Filter, which Profile to fetch. + */ + where: Prisma.ProfileWhereUniqueInput +} + +/** + * Profile findUniqueOrThrow + */ +export type ProfileFindUniqueOrThrowArgs = { + /** + * Select specific fields to fetch from the Profile + */ + select?: Prisma.ProfileSelect | null + /** + * Omit specific fields from the Profile + */ + omit?: Prisma.ProfileOmit | null + /** + * Choose, which related nodes to fetch as well + */ + include?: Prisma.ProfileInclude | null + /** + * Filter, which Profile to fetch. + */ + where: Prisma.ProfileWhereUniqueInput +} + +/** + * Profile findFirst + */ +export type ProfileFindFirstArgs = { + /** + * Select specific fields to fetch from the Profile + */ + select?: Prisma.ProfileSelect | null + /** + * Omit specific fields from the Profile + */ + omit?: Prisma.ProfileOmit | null + /** + * Choose, which related nodes to fetch as well + */ + include?: Prisma.ProfileInclude | null + /** + * Filter, which Profile to fetch. + */ + where?: Prisma.ProfileWhereInput + /** + * {@link https://www.prisma.io/docs/concepts/components/prisma-client/sorting Sorting Docs} + * + * Determine the order of Profiles to fetch. + */ + orderBy?: Prisma.ProfileOrderByWithRelationInput | Prisma.ProfileOrderByWithRelationInput[] + /** + * {@link https://www.prisma.io/docs/concepts/components/prisma-client/pagination#cursor-based-pagination Cursor Docs} + * + * Sets the position for searching for Profiles. + */ + cursor?: Prisma.ProfileWhereUniqueInput + /** + * {@link https://www.prisma.io/docs/concepts/components/prisma-client/pagination Pagination Docs} + * + * Take `±n` Profiles 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` Profiles. + */ + skip?: number + /** + * {@link https://www.prisma.io/docs/concepts/components/prisma-client/distinct Distinct Docs} + * + * Filter by unique combinations of Profiles. + */ + distinct?: Prisma.ProfileScalarFieldEnum | Prisma.ProfileScalarFieldEnum[] +} + +/** + * Profile findFirstOrThrow + */ +export type ProfileFindFirstOrThrowArgs = { + /** + * Select specific fields to fetch from the Profile + */ + select?: Prisma.ProfileSelect | null + /** + * Omit specific fields from the Profile + */ + omit?: Prisma.ProfileOmit | null + /** + * Choose, which related nodes to fetch as well + */ + include?: Prisma.ProfileInclude | null + /** + * Filter, which Profile to fetch. + */ + where?: Prisma.ProfileWhereInput + /** + * {@link https://www.prisma.io/docs/concepts/components/prisma-client/sorting Sorting Docs} + * + * Determine the order of Profiles to fetch. + */ + orderBy?: Prisma.ProfileOrderByWithRelationInput | Prisma.ProfileOrderByWithRelationInput[] + /** + * {@link https://www.prisma.io/docs/concepts/components/prisma-client/pagination#cursor-based-pagination Cursor Docs} + * + * Sets the position for searching for Profiles. + */ + cursor?: Prisma.ProfileWhereUniqueInput + /** + * {@link https://www.prisma.io/docs/concepts/components/prisma-client/pagination Pagination Docs} + * + * Take `±n` Profiles 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` Profiles. + */ + skip?: number + /** + * {@link https://www.prisma.io/docs/concepts/components/prisma-client/distinct Distinct Docs} + * + * Filter by unique combinations of Profiles. + */ + distinct?: Prisma.ProfileScalarFieldEnum | Prisma.ProfileScalarFieldEnum[] +} + +/** + * Profile findMany + */ +export type ProfileFindManyArgs = { + /** + * Select specific fields to fetch from the Profile + */ + select?: Prisma.ProfileSelect | null + /** + * Omit specific fields from the Profile + */ + omit?: Prisma.ProfileOmit | null + /** + * Choose, which related nodes to fetch as well + */ + include?: Prisma.ProfileInclude | null + /** + * Filter, which Profiles to fetch. + */ + where?: Prisma.ProfileWhereInput + /** + * {@link https://www.prisma.io/docs/concepts/components/prisma-client/sorting Sorting Docs} + * + * Determine the order of Profiles to fetch. + */ + orderBy?: Prisma.ProfileOrderByWithRelationInput | Prisma.ProfileOrderByWithRelationInput[] + /** + * {@link https://www.prisma.io/docs/concepts/components/prisma-client/pagination#cursor-based-pagination Cursor Docs} + * + * Sets the position for listing Profiles. + */ + cursor?: Prisma.ProfileWhereUniqueInput + /** + * {@link https://www.prisma.io/docs/concepts/components/prisma-client/pagination Pagination Docs} + * + * Take `±n` Profiles 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` Profiles. + */ + skip?: number + distinct?: Prisma.ProfileScalarFieldEnum | Prisma.ProfileScalarFieldEnum[] +} + +/** + * Profile create + */ +export type ProfileCreateArgs = { + /** + * Select specific fields to fetch from the Profile + */ + select?: Prisma.ProfileSelect | null + /** + * Omit specific fields from the Profile + */ + omit?: Prisma.ProfileOmit | null + /** + * Choose, which related nodes to fetch as well + */ + include?: Prisma.ProfileInclude | null + /** + * The data needed to create a Profile. + */ + data: Prisma.XOR +} + +/** + * Profile createMany + */ +export type ProfileCreateManyArgs = { + /** + * The data used to create many Profiles. + */ + data: Prisma.ProfileCreateManyInput | Prisma.ProfileCreateManyInput[] + skipDuplicates?: boolean +} + +/** + * Profile createManyAndReturn + */ +export type ProfileCreateManyAndReturnArgs = { + /** + * Select specific fields to fetch from the Profile + */ + select?: Prisma.ProfileSelectCreateManyAndReturn | null + /** + * Omit specific fields from the Profile + */ + omit?: Prisma.ProfileOmit | null + /** + * The data used to create many Profiles. + */ + data: Prisma.ProfileCreateManyInput | Prisma.ProfileCreateManyInput[] + skipDuplicates?: boolean + /** + * Choose, which related nodes to fetch as well + */ + include?: Prisma.ProfileIncludeCreateManyAndReturn | null +} + +/** + * Profile update + */ +export type ProfileUpdateArgs = { + /** + * Select specific fields to fetch from the Profile + */ + select?: Prisma.ProfileSelect | null + /** + * Omit specific fields from the Profile + */ + omit?: Prisma.ProfileOmit | null + /** + * Choose, which related nodes to fetch as well + */ + include?: Prisma.ProfileInclude | null + /** + * The data needed to update a Profile. + */ + data: Prisma.XOR + /** + * Choose, which Profile to update. + */ + where: Prisma.ProfileWhereUniqueInput +} + +/** + * Profile updateMany + */ +export type ProfileUpdateManyArgs = { + /** + * The data used to update Profiles. + */ + data: Prisma.XOR + /** + * Filter which Profiles to update + */ + where?: Prisma.ProfileWhereInput + /** + * Limit how many Profiles to update. + */ + limit?: number +} + +/** + * Profile updateManyAndReturn + */ +export type ProfileUpdateManyAndReturnArgs = { + /** + * Select specific fields to fetch from the Profile + */ + select?: Prisma.ProfileSelectUpdateManyAndReturn | null + /** + * Omit specific fields from the Profile + */ + omit?: Prisma.ProfileOmit | null + /** + * The data used to update Profiles. + */ + data: Prisma.XOR + /** + * Filter which Profiles to update + */ + where?: Prisma.ProfileWhereInput + /** + * Limit how many Profiles to update. + */ + limit?: number + /** + * Choose, which related nodes to fetch as well + */ + include?: Prisma.ProfileIncludeUpdateManyAndReturn | null +} + +/** + * Profile upsert + */ +export type ProfileUpsertArgs = { + /** + * Select specific fields to fetch from the Profile + */ + select?: Prisma.ProfileSelect | null + /** + * Omit specific fields from the Profile + */ + omit?: Prisma.ProfileOmit | null + /** + * Choose, which related nodes to fetch as well + */ + include?: Prisma.ProfileInclude | null + /** + * The filter to search for the Profile to update in case it exists. + */ + where: Prisma.ProfileWhereUniqueInput + /** + * In case the Profile found by the `where` argument doesn't exist, create a new Profile with this data. + */ + create: Prisma.XOR + /** + * In case the Profile was found with the provided `where` argument, update it with this data. + */ + update: Prisma.XOR +} + +/** + * Profile delete + */ +export type ProfileDeleteArgs = { + /** + * Select specific fields to fetch from the Profile + */ + select?: Prisma.ProfileSelect | null + /** + * Omit specific fields from the Profile + */ + omit?: Prisma.ProfileOmit | null + /** + * Choose, which related nodes to fetch as well + */ + include?: Prisma.ProfileInclude | null + /** + * Filter which Profile to delete. + */ + where: Prisma.ProfileWhereUniqueInput +} + +/** + * Profile deleteMany + */ +export type ProfileDeleteManyArgs = { + /** + * Filter which Profiles to delete + */ + where?: Prisma.ProfileWhereInput + /** + * Limit how many Profiles to delete. + */ + limit?: number +} + +/** + * Profile.addresses + */ +export type Profile$addressesArgs = { + /** + * Select specific fields to fetch from the Address + */ + select?: Prisma.AddressSelect | null + /** + * Omit specific fields from the Address + */ + omit?: Prisma.AddressOmit | null + /** + * Choose, which related nodes to fetch as well + */ + include?: Prisma.AddressInclude | null + where?: Prisma.AddressWhereInput + orderBy?: Prisma.AddressOrderByWithRelationInput | Prisma.AddressOrderByWithRelationInput[] + cursor?: Prisma.AddressWhereUniqueInput + take?: number + skip?: number + distinct?: Prisma.AddressScalarFieldEnum | Prisma.AddressScalarFieldEnum[] +} + +/** + * Profile without action + */ +export type ProfileDefaultArgs = { + /** + * Select specific fields to fetch from the Profile + */ + select?: Prisma.ProfileSelect | null + /** + * Omit specific fields from the Profile + */ + omit?: Prisma.ProfileOmit | null + /** + * Choose, which related nodes to fetch as well + */ + include?: Prisma.ProfileInclude | null +} diff --git a/src/lib/generated/prisma/models/User.ts b/src/lib/generated/prisma/models/User.ts index 7a39b75..904f8fd 100644 --- a/src/lib/generated/prisma/models/User.ts +++ b/src/lib/generated/prisma/models/User.ts @@ -243,6 +243,7 @@ export type UserWhereInput = { role?: Prisma.XOR | null sessions?: Prisma.SessionListRelationFilter accounts?: Prisma.AccountListRelationFilter + profile?: Prisma.XOR | null } export type UserOrderByWithRelationInput = { @@ -257,6 +258,7 @@ export type UserOrderByWithRelationInput = { role?: Prisma.UserRoleOrderByWithRelationInput sessions?: Prisma.SessionOrderByRelationAggregateInput accounts?: Prisma.AccountOrderByRelationAggregateInput + profile?: Prisma.ProfileOrderByWithRelationInput } export type UserWhereUniqueInput = Prisma.AtLeast<{ @@ -274,6 +276,7 @@ export type UserWhereUniqueInput = Prisma.AtLeast<{ role?: Prisma.XOR | null sessions?: Prisma.SessionListRelationFilter accounts?: Prisma.AccountListRelationFilter + profile?: Prisma.XOR | null }, "id" | "email"> export type UserOrderByWithAggregationInput = { @@ -317,6 +320,7 @@ export type UserCreateInput = { role?: Prisma.UserRoleCreateNestedOneWithoutUsersInput sessions?: Prisma.SessionCreateNestedManyWithoutUserInput accounts?: Prisma.AccountCreateNestedManyWithoutUserInput + profile?: Prisma.ProfileCreateNestedOneWithoutUserInput } export type UserUncheckedCreateInput = { @@ -330,6 +334,7 @@ export type UserUncheckedCreateInput = { roleId?: number | null sessions?: Prisma.SessionUncheckedCreateNestedManyWithoutUserInput accounts?: Prisma.AccountUncheckedCreateNestedManyWithoutUserInput + profile?: Prisma.ProfileUncheckedCreateNestedOneWithoutUserInput } export type UserUpdateInput = { @@ -343,6 +348,7 @@ export type UserUpdateInput = { role?: Prisma.UserRoleUpdateOneWithoutUsersNestedInput sessions?: Prisma.SessionUpdateManyWithoutUserNestedInput accounts?: Prisma.AccountUpdateManyWithoutUserNestedInput + profile?: Prisma.ProfileUpdateOneWithoutUserNestedInput } export type UserUncheckedUpdateInput = { @@ -356,6 +362,7 @@ export type UserUncheckedUpdateInput = { roleId?: Prisma.NullableIntFieldUpdateOperationsInput | number | null sessions?: Prisma.SessionUncheckedUpdateManyWithoutUserNestedInput accounts?: Prisma.AccountUncheckedUpdateManyWithoutUserNestedInput + profile?: Prisma.ProfileUncheckedUpdateOneWithoutUserNestedInput } export type UserCreateManyInput = { @@ -470,6 +477,20 @@ export type NullableIntFieldUpdateOperationsInput = { divide?: number } +export type UserCreateNestedOneWithoutProfileInput = { + create?: Prisma.XOR + connectOrCreate?: Prisma.UserCreateOrConnectWithoutProfileInput + connect?: Prisma.UserWhereUniqueInput +} + +export type UserUpdateOneRequiredWithoutProfileNestedInput = { + create?: Prisma.XOR + connectOrCreate?: Prisma.UserCreateOrConnectWithoutProfileInput + upsert?: Prisma.UserUpsertWithoutProfileInput + connect?: Prisma.UserWhereUniqueInput + update?: Prisma.XOR, Prisma.UserUncheckedUpdateWithoutProfileInput> +} + export type UserCreateNestedOneWithoutSessionsInput = { create?: Prisma.XOR connectOrCreate?: Prisma.UserCreateOrConnectWithoutSessionsInput @@ -540,6 +561,74 @@ export type UserUncheckedUpdateManyWithoutRoleNestedInput = { deleteMany?: Prisma.UserScalarWhereInput | Prisma.UserScalarWhereInput[] } +export type UserCreateWithoutProfileInput = { + 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 +} + +export type UserUncheckedCreateWithoutProfileInput = { + 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 +} + +export type UserCreateOrConnectWithoutProfileInput = { + where: Prisma.UserWhereUniqueInput + create: Prisma.XOR +} + +export type UserUpsertWithoutProfileInput = { + update: Prisma.XOR + create: Prisma.XOR + where?: Prisma.UserWhereInput +} + +export type UserUpdateToOneWithWhereWithoutProfileInput = { + where?: Prisma.UserWhereInput + data: Prisma.XOR +} + +export type UserUpdateWithoutProfileInput = { + 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 +} + +export type UserUncheckedUpdateWithoutProfileInput = { + 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 +} + export type UserCreateWithoutSessionsInput = { id: string name: string @@ -550,6 +639,7 @@ export type UserCreateWithoutSessionsInput = { updatedAt?: Date | string role?: Prisma.UserRoleCreateNestedOneWithoutUsersInput accounts?: Prisma.AccountCreateNestedManyWithoutUserInput + profile?: Prisma.ProfileCreateNestedOneWithoutUserInput } export type UserUncheckedCreateWithoutSessionsInput = { @@ -562,6 +652,7 @@ export type UserUncheckedCreateWithoutSessionsInput = { updatedAt?: Date | string roleId?: number | null accounts?: Prisma.AccountUncheckedCreateNestedManyWithoutUserInput + profile?: Prisma.ProfileUncheckedCreateNestedOneWithoutUserInput } export type UserCreateOrConnectWithoutSessionsInput = { @@ -590,6 +681,7 @@ export type UserUpdateWithoutSessionsInput = { updatedAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string role?: Prisma.UserRoleUpdateOneWithoutUsersNestedInput accounts?: Prisma.AccountUpdateManyWithoutUserNestedInput + profile?: Prisma.ProfileUpdateOneWithoutUserNestedInput } export type UserUncheckedUpdateWithoutSessionsInput = { @@ -602,6 +694,7 @@ export type UserUncheckedUpdateWithoutSessionsInput = { updatedAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string roleId?: Prisma.NullableIntFieldUpdateOperationsInput | number | null accounts?: Prisma.AccountUncheckedUpdateManyWithoutUserNestedInput + profile?: Prisma.ProfileUncheckedUpdateOneWithoutUserNestedInput } export type UserCreateWithoutAccountsInput = { @@ -614,6 +707,7 @@ export type UserCreateWithoutAccountsInput = { updatedAt?: Date | string role?: Prisma.UserRoleCreateNestedOneWithoutUsersInput sessions?: Prisma.SessionCreateNestedManyWithoutUserInput + profile?: Prisma.ProfileCreateNestedOneWithoutUserInput } export type UserUncheckedCreateWithoutAccountsInput = { @@ -626,6 +720,7 @@ export type UserUncheckedCreateWithoutAccountsInput = { updatedAt?: Date | string roleId?: number | null sessions?: Prisma.SessionUncheckedCreateNestedManyWithoutUserInput + profile?: Prisma.ProfileUncheckedCreateNestedOneWithoutUserInput } export type UserCreateOrConnectWithoutAccountsInput = { @@ -654,6 +749,7 @@ export type UserUpdateWithoutAccountsInput = { updatedAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string role?: Prisma.UserRoleUpdateOneWithoutUsersNestedInput sessions?: Prisma.SessionUpdateManyWithoutUserNestedInput + profile?: Prisma.ProfileUpdateOneWithoutUserNestedInput } export type UserUncheckedUpdateWithoutAccountsInput = { @@ -666,6 +762,7 @@ export type UserUncheckedUpdateWithoutAccountsInput = { updatedAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string roleId?: Prisma.NullableIntFieldUpdateOperationsInput | number | null sessions?: Prisma.SessionUncheckedUpdateManyWithoutUserNestedInput + profile?: Prisma.ProfileUncheckedUpdateOneWithoutUserNestedInput } export type UserCreateWithoutRoleInput = { @@ -678,6 +775,7 @@ export type UserCreateWithoutRoleInput = { updatedAt?: Date | string sessions?: Prisma.SessionCreateNestedManyWithoutUserInput accounts?: Prisma.AccountCreateNestedManyWithoutUserInput + profile?: Prisma.ProfileCreateNestedOneWithoutUserInput } export type UserUncheckedCreateWithoutRoleInput = { @@ -690,6 +788,7 @@ export type UserUncheckedCreateWithoutRoleInput = { updatedAt?: Date | string sessions?: Prisma.SessionUncheckedCreateNestedManyWithoutUserInput accounts?: Prisma.AccountUncheckedCreateNestedManyWithoutUserInput + profile?: Prisma.ProfileUncheckedCreateNestedOneWithoutUserInput } export type UserCreateOrConnectWithoutRoleInput = { @@ -752,6 +851,7 @@ export type UserUpdateWithoutRoleInput = { updatedAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string sessions?: Prisma.SessionUpdateManyWithoutUserNestedInput accounts?: Prisma.AccountUpdateManyWithoutUserNestedInput + profile?: Prisma.ProfileUpdateOneWithoutUserNestedInput } export type UserUncheckedUpdateWithoutRoleInput = { @@ -764,6 +864,7 @@ export type UserUncheckedUpdateWithoutRoleInput = { updatedAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string sessions?: Prisma.SessionUncheckedUpdateManyWithoutUserNestedInput accounts?: Prisma.AccountUncheckedUpdateManyWithoutUserNestedInput + profile?: Prisma.ProfileUncheckedUpdateOneWithoutUserNestedInput } export type UserUncheckedUpdateManyWithoutRoleInput = { @@ -828,6 +929,7 @@ export type UserSelect sessions?: boolean | Prisma.User$sessionsArgs accounts?: boolean | Prisma.User$accountsArgs + profile?: boolean | Prisma.User$profileArgs _count?: boolean | Prisma.UserCountOutputTypeDefaultArgs }, ExtArgs["result"]["user"]> @@ -871,6 +973,7 @@ export type UserInclude sessions?: boolean | Prisma.User$sessionsArgs accounts?: boolean | Prisma.User$accountsArgs + profile?: boolean | Prisma.User$profileArgs _count?: boolean | Prisma.UserCountOutputTypeDefaultArgs } export type UserIncludeCreateManyAndReturn = { @@ -886,6 +989,7 @@ export type $UserPayload | null sessions: Prisma.$SessionPayload[] accounts: Prisma.$AccountPayload[] + profile: Prisma.$ProfilePayload | null } scalars: runtime.Types.Extensions.GetPayloadResult<{ id: string @@ -1293,6 +1397,7 @@ export interface Prisma__UserClient = {}>(args?: Prisma.Subset>): Prisma.Prisma__UserRoleClient, T, "findUniqueOrThrow", GlobalOmitOptions> | null, null, ExtArgs, GlobalOmitOptions> sessions = {}>(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> /** * Attaches callbacks for the resolution and/or rejection of the Promise. * @param onfulfilled The callback to execute when the Promise is resolved. @@ -1792,6 +1897,25 @@ export type User$accountsArgs = { + /** + * Select specific fields to fetch from the Profile + */ + select?: Prisma.ProfileSelect | null + /** + * Omit specific fields from the Profile + */ + omit?: Prisma.ProfileOmit | null + /** + * Choose, which related nodes to fetch as well + */ + include?: Prisma.ProfileInclude | null + where?: Prisma.ProfileWhereInput +} + /** * User without action */ diff --git a/src/lib/utils.ts b/src/lib/utils.ts new file mode 100644 index 0000000..8dcdd12 --- /dev/null +++ b/src/lib/utils.ts @@ -0,0 +1,45 @@ +/** + * Formats a string of digits into a US phone number format. + * Handles incomplete numbers progressively. + * This function is designed to be used on the client, or + * when passing the phone number back to the client. + * + * @param number - The input string containing digits (and possibly other characters) + * @returns The formatted phone number, progressively formatted as digits are added + * + * @example + * clientFormatPhoneNumber("817") // "(817)" + * clientFormatPhoneNumber("8178") // "(817) 8" + * clientFormatPhoneNumber("8178888888") // "(817) 888-8888" + */ +export function clientFormatPhoneNumber(number: string): string { + const digits = number.replace(/\D/g, ''); + + if (digits.length === 0) { + return ''; + } + + if (digits.length <= 3) { + return `(${digits}`; + } + + if (digits.length <= 6) { + return `(${digits.slice(0, 3)}) ${digits.slice(3)}`; + } + + return `(${digits.slice(0, 3)}) ${digits.slice(3, 6)}-${digits.slice(6, 10)}`; +} + +/** + * Strips all non-digit characters from a phone number string. + * This function is designed to be used on the server only. + * + * @param number - The input string containing a formatted phone number + * @returns Only the numeric digits as a string + * + * @example + * serverFormatPhoneNumber("(817) 888-8888") // "8178888888" + */ +export function serverFormatPhoneNumber(number: string): string { + return number.replace(/\D/g, ''); +} diff --git a/src/routes/(protected)/account/+page.server.ts b/src/routes/(protected)/account/+page.server.ts new file mode 100644 index 0000000..2027c91 --- /dev/null +++ b/src/routes/(protected)/account/+page.server.ts @@ -0,0 +1,23 @@ +import type { PageServerLoad } from './$types'; +import { prisma } from '$lib/db'; +import { error, redirect } from '@sveltejs/kit'; + +export const load: PageServerLoad = async ({ locals }) => { + const user = await prisma.user.findUnique({ + where: { + id: locals.user?.id + }, + include: { + profile: true + } + }); + + if (user) { + if (!user?.profile) { + throw redirect(403, '/account/setup'); + } + return { user }; + } else { + throw error(403, 'not authorized'); + } +}; diff --git a/src/routes/(protected)/account/+page.svelte b/src/routes/(protected)/account/+page.svelte new file mode 100644 index 0000000..5f1109b --- /dev/null +++ b/src/routes/(protected)/account/+page.svelte @@ -0,0 +1,5 @@ + \ No newline at end of file diff --git a/src/routes/account/setup/+page.server.ts b/src/routes/account/setup/+page.server.ts index 9911860..55ee8fc 100644 --- a/src/routes/account/setup/+page.server.ts +++ b/src/routes/account/setup/+page.server.ts @@ -1,6 +1,7 @@ import type { PageServerLoad } from './$types'; -import { error } from '@sveltejs/kit'; +import { error, fail, isRedirect, redirect, type Actions } from '@sveltejs/kit'; import { prisma } from '$lib/db'; +import { serverFormatPhoneNumber } from '$lib/utils'; // Tell the page what to do when it loads export const load: PageServerLoad = async ({ locals }) => { @@ -15,3 +16,36 @@ export const load: PageServerLoad = async ({ locals }) => { return { user }; }; + +export const actions: Actions = { + default: async ({ request }) => { + const data = await request.formData(); + const userID = data.get('userId') as string; + const firstName = data.get('firstName') as string; + const lastName = data.get('lastName') as string; + const phoneNumber = serverFormatPhoneNumber(data.get('phoneNumber') as string); + + try { + const profile = await prisma.profile.create({ + data: { + userId: userID, + firstName: firstName, + lastName: lastName, + phoneNumber: phoneNumber + } + }); + + if (profile) { + console.log(`created profile: ${JSON.stringify(profile)}`); + throw redirect(303, '/account'); + } else { + return fail(400); + } + } catch (err) { + if (!isRedirect(err)) { + console.log(err); + throw error(400, 'bad request'); + } + } + } +}; diff --git a/src/routes/account/setup/+page.svelte b/src/routes/account/setup/+page.svelte index 52d0323..c61212d 100644 --- a/src/routes/account/setup/+page.svelte +++ b/src/routes/account/setup/+page.svelte @@ -1,12 +1,54 @@ - -
-

- Account Setup -

-
\ No newline at end of file + +
+

Please finish setting up your profile

+ {#if data.user?.image} + Profile + {:else} +
+ {/if} +

{data.user?.email}

+
+ + + + +
+ +
+
\ No newline at end of file