From 0781de5966f9be12f4042fe6faaa3a347b6c92c1 Mon Sep 17 00:00:00 2001 From: Dustin Do Date: Mon, 23 Sep 2024 11:18:32 +0700 Subject: [PATCH] feat(api): add user metadata with timezone --- .../migration.sql | 16 + apps/api/prisma/schema.prisma | 12 + apps/api/v1/routes/users.ts | 129 ++-- apps/api/v1/services/user-metadata.service.ts | 49 ++ packages/validation/src/prisma/index.ts | 605 +++++++++++++++++- packages/validation/src/user.zod.ts | 6 +- 6 files changed, 734 insertions(+), 83 deletions(-) create mode 100644 apps/api/prisma/migrations/20240923035535_add_usermetadata/migration.sql create mode 100644 apps/api/v1/services/user-metadata.service.ts diff --git a/apps/api/prisma/migrations/20240923035535_add_usermetadata/migration.sql b/apps/api/prisma/migrations/20240923035535_add_usermetadata/migration.sql new file mode 100644 index 00000000..ce983b35 --- /dev/null +++ b/apps/api/prisma/migrations/20240923035535_add_usermetadata/migration.sql @@ -0,0 +1,16 @@ +-- CreateTable +CREATE TABLE "UserMetadata" ( + "id" TEXT NOT NULL, + "createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP, + "updatedAt" TIMESTAMP(3) NOT NULL, + "userId" TEXT NOT NULL, + "timezone" TEXT NOT NULL, + + CONSTRAINT "UserMetadata_pkey" PRIMARY KEY ("id") +); + +-- CreateIndex +CREATE UNIQUE INDEX "UserMetadata_userId_key" ON "UserMetadata"("userId"); + +-- AddForeignKey +ALTER TABLE "UserMetadata" ADD CONSTRAINT "UserMetadata_userId_fkey" FOREIGN KEY ("userId") REFERENCES "User"("id") ON DELETE CASCADE ON UPDATE CASCADE; diff --git a/apps/api/prisma/schema.prisma b/apps/api/prisma/schema.prisma index 26e5a8cd..c644a9fd 100644 --- a/apps/api/prisma/schema.prisma +++ b/apps/api/prisma/schema.prisma @@ -37,6 +37,18 @@ model User { createdFromInvitation BudgetUserInvitationResponse? categories Category[] uploadedBlobObjects BlobObject[] + metadata UserMetadata? +} + +model UserMetadata { + id String @id @default(cuid()) + createdAt DateTime @default(now()) + updatedAt DateTime @updatedAt + + userId String @unique + user User @relation(fields: [userId], references: [id], onDelete: Cascade) + + timezone String } model UserWalletAccount { diff --git a/apps/api/v1/routes/users.ts b/apps/api/v1/routes/users.ts index b7db467b..4017dbc0 100644 --- a/apps/api/v1/routes/users.ts +++ b/apps/api/v1/routes/users.ts @@ -1,60 +1,95 @@ -import { zCreateUser } from '@6pm/validation' +import { zCreateUser, zUpdateUserMetadata } from '@6pm/validation' import { zValidator } from '@hono/zod-validator' import { Hono } from 'hono' +import { z } from 'zod' import { getLogger } from '../../lib/log' import { getAuthUser } from '../middlewares/auth' import { bootstrapUserDefaultCategories } from '../services/category.service' import { deleteClerkUser } from '../services/clerk.service' +import { + canUserUpdateMetadata, + updateUserMetadata, +} from '../services/user-metadata.service' import { createUser } from '../services/user.service' import { bootstrapUserDefaultWalletAccounts } from '../services/wallet.service' import { zDeviceCurrencyHeader, zDeviceLanguageHeader } from './utils' -const router = new Hono().post( - '/', - zValidator('json', zCreateUser), - zDeviceLanguageHeader(), - zDeviceCurrencyHeader(), - async (c) => { - const existingUser = getAuthUser(c) - const deviceLanguage = c.req.valid('header')['x-device-language'] - const deviceCurrency = c.req.valid('header')['x-device-currency'] - const logger = getLogger('POST /users') - - if (existingUser) { - return c.json({ message: 'user already exists' }, 409) - } - - const userId = c.get('userId') - - if (!userId) { - logger.warn('Clerk userId not found from headers while creating user') - return c.json({ message: 'unauthorized' }, 401) - } - - const data = c.req.valid('json') - - try { - const user = await createUser({ data: { ...data, id: userId } }) - - // bootstrap user data - await Promise.all([ - bootstrapUserDefaultCategories({ user, language: deviceLanguage }), - bootstrapUserDefaultWalletAccounts({ - user, - preferredCurrency: deviceCurrency, - language: deviceLanguage, - }), - ]) - - return c.json(user, 201) - } catch (e) { - logger.error('Failed to create user %o', e) - - await deleteClerkUser(userId) - - return c.json({ userId, message: 'failed to create user', cause: e }, 500) - } - }, +const zUserIdParamValidator = zValidator( + 'param', + z.object({ userId: z.string() }), ) +const router = new Hono() + .post( + '/', + zValidator('json', zCreateUser), + zDeviceLanguageHeader(), + zDeviceCurrencyHeader(), + async (c) => { + const existingUser = getAuthUser(c) + const deviceLanguage = c.req.valid('header')['x-device-language'] + const deviceCurrency = c.req.valid('header')['x-device-currency'] + const logger = getLogger('POST /users') + + if (existingUser) { + return c.json({ message: 'user already exists' }, 409) + } + + const userId = c.get('userId') + + if (!userId) { + logger.warn('Clerk userId not found from headers while creating user') + return c.json({ message: 'unauthorized' }, 401) + } + + const data = c.req.valid('json') + + try { + const user = await createUser({ data: { ...data, id: userId } }) + + // bootstrap user data + await Promise.all([ + bootstrapUserDefaultCategories({ user, language: deviceLanguage }), + bootstrapUserDefaultWalletAccounts({ + user, + preferredCurrency: deviceCurrency, + language: deviceLanguage, + }), + ]) + + return c.json(user, 201) + } catch (e) { + logger.error('Failed to create user %o', e) + + await deleteClerkUser(userId) + + return c.json( + { userId, message: 'failed to create user', cause: e }, + 500, + ) + } + }, + ) + .put( + '/:userId/metadata', + zUserIdParamValidator, + zValidator('json', zUpdateUserMetadata), + async (c) => { + const { userId } = c.req.valid('param') + const user = getAuthUser(c) + const data = c.req.valid('json') + + if (!(user && canUserUpdateMetadata({ user, metadata: { userId } }))) { + return c.json({ message: 'unauthorized' }, 401) + } + + const updatedUser = await updateUserMetadata({ + userId, + data, + }) + + return c.json(updatedUser) + }, + ) + export default router diff --git a/apps/api/v1/services/user-metadata.service.ts b/apps/api/v1/services/user-metadata.service.ts new file mode 100644 index 00000000..1e1a0c73 --- /dev/null +++ b/apps/api/v1/services/user-metadata.service.ts @@ -0,0 +1,49 @@ +import type { User, UserMetadata } from '@prisma/client' +import prisma from '../../lib/prisma' +import { findUserById } from './user.service' + +/** + * Checks if the user can update the user metadata + * @returns true if the user can update the metadata, false otherwise + */ +export function canUserUpdateMetadata({ + user, + metadata, +}: { + /** The user who wants to update metadata */ + user: User + /** The target metadata to update */ + metadata: Pick +}) { + return user.id === metadata.userId +} + +/** + * Updates the user metadata + * @returns the updated user with metadata + */ +export async function updateUserMetadata({ + userId, + metadataId, + data, +}: { + /** The user id who wants to update metadata */ + userId: string + /** The target metadata to update */ + metadataId?: string + /** The data to update */ + data: { timezone: string } +}) { + const metadata = await prisma.userMetadata.upsert({ + where: { + id: metadataId, + }, + create: { + ...data, + userId, + }, + update: data, + }) + + return findUserById(metadata.userId) +} diff --git a/packages/validation/src/prisma/index.ts b/packages/validation/src/prisma/index.ts index 0e600993..c7ae4f1e 100644 --- a/packages/validation/src/prisma/index.ts +++ b/packages/validation/src/prisma/index.ts @@ -38,6 +38,8 @@ export const UserScalarFieldEnumSchema = z.enum(['id','createdAt','updatedAt','e export const RelationLoadStrategySchema = z.enum(['query','join']); +export const UserMetadataScalarFieldEnumSchema = z.enum(['id','createdAt','updatedAt','userId','timezone']); + export const UserWalletAccountScalarFieldEnumSchema = z.enum(['id','createdAt','updatedAt','name','icon','description','lastDigits','preferredCurrency','userId']); export const BudgetScalarFieldEnumSchema = z.enum(['id','createdAt','updatedAt','name','description','preferredCurrency','type']); @@ -114,6 +116,7 @@ export type UserRelations = { createdFromInvitation?: BudgetUserInvitationResponseWithRelations | null; categories: CategoryWithRelations[]; uploadedBlobObjects: BlobObjectWithRelations[]; + metadata?: UserMetadataWithRelations | null; }; export type UserWithRelations = z.infer & UserRelations @@ -126,6 +129,34 @@ export const UserWithRelationsSchema: z.ZodType = UserSchema. createdFromInvitation: z.lazy(() => BudgetUserInvitationResponseWithRelationsSchema).nullable(), categories: z.lazy(() => CategoryWithRelationsSchema).array(), uploadedBlobObjects: z.lazy(() => BlobObjectWithRelationsSchema).array(), + metadata: z.lazy(() => UserMetadataWithRelationsSchema).nullable(), +})) + +///////////////////////////////////////// +// USER METADATA SCHEMA +///////////////////////////////////////// + +export const UserMetadataSchema = z.object({ + id: z.string(), + createdAt: z.coerce.date(), + updatedAt: z.coerce.date(), + userId: z.string(), + timezone: z.string(), +}) + +export type UserMetadata = z.infer + +// USER METADATA RELATION SCHEMA +//------------------------------------------------------ + +export type UserMetadataRelations = { + user: UserWithRelations; +}; + +export type UserMetadataWithRelations = z.infer & UserMetadataRelations + +export const UserMetadataWithRelationsSchema: z.ZodType = UserMetadataSchema.merge(z.object({ + user: z.lazy(() => UserWithRelationsSchema), })) ///////////////////////////////////////// @@ -481,6 +512,7 @@ export const UserIncludeSchema: z.ZodType = z.object({ createdFromInvitation: z.union([z.boolean(),z.lazy(() => BudgetUserInvitationResponseArgsSchema)]).optional(), categories: z.union([z.boolean(),z.lazy(() => CategoryFindManyArgsSchema)]).optional(), uploadedBlobObjects: z.union([z.boolean(),z.lazy(() => BlobObjectFindManyArgsSchema)]).optional(), + metadata: z.union([z.boolean(),z.lazy(() => UserMetadataArgsSchema)]).optional(), _count: z.union([z.boolean(),z.lazy(() => UserCountOutputTypeArgsSchema)]).optional(), }).strict() @@ -518,9 +550,31 @@ export const UserSelectSchema: z.ZodType = z.object({ createdFromInvitation: z.union([z.boolean(),z.lazy(() => BudgetUserInvitationResponseArgsSchema)]).optional(), categories: z.union([z.boolean(),z.lazy(() => CategoryFindManyArgsSchema)]).optional(), uploadedBlobObjects: z.union([z.boolean(),z.lazy(() => BlobObjectFindManyArgsSchema)]).optional(), + metadata: z.union([z.boolean(),z.lazy(() => UserMetadataArgsSchema)]).optional(), _count: z.union([z.boolean(),z.lazy(() => UserCountOutputTypeArgsSchema)]).optional(), }).strict() +// USER METADATA +//------------------------------------------------------ + +export const UserMetadataIncludeSchema: z.ZodType = z.object({ + user: z.union([z.boolean(),z.lazy(() => UserArgsSchema)]).optional(), +}).strict() + +export const UserMetadataArgsSchema: z.ZodType = z.object({ + select: z.lazy(() => UserMetadataSelectSchema).optional(), + include: z.lazy(() => UserMetadataIncludeSchema).optional(), +}).strict(); + +export const UserMetadataSelectSchema: z.ZodType = z.object({ + id: z.boolean().optional(), + createdAt: z.boolean().optional(), + updatedAt: z.boolean().optional(), + userId: z.boolean().optional(), + timezone: z.boolean().optional(), + user: z.union([z.boolean(),z.lazy(() => UserArgsSchema)]).optional(), +}).strict() + // USER WALLET ACCOUNT //------------------------------------------------------ @@ -876,7 +930,8 @@ export const UserWhereInputSchema: z.ZodType = z.object({ createdBudgetUserInvitations: z.lazy(() => BudgetUserInvitationListRelationFilterSchema).optional(), createdFromInvitation: z.union([ z.lazy(() => BudgetUserInvitationResponseNullableRelationFilterSchema),z.lazy(() => BudgetUserInvitationResponseWhereInputSchema) ]).optional().nullable(), categories: z.lazy(() => CategoryListRelationFilterSchema).optional(), - uploadedBlobObjects: z.lazy(() => BlobObjectListRelationFilterSchema).optional() + uploadedBlobObjects: z.lazy(() => BlobObjectListRelationFilterSchema).optional(), + metadata: z.union([ z.lazy(() => UserMetadataNullableRelationFilterSchema),z.lazy(() => UserMetadataWhereInputSchema) ]).optional().nullable(), }).strict(); export const UserOrderByWithRelationInputSchema: z.ZodType = z.object({ @@ -894,7 +949,8 @@ export const UserOrderByWithRelationInputSchema: z.ZodType BudgetUserInvitationOrderByRelationAggregateInputSchema).optional(), createdFromInvitation: z.lazy(() => BudgetUserInvitationResponseOrderByWithRelationInputSchema).optional(), categories: z.lazy(() => CategoryOrderByRelationAggregateInputSchema).optional(), - uploadedBlobObjects: z.lazy(() => BlobObjectOrderByRelationAggregateInputSchema).optional() + uploadedBlobObjects: z.lazy(() => BlobObjectOrderByRelationAggregateInputSchema).optional(), + metadata: z.lazy(() => UserMetadataOrderByWithRelationInputSchema).optional() }).strict(); export const UserWhereUniqueInputSchema: z.ZodType = z.union([ @@ -927,7 +983,8 @@ export const UserWhereUniqueInputSchema: z.ZodType createdBudgetUserInvitations: z.lazy(() => BudgetUserInvitationListRelationFilterSchema).optional(), createdFromInvitation: z.union([ z.lazy(() => BudgetUserInvitationResponseNullableRelationFilterSchema),z.lazy(() => BudgetUserInvitationResponseWhereInputSchema) ]).optional().nullable(), categories: z.lazy(() => CategoryListRelationFilterSchema).optional(), - uploadedBlobObjects: z.lazy(() => BlobObjectListRelationFilterSchema).optional() + uploadedBlobObjects: z.lazy(() => BlobObjectListRelationFilterSchema).optional(), + metadata: z.union([ z.lazy(() => UserMetadataNullableRelationFilterSchema),z.lazy(() => UserMetadataWhereInputSchema) ]).optional().nullable(), }).strict()); export const UserOrderByWithAggregationInputSchema: z.ZodType = z.object({ @@ -958,6 +1015,73 @@ export const UserScalarWhereWithAggregatesInputSchema: z.ZodType StringNullableWithAggregatesFilterSchema),z.string() ]).optional().nullable(), }).strict(); +export const UserMetadataWhereInputSchema: z.ZodType = z.object({ + AND: z.union([ z.lazy(() => UserMetadataWhereInputSchema),z.lazy(() => UserMetadataWhereInputSchema).array() ]).optional(), + OR: z.lazy(() => UserMetadataWhereInputSchema).array().optional(), + NOT: z.union([ z.lazy(() => UserMetadataWhereInputSchema),z.lazy(() => UserMetadataWhereInputSchema).array() ]).optional(), + id: z.union([ z.lazy(() => StringFilterSchema),z.string() ]).optional(), + createdAt: z.union([ z.lazy(() => DateTimeFilterSchema),z.coerce.date() ]).optional(), + updatedAt: z.union([ z.lazy(() => DateTimeFilterSchema),z.coerce.date() ]).optional(), + userId: z.union([ z.lazy(() => StringFilterSchema),z.string() ]).optional(), + timezone: z.union([ z.lazy(() => StringFilterSchema),z.string() ]).optional(), + user: z.union([ z.lazy(() => UserRelationFilterSchema),z.lazy(() => UserWhereInputSchema) ]).optional(), +}).strict(); + +export const UserMetadataOrderByWithRelationInputSchema: z.ZodType = z.object({ + id: z.lazy(() => SortOrderSchema).optional(), + createdAt: z.lazy(() => SortOrderSchema).optional(), + updatedAt: z.lazy(() => SortOrderSchema).optional(), + userId: z.lazy(() => SortOrderSchema).optional(), + timezone: z.lazy(() => SortOrderSchema).optional(), + user: z.lazy(() => UserOrderByWithRelationInputSchema).optional() +}).strict(); + +export const UserMetadataWhereUniqueInputSchema: z.ZodType = z.union([ + z.object({ + id: z.string(), + userId: z.string() + }), + z.object({ + id: z.string(), + }), + z.object({ + userId: z.string(), + }), +]) +.and(z.object({ + id: z.string().optional(), + userId: z.string().optional(), + AND: z.union([ z.lazy(() => UserMetadataWhereInputSchema),z.lazy(() => UserMetadataWhereInputSchema).array() ]).optional(), + OR: z.lazy(() => UserMetadataWhereInputSchema).array().optional(), + NOT: z.union([ z.lazy(() => UserMetadataWhereInputSchema),z.lazy(() => UserMetadataWhereInputSchema).array() ]).optional(), + createdAt: z.union([ z.lazy(() => DateTimeFilterSchema),z.coerce.date() ]).optional(), + updatedAt: z.union([ z.lazy(() => DateTimeFilterSchema),z.coerce.date() ]).optional(), + timezone: z.union([ z.lazy(() => StringFilterSchema),z.string() ]).optional(), + user: z.union([ z.lazy(() => UserRelationFilterSchema),z.lazy(() => UserWhereInputSchema) ]).optional(), +}).strict()); + +export const UserMetadataOrderByWithAggregationInputSchema: z.ZodType = z.object({ + id: z.lazy(() => SortOrderSchema).optional(), + createdAt: z.lazy(() => SortOrderSchema).optional(), + updatedAt: z.lazy(() => SortOrderSchema).optional(), + userId: z.lazy(() => SortOrderSchema).optional(), + timezone: z.lazy(() => SortOrderSchema).optional(), + _count: z.lazy(() => UserMetadataCountOrderByAggregateInputSchema).optional(), + _max: z.lazy(() => UserMetadataMaxOrderByAggregateInputSchema).optional(), + _min: z.lazy(() => UserMetadataMinOrderByAggregateInputSchema).optional() +}).strict(); + +export const UserMetadataScalarWhereWithAggregatesInputSchema: z.ZodType = z.object({ + AND: z.union([ z.lazy(() => UserMetadataScalarWhereWithAggregatesInputSchema),z.lazy(() => UserMetadataScalarWhereWithAggregatesInputSchema).array() ]).optional(), + OR: z.lazy(() => UserMetadataScalarWhereWithAggregatesInputSchema).array().optional(), + NOT: z.union([ z.lazy(() => UserMetadataScalarWhereWithAggregatesInputSchema),z.lazy(() => UserMetadataScalarWhereWithAggregatesInputSchema).array() ]).optional(), + id: z.union([ z.lazy(() => StringWithAggregatesFilterSchema),z.string() ]).optional(), + createdAt: z.union([ z.lazy(() => DateTimeWithAggregatesFilterSchema),z.coerce.date() ]).optional(), + updatedAt: z.union([ z.lazy(() => DateTimeWithAggregatesFilterSchema),z.coerce.date() ]).optional(), + userId: z.union([ z.lazy(() => StringWithAggregatesFilterSchema),z.string() ]).optional(), + timezone: z.union([ z.lazy(() => StringWithAggregatesFilterSchema),z.string() ]).optional(), +}).strict(); + export const UserWalletAccountWhereInputSchema: z.ZodType = z.object({ AND: z.union([ z.lazy(() => UserWalletAccountWhereInputSchema),z.lazy(() => UserWalletAccountWhereInputSchema).array() ]).optional(), OR: z.lazy(() => UserWalletAccountWhereInputSchema).array().optional(), @@ -1890,7 +2014,8 @@ export const UserCreateInputSchema: z.ZodType = z.object createdBudgetUserInvitations: z.lazy(() => BudgetUserInvitationCreateNestedManyWithoutCreatedByUserInputSchema).optional(), createdFromInvitation: z.lazy(() => BudgetUserInvitationResponseCreateNestedOneWithoutCreatedUserInputSchema).optional(), categories: z.lazy(() => CategoryCreateNestedManyWithoutUserInputSchema).optional(), - uploadedBlobObjects: z.lazy(() => BlobObjectCreateNestedManyWithoutUploadedByUserInputSchema).optional() + uploadedBlobObjects: z.lazy(() => BlobObjectCreateNestedManyWithoutUploadedByUserInputSchema).optional(), + metadata: z.lazy(() => UserMetadataCreateNestedOneWithoutUserInputSchema).optional() }).strict(); export const UserUncheckedCreateInputSchema: z.ZodType = z.object({ @@ -1908,7 +2033,8 @@ export const UserUncheckedCreateInputSchema: z.ZodType BudgetUserInvitationUncheckedCreateNestedManyWithoutCreatedByUserInputSchema).optional(), createdFromInvitation: z.lazy(() => BudgetUserInvitationResponseUncheckedCreateNestedOneWithoutCreatedUserInputSchema).optional(), categories: z.lazy(() => CategoryUncheckedCreateNestedManyWithoutUserInputSchema).optional(), - uploadedBlobObjects: z.lazy(() => BlobObjectUncheckedCreateNestedManyWithoutUploadedByUserInputSchema).optional() + uploadedBlobObjects: z.lazy(() => BlobObjectUncheckedCreateNestedManyWithoutUploadedByUserInputSchema).optional(), + metadata: z.lazy(() => UserMetadataUncheckedCreateNestedOneWithoutUserInputSchema).optional() }).strict(); export const UserUpdateInputSchema: z.ZodType = z.object({ @@ -1926,7 +2052,8 @@ export const UserUpdateInputSchema: z.ZodType = z.object createdBudgetUserInvitations: z.lazy(() => BudgetUserInvitationUpdateManyWithoutCreatedByUserNestedInputSchema).optional(), createdFromInvitation: z.lazy(() => BudgetUserInvitationResponseUpdateOneWithoutCreatedUserNestedInputSchema).optional(), categories: z.lazy(() => CategoryUpdateManyWithoutUserNestedInputSchema).optional(), - uploadedBlobObjects: z.lazy(() => BlobObjectUpdateManyWithoutUploadedByUserNestedInputSchema).optional() + uploadedBlobObjects: z.lazy(() => BlobObjectUpdateManyWithoutUploadedByUserNestedInputSchema).optional(), + metadata: z.lazy(() => UserMetadataUpdateOneWithoutUserNestedInputSchema).optional() }).strict(); export const UserUncheckedUpdateInputSchema: z.ZodType = z.object({ @@ -1944,7 +2071,8 @@ export const UserUncheckedUpdateInputSchema: z.ZodType BudgetUserInvitationUncheckedUpdateManyWithoutCreatedByUserNestedInputSchema).optional(), createdFromInvitation: z.lazy(() => BudgetUserInvitationResponseUncheckedUpdateOneWithoutCreatedUserNestedInputSchema).optional(), categories: z.lazy(() => CategoryUncheckedUpdateManyWithoutUserNestedInputSchema).optional(), - uploadedBlobObjects: z.lazy(() => BlobObjectUncheckedUpdateManyWithoutUploadedByUserNestedInputSchema).optional() + uploadedBlobObjects: z.lazy(() => BlobObjectUncheckedUpdateManyWithoutUploadedByUserNestedInputSchema).optional(), + metadata: z.lazy(() => UserMetadataUncheckedUpdateOneWithoutUserNestedInputSchema).optional() }).strict(); export const UserCreateManyInputSchema: z.ZodType = z.object({ @@ -1980,6 +2108,61 @@ export const UserUncheckedUpdateManyInputSchema: z.ZodType NullableStringFieldUpdateOperationsInputSchema) ]).optional().nullable(), }).strict(); +export const UserMetadataCreateInputSchema: z.ZodType = z.object({ + id: z.string().optional(), + createdAt: z.coerce.date().optional(), + updatedAt: z.coerce.date().optional(), + timezone: z.string(), + user: z.lazy(() => UserCreateNestedOneWithoutMetadataInputSchema) +}).strict(); + +export const UserMetadataUncheckedCreateInputSchema: z.ZodType = z.object({ + id: z.string().optional(), + createdAt: z.coerce.date().optional(), + updatedAt: z.coerce.date().optional(), + userId: z.string(), + timezone: z.string() +}).strict(); + +export const UserMetadataUpdateInputSchema: z.ZodType = z.object({ + id: z.union([ z.string(),z.lazy(() => StringFieldUpdateOperationsInputSchema) ]).optional(), + createdAt: z.union([ z.coerce.date(),z.lazy(() => DateTimeFieldUpdateOperationsInputSchema) ]).optional(), + updatedAt: z.union([ z.coerce.date(),z.lazy(() => DateTimeFieldUpdateOperationsInputSchema) ]).optional(), + timezone: z.union([ z.string(),z.lazy(() => StringFieldUpdateOperationsInputSchema) ]).optional(), + user: z.lazy(() => UserUpdateOneRequiredWithoutMetadataNestedInputSchema).optional() +}).strict(); + +export const UserMetadataUncheckedUpdateInputSchema: z.ZodType = z.object({ + id: z.union([ z.string(),z.lazy(() => StringFieldUpdateOperationsInputSchema) ]).optional(), + createdAt: z.union([ z.coerce.date(),z.lazy(() => DateTimeFieldUpdateOperationsInputSchema) ]).optional(), + updatedAt: z.union([ z.coerce.date(),z.lazy(() => DateTimeFieldUpdateOperationsInputSchema) ]).optional(), + userId: z.union([ z.string(),z.lazy(() => StringFieldUpdateOperationsInputSchema) ]).optional(), + timezone: z.union([ z.string(),z.lazy(() => StringFieldUpdateOperationsInputSchema) ]).optional(), +}).strict(); + +export const UserMetadataCreateManyInputSchema: z.ZodType = z.object({ + id: z.string().optional(), + createdAt: z.coerce.date().optional(), + updatedAt: z.coerce.date().optional(), + userId: z.string(), + timezone: z.string() +}).strict(); + +export const UserMetadataUpdateManyMutationInputSchema: z.ZodType = z.object({ + id: z.union([ z.string(),z.lazy(() => StringFieldUpdateOperationsInputSchema) ]).optional(), + createdAt: z.union([ z.coerce.date(),z.lazy(() => DateTimeFieldUpdateOperationsInputSchema) ]).optional(), + updatedAt: z.union([ z.coerce.date(),z.lazy(() => DateTimeFieldUpdateOperationsInputSchema) ]).optional(), + timezone: z.union([ z.string(),z.lazy(() => StringFieldUpdateOperationsInputSchema) ]).optional(), +}).strict(); + +export const UserMetadataUncheckedUpdateManyInputSchema: z.ZodType = z.object({ + id: z.union([ z.string(),z.lazy(() => StringFieldUpdateOperationsInputSchema) ]).optional(), + createdAt: z.union([ z.coerce.date(),z.lazy(() => DateTimeFieldUpdateOperationsInputSchema) ]).optional(), + updatedAt: z.union([ z.coerce.date(),z.lazy(() => DateTimeFieldUpdateOperationsInputSchema) ]).optional(), + userId: z.union([ z.string(),z.lazy(() => StringFieldUpdateOperationsInputSchema) ]).optional(), + timezone: z.union([ z.string(),z.lazy(() => StringFieldUpdateOperationsInputSchema) ]).optional(), +}).strict(); + export const UserWalletAccountCreateInputSchema: z.ZodType = z.object({ id: z.string().optional(), createdAt: z.coerce.date().optional(), @@ -2954,6 +3137,11 @@ export const BlobObjectListRelationFilterSchema: z.ZodType BlobObjectWhereInputSchema).optional() }).strict(); +export const UserMetadataNullableRelationFilterSchema: z.ZodType = z.object({ + is: z.lazy(() => UserMetadataWhereInputSchema).optional().nullable(), + isNot: z.lazy(() => UserMetadataWhereInputSchema).optional().nullable() +}).strict(); + export const SortOrderInputSchema: z.ZodType = z.object({ sort: z.lazy(() => SortOrderSchema), nulls: z.lazy(() => NullsOrderSchema).optional() @@ -3085,6 +3273,30 @@ export const UserRelationFilterSchema: z.ZodType = z. isNot: z.lazy(() => UserWhereInputSchema).optional() }).strict(); +export const UserMetadataCountOrderByAggregateInputSchema: z.ZodType = z.object({ + id: z.lazy(() => SortOrderSchema).optional(), + createdAt: z.lazy(() => SortOrderSchema).optional(), + updatedAt: z.lazy(() => SortOrderSchema).optional(), + userId: z.lazy(() => SortOrderSchema).optional(), + timezone: z.lazy(() => SortOrderSchema).optional() +}).strict(); + +export const UserMetadataMaxOrderByAggregateInputSchema: z.ZodType = z.object({ + id: z.lazy(() => SortOrderSchema).optional(), + createdAt: z.lazy(() => SortOrderSchema).optional(), + updatedAt: z.lazy(() => SortOrderSchema).optional(), + userId: z.lazy(() => SortOrderSchema).optional(), + timezone: z.lazy(() => SortOrderSchema).optional() +}).strict(); + +export const UserMetadataMinOrderByAggregateInputSchema: z.ZodType = z.object({ + id: z.lazy(() => SortOrderSchema).optional(), + createdAt: z.lazy(() => SortOrderSchema).optional(), + updatedAt: z.lazy(() => SortOrderSchema).optional(), + userId: z.lazy(() => SortOrderSchema).optional(), + timezone: z.lazy(() => SortOrderSchema).optional() +}).strict(); + export const UserWalletAccountCountOrderByAggregateInputSchema: z.ZodType = z.object({ id: z.lazy(() => SortOrderSchema).optional(), createdAt: z.lazy(() => SortOrderSchema).optional(), @@ -3716,6 +3928,12 @@ export const BlobObjectCreateNestedManyWithoutUploadedByUserInputSchema: z.ZodTy connect: z.union([ z.lazy(() => BlobObjectWhereUniqueInputSchema),z.lazy(() => BlobObjectWhereUniqueInputSchema).array() ]).optional(), }).strict(); +export const UserMetadataCreateNestedOneWithoutUserInputSchema: z.ZodType = z.object({ + create: z.union([ z.lazy(() => UserMetadataCreateWithoutUserInputSchema),z.lazy(() => UserMetadataUncheckedCreateWithoutUserInputSchema) ]).optional(), + connectOrCreate: z.lazy(() => UserMetadataCreateOrConnectWithoutUserInputSchema).optional(), + connect: z.lazy(() => UserMetadataWhereUniqueInputSchema).optional() +}).strict(); + export const UserWalletAccountUncheckedCreateNestedManyWithoutUserInputSchema: z.ZodType = z.object({ create: z.union([ z.lazy(() => UserWalletAccountCreateWithoutUserInputSchema),z.lazy(() => UserWalletAccountCreateWithoutUserInputSchema).array(),z.lazy(() => UserWalletAccountUncheckedCreateWithoutUserInputSchema),z.lazy(() => UserWalletAccountUncheckedCreateWithoutUserInputSchema).array() ]).optional(), connectOrCreate: z.union([ z.lazy(() => UserWalletAccountCreateOrConnectWithoutUserInputSchema),z.lazy(() => UserWalletAccountCreateOrConnectWithoutUserInputSchema).array() ]).optional(), @@ -3764,6 +3982,12 @@ export const BlobObjectUncheckedCreateNestedManyWithoutUploadedByUserInputSchema connect: z.union([ z.lazy(() => BlobObjectWhereUniqueInputSchema),z.lazy(() => BlobObjectWhereUniqueInputSchema).array() ]).optional(), }).strict(); +export const UserMetadataUncheckedCreateNestedOneWithoutUserInputSchema: z.ZodType = z.object({ + create: z.union([ z.lazy(() => UserMetadataCreateWithoutUserInputSchema),z.lazy(() => UserMetadataUncheckedCreateWithoutUserInputSchema) ]).optional(), + connectOrCreate: z.lazy(() => UserMetadataCreateOrConnectWithoutUserInputSchema).optional(), + connect: z.lazy(() => UserMetadataWhereUniqueInputSchema).optional() +}).strict(); + export const StringFieldUpdateOperationsInputSchema: z.ZodType = z.object({ set: z.string().optional() }).strict(); @@ -3874,6 +4098,16 @@ export const BlobObjectUpdateManyWithoutUploadedByUserNestedInputSchema: z.ZodTy deleteMany: z.union([ z.lazy(() => BlobObjectScalarWhereInputSchema),z.lazy(() => BlobObjectScalarWhereInputSchema).array() ]).optional(), }).strict(); +export const UserMetadataUpdateOneWithoutUserNestedInputSchema: z.ZodType = z.object({ + create: z.union([ z.lazy(() => UserMetadataCreateWithoutUserInputSchema),z.lazy(() => UserMetadataUncheckedCreateWithoutUserInputSchema) ]).optional(), + connectOrCreate: z.lazy(() => UserMetadataCreateOrConnectWithoutUserInputSchema).optional(), + upsert: z.lazy(() => UserMetadataUpsertWithoutUserInputSchema).optional(), + disconnect: z.union([ z.boolean(),z.lazy(() => UserMetadataWhereInputSchema) ]).optional(), + delete: z.union([ z.boolean(),z.lazy(() => UserMetadataWhereInputSchema) ]).optional(), + connect: z.lazy(() => UserMetadataWhereUniqueInputSchema).optional(), + update: z.union([ z.lazy(() => UserMetadataUpdateToOneWithWhereWithoutUserInputSchema),z.lazy(() => UserMetadataUpdateWithoutUserInputSchema),z.lazy(() => UserMetadataUncheckedUpdateWithoutUserInputSchema) ]).optional(), +}).strict(); + export const UserWalletAccountUncheckedUpdateManyWithoutUserNestedInputSchema: z.ZodType = z.object({ create: z.union([ z.lazy(() => UserWalletAccountCreateWithoutUserInputSchema),z.lazy(() => UserWalletAccountCreateWithoutUserInputSchema).array(),z.lazy(() => UserWalletAccountUncheckedCreateWithoutUserInputSchema),z.lazy(() => UserWalletAccountUncheckedCreateWithoutUserInputSchema).array() ]).optional(), connectOrCreate: z.union([ z.lazy(() => UserWalletAccountCreateOrConnectWithoutUserInputSchema),z.lazy(() => UserWalletAccountCreateOrConnectWithoutUserInputSchema).array() ]).optional(), @@ -3968,6 +4202,30 @@ export const BlobObjectUncheckedUpdateManyWithoutUploadedByUserNestedInputSchema deleteMany: z.union([ z.lazy(() => BlobObjectScalarWhereInputSchema),z.lazy(() => BlobObjectScalarWhereInputSchema).array() ]).optional(), }).strict(); +export const UserMetadataUncheckedUpdateOneWithoutUserNestedInputSchema: z.ZodType = z.object({ + create: z.union([ z.lazy(() => UserMetadataCreateWithoutUserInputSchema),z.lazy(() => UserMetadataUncheckedCreateWithoutUserInputSchema) ]).optional(), + connectOrCreate: z.lazy(() => UserMetadataCreateOrConnectWithoutUserInputSchema).optional(), + upsert: z.lazy(() => UserMetadataUpsertWithoutUserInputSchema).optional(), + disconnect: z.union([ z.boolean(),z.lazy(() => UserMetadataWhereInputSchema) ]).optional(), + delete: z.union([ z.boolean(),z.lazy(() => UserMetadataWhereInputSchema) ]).optional(), + connect: z.lazy(() => UserMetadataWhereUniqueInputSchema).optional(), + update: z.union([ z.lazy(() => UserMetadataUpdateToOneWithWhereWithoutUserInputSchema),z.lazy(() => UserMetadataUpdateWithoutUserInputSchema),z.lazy(() => UserMetadataUncheckedUpdateWithoutUserInputSchema) ]).optional(), +}).strict(); + +export const UserCreateNestedOneWithoutMetadataInputSchema: z.ZodType = z.object({ + create: z.union([ z.lazy(() => UserCreateWithoutMetadataInputSchema),z.lazy(() => UserUncheckedCreateWithoutMetadataInputSchema) ]).optional(), + connectOrCreate: z.lazy(() => UserCreateOrConnectWithoutMetadataInputSchema).optional(), + connect: z.lazy(() => UserWhereUniqueInputSchema).optional() +}).strict(); + +export const UserUpdateOneRequiredWithoutMetadataNestedInputSchema: z.ZodType = z.object({ + create: z.union([ z.lazy(() => UserCreateWithoutMetadataInputSchema),z.lazy(() => UserUncheckedCreateWithoutMetadataInputSchema) ]).optional(), + connectOrCreate: z.lazy(() => UserCreateOrConnectWithoutMetadataInputSchema).optional(), + upsert: z.lazy(() => UserUpsertWithoutMetadataInputSchema).optional(), + connect: z.lazy(() => UserWhereUniqueInputSchema).optional(), + update: z.union([ z.lazy(() => UserUpdateToOneWithWhereWithoutMetadataInputSchema),z.lazy(() => UserUpdateWithoutMetadataInputSchema),z.lazy(() => UserUncheckedUpdateWithoutMetadataInputSchema) ]).optional(), +}).strict(); + export const UserCreateNestedOneWithoutWalletAccountsInputSchema: z.ZodType = z.object({ create: z.union([ z.lazy(() => UserCreateWithoutWalletAccountsInputSchema),z.lazy(() => UserUncheckedCreateWithoutWalletAccountsInputSchema) ]).optional(), connectOrCreate: z.lazy(() => UserCreateOrConnectWithoutWalletAccountsInputSchema).optional(), @@ -5085,6 +5343,25 @@ export const BlobObjectCreateManyUploadedByUserInputEnvelopeSchema: z.ZodType = z.object({ + id: z.string().optional(), + createdAt: z.coerce.date().optional(), + updatedAt: z.coerce.date().optional(), + timezone: z.string() +}).strict(); + +export const UserMetadataUncheckedCreateWithoutUserInputSchema: z.ZodType = z.object({ + id: z.string().optional(), + createdAt: z.coerce.date().optional(), + updatedAt: z.coerce.date().optional(), + timezone: z.string() +}).strict(); + +export const UserMetadataCreateOrConnectWithoutUserInputSchema: z.ZodType = z.object({ + where: z.lazy(() => UserMetadataWhereUniqueInputSchema), + create: z.union([ z.lazy(() => UserMetadataCreateWithoutUserInputSchema),z.lazy(() => UserMetadataUncheckedCreateWithoutUserInputSchema) ]), +}).strict(); + export const UserWalletAccountUpsertWithWhereUniqueWithoutUserInputSchema: z.ZodType = z.object({ where: z.lazy(() => UserWalletAccountWhereUniqueInputSchema), update: z.union([ z.lazy(() => UserWalletAccountUpdateWithoutUserInputSchema),z.lazy(() => UserWalletAccountUncheckedUpdateWithoutUserInputSchema) ]), @@ -5302,7 +5579,32 @@ export const BlobObjectScalarWhereInputSchema: z.ZodType StringNullableFilterSchema),z.string() ]).optional().nullable(), }).strict(); -export const UserCreateWithoutWalletAccountsInputSchema: z.ZodType = z.object({ +export const UserMetadataUpsertWithoutUserInputSchema: z.ZodType = z.object({ + update: z.union([ z.lazy(() => UserMetadataUpdateWithoutUserInputSchema),z.lazy(() => UserMetadataUncheckedUpdateWithoutUserInputSchema) ]), + create: z.union([ z.lazy(() => UserMetadataCreateWithoutUserInputSchema),z.lazy(() => UserMetadataUncheckedCreateWithoutUserInputSchema) ]), + where: z.lazy(() => UserMetadataWhereInputSchema).optional() +}).strict(); + +export const UserMetadataUpdateToOneWithWhereWithoutUserInputSchema: z.ZodType = z.object({ + where: z.lazy(() => UserMetadataWhereInputSchema).optional(), + data: z.union([ z.lazy(() => UserMetadataUpdateWithoutUserInputSchema),z.lazy(() => UserMetadataUncheckedUpdateWithoutUserInputSchema) ]), +}).strict(); + +export const UserMetadataUpdateWithoutUserInputSchema: z.ZodType = z.object({ + id: z.union([ z.string(),z.lazy(() => StringFieldUpdateOperationsInputSchema) ]).optional(), + createdAt: z.union([ z.coerce.date(),z.lazy(() => DateTimeFieldUpdateOperationsInputSchema) ]).optional(), + updatedAt: z.union([ z.coerce.date(),z.lazy(() => DateTimeFieldUpdateOperationsInputSchema) ]).optional(), + timezone: z.union([ z.string(),z.lazy(() => StringFieldUpdateOperationsInputSchema) ]).optional(), +}).strict(); + +export const UserMetadataUncheckedUpdateWithoutUserInputSchema: z.ZodType = z.object({ + id: z.union([ z.string(),z.lazy(() => StringFieldUpdateOperationsInputSchema) ]).optional(), + createdAt: z.union([ z.coerce.date(),z.lazy(() => DateTimeFieldUpdateOperationsInputSchema) ]).optional(), + updatedAt: z.union([ z.coerce.date(),z.lazy(() => DateTimeFieldUpdateOperationsInputSchema) ]).optional(), + timezone: z.union([ z.string(),z.lazy(() => StringFieldUpdateOperationsInputSchema) ]).optional(), +}).strict(); + +export const UserCreateWithoutMetadataInputSchema: z.ZodType = z.object({ id: z.string().optional(), createdAt: z.coerce.date().optional(), updatedAt: z.coerce.date().optional(), @@ -5311,6 +5613,7 @@ export const UserCreateWithoutWalletAccountsInputSchema: z.ZodType UserWalletAccountCreateNestedManyWithoutUserInputSchema).optional(), budgetUsers: z.lazy(() => BudgetUserCreateNestedManyWithoutUserInputSchema).optional(), transactions: z.lazy(() => TransactionCreateNestedManyWithoutCreatedByUserInputSchema).optional(), createdBudgetUserInvitations: z.lazy(() => BudgetUserInvitationCreateNestedManyWithoutCreatedByUserInputSchema).optional(), @@ -5319,7 +5622,7 @@ export const UserCreateWithoutWalletAccountsInputSchema: z.ZodType BlobObjectCreateNestedManyWithoutUploadedByUserInputSchema).optional() }).strict(); -export const UserUncheckedCreateWithoutWalletAccountsInputSchema: z.ZodType = z.object({ +export const UserUncheckedCreateWithoutMetadataInputSchema: z.ZodType = z.object({ id: z.string().optional(), createdAt: z.coerce.date().optional(), updatedAt: z.coerce.date().optional(), @@ -5328,6 +5631,7 @@ export const UserUncheckedCreateWithoutWalletAccountsInputSchema: z.ZodType UserWalletAccountUncheckedCreateNestedManyWithoutUserInputSchema).optional(), budgetUsers: z.lazy(() => BudgetUserUncheckedCreateNestedManyWithoutUserInputSchema).optional(), transactions: z.lazy(() => TransactionUncheckedCreateNestedManyWithoutCreatedByUserInputSchema).optional(), createdBudgetUserInvitations: z.lazy(() => BudgetUserInvitationUncheckedCreateNestedManyWithoutCreatedByUserInputSchema).optional(), @@ -5336,6 +5640,94 @@ export const UserUncheckedCreateWithoutWalletAccountsInputSchema: z.ZodType BlobObjectUncheckedCreateNestedManyWithoutUploadedByUserInputSchema).optional() }).strict(); +export const UserCreateOrConnectWithoutMetadataInputSchema: z.ZodType = z.object({ + where: z.lazy(() => UserWhereUniqueInputSchema), + create: z.union([ z.lazy(() => UserCreateWithoutMetadataInputSchema),z.lazy(() => UserUncheckedCreateWithoutMetadataInputSchema) ]), +}).strict(); + +export const UserUpsertWithoutMetadataInputSchema: z.ZodType = z.object({ + update: z.union([ z.lazy(() => UserUpdateWithoutMetadataInputSchema),z.lazy(() => UserUncheckedUpdateWithoutMetadataInputSchema) ]), + create: z.union([ z.lazy(() => UserCreateWithoutMetadataInputSchema),z.lazy(() => UserUncheckedCreateWithoutMetadataInputSchema) ]), + where: z.lazy(() => UserWhereInputSchema).optional() +}).strict(); + +export const UserUpdateToOneWithWhereWithoutMetadataInputSchema: z.ZodType = z.object({ + where: z.lazy(() => UserWhereInputSchema).optional(), + data: z.union([ z.lazy(() => UserUpdateWithoutMetadataInputSchema),z.lazy(() => UserUncheckedUpdateWithoutMetadataInputSchema) ]), +}).strict(); + +export const UserUpdateWithoutMetadataInputSchema: z.ZodType = z.object({ + id: z.union([ z.string(),z.lazy(() => StringFieldUpdateOperationsInputSchema) ]).optional(), + createdAt: z.union([ z.coerce.date(),z.lazy(() => DateTimeFieldUpdateOperationsInputSchema) ]).optional(), + updatedAt: z.union([ z.coerce.date(),z.lazy(() => DateTimeFieldUpdateOperationsInputSchema) ]).optional(), + email: z.union([ z.string(),z.lazy(() => StringFieldUpdateOperationsInputSchema) ]).optional(), + name: z.union([ z.string(),z.lazy(() => NullableStringFieldUpdateOperationsInputSchema) ]).optional().nullable(), + entitlement: z.union([ z.string(),z.lazy(() => NullableStringFieldUpdateOperationsInputSchema) ]).optional().nullable(), + entitlementExpiresAt: z.union([ z.coerce.date(),z.lazy(() => NullableDateTimeFieldUpdateOperationsInputSchema) ]).optional().nullable(), + entitlementProductIdentifier: z.union([ z.string(),z.lazy(() => NullableStringFieldUpdateOperationsInputSchema) ]).optional().nullable(), + walletAccounts: z.lazy(() => UserWalletAccountUpdateManyWithoutUserNestedInputSchema).optional(), + budgetUsers: z.lazy(() => BudgetUserUpdateManyWithoutUserNestedInputSchema).optional(), + transactions: z.lazy(() => TransactionUpdateManyWithoutCreatedByUserNestedInputSchema).optional(), + createdBudgetUserInvitations: z.lazy(() => BudgetUserInvitationUpdateManyWithoutCreatedByUserNestedInputSchema).optional(), + createdFromInvitation: z.lazy(() => BudgetUserInvitationResponseUpdateOneWithoutCreatedUserNestedInputSchema).optional(), + categories: z.lazy(() => CategoryUpdateManyWithoutUserNestedInputSchema).optional(), + uploadedBlobObjects: z.lazy(() => BlobObjectUpdateManyWithoutUploadedByUserNestedInputSchema).optional() +}).strict(); + +export const UserUncheckedUpdateWithoutMetadataInputSchema: z.ZodType = z.object({ + id: z.union([ z.string(),z.lazy(() => StringFieldUpdateOperationsInputSchema) ]).optional(), + createdAt: z.union([ z.coerce.date(),z.lazy(() => DateTimeFieldUpdateOperationsInputSchema) ]).optional(), + updatedAt: z.union([ z.coerce.date(),z.lazy(() => DateTimeFieldUpdateOperationsInputSchema) ]).optional(), + email: z.union([ z.string(),z.lazy(() => StringFieldUpdateOperationsInputSchema) ]).optional(), + name: z.union([ z.string(),z.lazy(() => NullableStringFieldUpdateOperationsInputSchema) ]).optional().nullable(), + entitlement: z.union([ z.string(),z.lazy(() => NullableStringFieldUpdateOperationsInputSchema) ]).optional().nullable(), + entitlementExpiresAt: z.union([ z.coerce.date(),z.lazy(() => NullableDateTimeFieldUpdateOperationsInputSchema) ]).optional().nullable(), + entitlementProductIdentifier: z.union([ z.string(),z.lazy(() => NullableStringFieldUpdateOperationsInputSchema) ]).optional().nullable(), + walletAccounts: z.lazy(() => UserWalletAccountUncheckedUpdateManyWithoutUserNestedInputSchema).optional(), + budgetUsers: z.lazy(() => BudgetUserUncheckedUpdateManyWithoutUserNestedInputSchema).optional(), + transactions: z.lazy(() => TransactionUncheckedUpdateManyWithoutCreatedByUserNestedInputSchema).optional(), + createdBudgetUserInvitations: z.lazy(() => BudgetUserInvitationUncheckedUpdateManyWithoutCreatedByUserNestedInputSchema).optional(), + createdFromInvitation: z.lazy(() => BudgetUserInvitationResponseUncheckedUpdateOneWithoutCreatedUserNestedInputSchema).optional(), + categories: z.lazy(() => CategoryUncheckedUpdateManyWithoutUserNestedInputSchema).optional(), + uploadedBlobObjects: z.lazy(() => BlobObjectUncheckedUpdateManyWithoutUploadedByUserNestedInputSchema).optional() +}).strict(); + +export const UserCreateWithoutWalletAccountsInputSchema: z.ZodType = z.object({ + id: z.string().optional(), + createdAt: z.coerce.date().optional(), + updatedAt: z.coerce.date().optional(), + email: z.string(), + name: z.string().optional().nullable(), + entitlement: z.string().optional().nullable(), + entitlementExpiresAt: z.coerce.date().optional().nullable(), + entitlementProductIdentifier: z.string().optional().nullable(), + budgetUsers: z.lazy(() => BudgetUserCreateNestedManyWithoutUserInputSchema).optional(), + transactions: z.lazy(() => TransactionCreateNestedManyWithoutCreatedByUserInputSchema).optional(), + createdBudgetUserInvitations: z.lazy(() => BudgetUserInvitationCreateNestedManyWithoutCreatedByUserInputSchema).optional(), + createdFromInvitation: z.lazy(() => BudgetUserInvitationResponseCreateNestedOneWithoutCreatedUserInputSchema).optional(), + categories: z.lazy(() => CategoryCreateNestedManyWithoutUserInputSchema).optional(), + uploadedBlobObjects: z.lazy(() => BlobObjectCreateNestedManyWithoutUploadedByUserInputSchema).optional(), + metadata: z.lazy(() => UserMetadataCreateNestedOneWithoutUserInputSchema).optional() +}).strict(); + +export const UserUncheckedCreateWithoutWalletAccountsInputSchema: z.ZodType = z.object({ + id: z.string().optional(), + createdAt: z.coerce.date().optional(), + updatedAt: z.coerce.date().optional(), + email: z.string(), + name: z.string().optional().nullable(), + entitlement: z.string().optional().nullable(), + entitlementExpiresAt: z.coerce.date().optional().nullable(), + entitlementProductIdentifier: z.string().optional().nullable(), + budgetUsers: z.lazy(() => BudgetUserUncheckedCreateNestedManyWithoutUserInputSchema).optional(), + transactions: z.lazy(() => TransactionUncheckedCreateNestedManyWithoutCreatedByUserInputSchema).optional(), + createdBudgetUserInvitations: z.lazy(() => BudgetUserInvitationUncheckedCreateNestedManyWithoutCreatedByUserInputSchema).optional(), + createdFromInvitation: z.lazy(() => BudgetUserInvitationResponseUncheckedCreateNestedOneWithoutCreatedUserInputSchema).optional(), + categories: z.lazy(() => CategoryUncheckedCreateNestedManyWithoutUserInputSchema).optional(), + uploadedBlobObjects: z.lazy(() => BlobObjectUncheckedCreateNestedManyWithoutUploadedByUserInputSchema).optional(), + metadata: z.lazy(() => UserMetadataUncheckedCreateNestedOneWithoutUserInputSchema).optional() +}).strict(); + export const UserCreateOrConnectWithoutWalletAccountsInputSchema: z.ZodType = z.object({ where: z.lazy(() => UserWhereUniqueInputSchema), create: z.union([ z.lazy(() => UserCreateWithoutWalletAccountsInputSchema),z.lazy(() => UserUncheckedCreateWithoutWalletAccountsInputSchema) ]), @@ -5406,7 +5798,8 @@ export const UserUpdateWithoutWalletAccountsInputSchema: z.ZodType BudgetUserInvitationUpdateManyWithoutCreatedByUserNestedInputSchema).optional(), createdFromInvitation: z.lazy(() => BudgetUserInvitationResponseUpdateOneWithoutCreatedUserNestedInputSchema).optional(), categories: z.lazy(() => CategoryUpdateManyWithoutUserNestedInputSchema).optional(), - uploadedBlobObjects: z.lazy(() => BlobObjectUpdateManyWithoutUploadedByUserNestedInputSchema).optional() + uploadedBlobObjects: z.lazy(() => BlobObjectUpdateManyWithoutUploadedByUserNestedInputSchema).optional(), + metadata: z.lazy(() => UserMetadataUpdateOneWithoutUserNestedInputSchema).optional() }).strict(); export const UserUncheckedUpdateWithoutWalletAccountsInputSchema: z.ZodType = z.object({ @@ -5423,7 +5816,8 @@ export const UserUncheckedUpdateWithoutWalletAccountsInputSchema: z.ZodType BudgetUserInvitationUncheckedUpdateManyWithoutCreatedByUserNestedInputSchema).optional(), createdFromInvitation: z.lazy(() => BudgetUserInvitationResponseUncheckedUpdateOneWithoutCreatedUserNestedInputSchema).optional(), categories: z.lazy(() => CategoryUncheckedUpdateManyWithoutUserNestedInputSchema).optional(), - uploadedBlobObjects: z.lazy(() => BlobObjectUncheckedUpdateManyWithoutUploadedByUserNestedInputSchema).optional() + uploadedBlobObjects: z.lazy(() => BlobObjectUncheckedUpdateManyWithoutUploadedByUserNestedInputSchema).optional(), + metadata: z.lazy(() => UserMetadataUncheckedUpdateOneWithoutUserNestedInputSchema).optional() }).strict(); export const TransactionUpsertWithWhereUniqueWithoutWalletAccountInputSchema: z.ZodType = z.object({ @@ -5732,7 +6126,8 @@ export const UserCreateWithoutBudgetUsersInputSchema: z.ZodType BudgetUserInvitationCreateNestedManyWithoutCreatedByUserInputSchema).optional(), createdFromInvitation: z.lazy(() => BudgetUserInvitationResponseCreateNestedOneWithoutCreatedUserInputSchema).optional(), categories: z.lazy(() => CategoryCreateNestedManyWithoutUserInputSchema).optional(), - uploadedBlobObjects: z.lazy(() => BlobObjectCreateNestedManyWithoutUploadedByUserInputSchema).optional() + uploadedBlobObjects: z.lazy(() => BlobObjectCreateNestedManyWithoutUploadedByUserInputSchema).optional(), + metadata: z.lazy(() => UserMetadataCreateNestedOneWithoutUserInputSchema).optional() }).strict(); export const UserUncheckedCreateWithoutBudgetUsersInputSchema: z.ZodType = z.object({ @@ -5749,7 +6144,8 @@ export const UserUncheckedCreateWithoutBudgetUsersInputSchema: z.ZodType BudgetUserInvitationUncheckedCreateNestedManyWithoutCreatedByUserInputSchema).optional(), createdFromInvitation: z.lazy(() => BudgetUserInvitationResponseUncheckedCreateNestedOneWithoutCreatedUserInputSchema).optional(), categories: z.lazy(() => CategoryUncheckedCreateNestedManyWithoutUserInputSchema).optional(), - uploadedBlobObjects: z.lazy(() => BlobObjectUncheckedCreateNestedManyWithoutUploadedByUserInputSchema).optional() + uploadedBlobObjects: z.lazy(() => BlobObjectUncheckedCreateNestedManyWithoutUploadedByUserInputSchema).optional(), + metadata: z.lazy(() => UserMetadataUncheckedCreateNestedOneWithoutUserInputSchema).optional() }).strict(); export const UserCreateOrConnectWithoutBudgetUsersInputSchema: z.ZodType = z.object({ @@ -5813,7 +6209,8 @@ export const UserUpdateWithoutBudgetUsersInputSchema: z.ZodType BudgetUserInvitationUpdateManyWithoutCreatedByUserNestedInputSchema).optional(), createdFromInvitation: z.lazy(() => BudgetUserInvitationResponseUpdateOneWithoutCreatedUserNestedInputSchema).optional(), categories: z.lazy(() => CategoryUpdateManyWithoutUserNestedInputSchema).optional(), - uploadedBlobObjects: z.lazy(() => BlobObjectUpdateManyWithoutUploadedByUserNestedInputSchema).optional() + uploadedBlobObjects: z.lazy(() => BlobObjectUpdateManyWithoutUploadedByUserNestedInputSchema).optional(), + metadata: z.lazy(() => UserMetadataUpdateOneWithoutUserNestedInputSchema).optional() }).strict(); export const UserUncheckedUpdateWithoutBudgetUsersInputSchema: z.ZodType = z.object({ @@ -5830,7 +6227,8 @@ export const UserUncheckedUpdateWithoutBudgetUsersInputSchema: z.ZodType BudgetUserInvitationUncheckedUpdateManyWithoutCreatedByUserNestedInputSchema).optional(), createdFromInvitation: z.lazy(() => BudgetUserInvitationResponseUncheckedUpdateOneWithoutCreatedUserNestedInputSchema).optional(), categories: z.lazy(() => CategoryUncheckedUpdateManyWithoutUserNestedInputSchema).optional(), - uploadedBlobObjects: z.lazy(() => BlobObjectUncheckedUpdateManyWithoutUploadedByUserNestedInputSchema).optional() + uploadedBlobObjects: z.lazy(() => BlobObjectUncheckedUpdateManyWithoutUploadedByUserNestedInputSchema).optional(), + metadata: z.lazy(() => UserMetadataUncheckedUpdateOneWithoutUserNestedInputSchema).optional() }).strict(); export const BudgetUpsertWithoutBudgetUsersInputSchema: z.ZodType = z.object({ @@ -5884,7 +6282,8 @@ export const UserCreateWithoutCreatedBudgetUserInvitationsInputSchema: z.ZodType transactions: z.lazy(() => TransactionCreateNestedManyWithoutCreatedByUserInputSchema).optional(), createdFromInvitation: z.lazy(() => BudgetUserInvitationResponseCreateNestedOneWithoutCreatedUserInputSchema).optional(), categories: z.lazy(() => CategoryCreateNestedManyWithoutUserInputSchema).optional(), - uploadedBlobObjects: z.lazy(() => BlobObjectCreateNestedManyWithoutUploadedByUserInputSchema).optional() + uploadedBlobObjects: z.lazy(() => BlobObjectCreateNestedManyWithoutUploadedByUserInputSchema).optional(), + metadata: z.lazy(() => UserMetadataCreateNestedOneWithoutUserInputSchema).optional() }).strict(); export const UserUncheckedCreateWithoutCreatedBudgetUserInvitationsInputSchema: z.ZodType = z.object({ @@ -5901,7 +6300,8 @@ export const UserUncheckedCreateWithoutCreatedBudgetUserInvitationsInputSchema: transactions: z.lazy(() => TransactionUncheckedCreateNestedManyWithoutCreatedByUserInputSchema).optional(), createdFromInvitation: z.lazy(() => BudgetUserInvitationResponseUncheckedCreateNestedOneWithoutCreatedUserInputSchema).optional(), categories: z.lazy(() => CategoryUncheckedCreateNestedManyWithoutUserInputSchema).optional(), - uploadedBlobObjects: z.lazy(() => BlobObjectUncheckedCreateNestedManyWithoutUploadedByUserInputSchema).optional() + uploadedBlobObjects: z.lazy(() => BlobObjectUncheckedCreateNestedManyWithoutUploadedByUserInputSchema).optional(), + metadata: z.lazy(() => UserMetadataUncheckedCreateNestedOneWithoutUserInputSchema).optional() }).strict(); export const UserCreateOrConnectWithoutCreatedBudgetUserInvitationsInputSchema: z.ZodType = z.object({ @@ -5993,7 +6393,8 @@ export const UserUpdateWithoutCreatedBudgetUserInvitationsInputSchema: z.ZodType transactions: z.lazy(() => TransactionUpdateManyWithoutCreatedByUserNestedInputSchema).optional(), createdFromInvitation: z.lazy(() => BudgetUserInvitationResponseUpdateOneWithoutCreatedUserNestedInputSchema).optional(), categories: z.lazy(() => CategoryUpdateManyWithoutUserNestedInputSchema).optional(), - uploadedBlobObjects: z.lazy(() => BlobObjectUpdateManyWithoutUploadedByUserNestedInputSchema).optional() + uploadedBlobObjects: z.lazy(() => BlobObjectUpdateManyWithoutUploadedByUserNestedInputSchema).optional(), + metadata: z.lazy(() => UserMetadataUpdateOneWithoutUserNestedInputSchema).optional() }).strict(); export const UserUncheckedUpdateWithoutCreatedBudgetUserInvitationsInputSchema: z.ZodType = z.object({ @@ -6010,7 +6411,8 @@ export const UserUncheckedUpdateWithoutCreatedBudgetUserInvitationsInputSchema: transactions: z.lazy(() => TransactionUncheckedUpdateManyWithoutCreatedByUserNestedInputSchema).optional(), createdFromInvitation: z.lazy(() => BudgetUserInvitationResponseUncheckedUpdateOneWithoutCreatedUserNestedInputSchema).optional(), categories: z.lazy(() => CategoryUncheckedUpdateManyWithoutUserNestedInputSchema).optional(), - uploadedBlobObjects: z.lazy(() => BlobObjectUncheckedUpdateManyWithoutUploadedByUserNestedInputSchema).optional() + uploadedBlobObjects: z.lazy(() => BlobObjectUncheckedUpdateManyWithoutUploadedByUserNestedInputSchema).optional(), + metadata: z.lazy(() => UserMetadataUncheckedUpdateOneWithoutUserNestedInputSchema).optional() }).strict(); export const BudgetUpsertWithoutInvitationsInputSchema: z.ZodType = z.object({ @@ -6122,7 +6524,8 @@ export const UserCreateWithoutCreatedFromInvitationInputSchema: z.ZodType TransactionCreateNestedManyWithoutCreatedByUserInputSchema).optional(), createdBudgetUserInvitations: z.lazy(() => BudgetUserInvitationCreateNestedManyWithoutCreatedByUserInputSchema).optional(), categories: z.lazy(() => CategoryCreateNestedManyWithoutUserInputSchema).optional(), - uploadedBlobObjects: z.lazy(() => BlobObjectCreateNestedManyWithoutUploadedByUserInputSchema).optional() + uploadedBlobObjects: z.lazy(() => BlobObjectCreateNestedManyWithoutUploadedByUserInputSchema).optional(), + metadata: z.lazy(() => UserMetadataCreateNestedOneWithoutUserInputSchema).optional() }).strict(); export const UserUncheckedCreateWithoutCreatedFromInvitationInputSchema: z.ZodType = z.object({ @@ -6139,7 +6542,8 @@ export const UserUncheckedCreateWithoutCreatedFromInvitationInputSchema: z.ZodTy transactions: z.lazy(() => TransactionUncheckedCreateNestedManyWithoutCreatedByUserInputSchema).optional(), createdBudgetUserInvitations: z.lazy(() => BudgetUserInvitationUncheckedCreateNestedManyWithoutCreatedByUserInputSchema).optional(), categories: z.lazy(() => CategoryUncheckedCreateNestedManyWithoutUserInputSchema).optional(), - uploadedBlobObjects: z.lazy(() => BlobObjectUncheckedCreateNestedManyWithoutUploadedByUserInputSchema).optional() + uploadedBlobObjects: z.lazy(() => BlobObjectUncheckedCreateNestedManyWithoutUploadedByUserInputSchema).optional(), + metadata: z.lazy(() => UserMetadataUncheckedCreateNestedOneWithoutUserInputSchema).optional() }).strict(); export const UserCreateOrConnectWithoutCreatedFromInvitationInputSchema: z.ZodType = z.object({ @@ -6207,7 +6611,8 @@ export const UserUpdateWithoutCreatedFromInvitationInputSchema: z.ZodType TransactionUpdateManyWithoutCreatedByUserNestedInputSchema).optional(), createdBudgetUserInvitations: z.lazy(() => BudgetUserInvitationUpdateManyWithoutCreatedByUserNestedInputSchema).optional(), categories: z.lazy(() => CategoryUpdateManyWithoutUserNestedInputSchema).optional(), - uploadedBlobObjects: z.lazy(() => BlobObjectUpdateManyWithoutUploadedByUserNestedInputSchema).optional() + uploadedBlobObjects: z.lazy(() => BlobObjectUpdateManyWithoutUploadedByUserNestedInputSchema).optional(), + metadata: z.lazy(() => UserMetadataUpdateOneWithoutUserNestedInputSchema).optional() }).strict(); export const UserUncheckedUpdateWithoutCreatedFromInvitationInputSchema: z.ZodType = z.object({ @@ -6224,7 +6629,8 @@ export const UserUncheckedUpdateWithoutCreatedFromInvitationInputSchema: z.ZodTy transactions: z.lazy(() => TransactionUncheckedUpdateManyWithoutCreatedByUserNestedInputSchema).optional(), createdBudgetUserInvitations: z.lazy(() => BudgetUserInvitationUncheckedUpdateManyWithoutCreatedByUserNestedInputSchema).optional(), categories: z.lazy(() => CategoryUncheckedUpdateManyWithoutUserNestedInputSchema).optional(), - uploadedBlobObjects: z.lazy(() => BlobObjectUncheckedUpdateManyWithoutUploadedByUserNestedInputSchema).optional() + uploadedBlobObjects: z.lazy(() => BlobObjectUncheckedUpdateManyWithoutUploadedByUserNestedInputSchema).optional(), + metadata: z.lazy(() => UserMetadataUncheckedUpdateOneWithoutUserNestedInputSchema).optional() }).strict(); export const CategoryCreateWithoutTransactionsInputSchema: z.ZodType = z.object({ @@ -6334,7 +6740,8 @@ export const UserCreateWithoutTransactionsInputSchema: z.ZodType BudgetUserInvitationCreateNestedManyWithoutCreatedByUserInputSchema).optional(), createdFromInvitation: z.lazy(() => BudgetUserInvitationResponseCreateNestedOneWithoutCreatedUserInputSchema).optional(), categories: z.lazy(() => CategoryCreateNestedManyWithoutUserInputSchema).optional(), - uploadedBlobObjects: z.lazy(() => BlobObjectCreateNestedManyWithoutUploadedByUserInputSchema).optional() + uploadedBlobObjects: z.lazy(() => BlobObjectCreateNestedManyWithoutUploadedByUserInputSchema).optional(), + metadata: z.lazy(() => UserMetadataCreateNestedOneWithoutUserInputSchema).optional() }).strict(); export const UserUncheckedCreateWithoutTransactionsInputSchema: z.ZodType = z.object({ @@ -6351,7 +6758,8 @@ export const UserUncheckedCreateWithoutTransactionsInputSchema: z.ZodType BudgetUserInvitationUncheckedCreateNestedManyWithoutCreatedByUserInputSchema).optional(), createdFromInvitation: z.lazy(() => BudgetUserInvitationResponseUncheckedCreateNestedOneWithoutCreatedUserInputSchema).optional(), categories: z.lazy(() => CategoryUncheckedCreateNestedManyWithoutUserInputSchema).optional(), - uploadedBlobObjects: z.lazy(() => BlobObjectUncheckedCreateNestedManyWithoutUploadedByUserInputSchema).optional() + uploadedBlobObjects: z.lazy(() => BlobObjectUncheckedCreateNestedManyWithoutUploadedByUserInputSchema).optional(), + metadata: z.lazy(() => UserMetadataUncheckedCreateNestedOneWithoutUserInputSchema).optional() }).strict(); export const UserCreateOrConnectWithoutTransactionsInputSchema: z.ZodType = z.object({ @@ -6529,7 +6937,8 @@ export const UserUpdateWithoutTransactionsInputSchema: z.ZodType BudgetUserInvitationUpdateManyWithoutCreatedByUserNestedInputSchema).optional(), createdFromInvitation: z.lazy(() => BudgetUserInvitationResponseUpdateOneWithoutCreatedUserNestedInputSchema).optional(), categories: z.lazy(() => CategoryUpdateManyWithoutUserNestedInputSchema).optional(), - uploadedBlobObjects: z.lazy(() => BlobObjectUpdateManyWithoutUploadedByUserNestedInputSchema).optional() + uploadedBlobObjects: z.lazy(() => BlobObjectUpdateManyWithoutUploadedByUserNestedInputSchema).optional(), + metadata: z.lazy(() => UserMetadataUpdateOneWithoutUserNestedInputSchema).optional() }).strict(); export const UserUncheckedUpdateWithoutTransactionsInputSchema: z.ZodType = z.object({ @@ -6546,7 +6955,8 @@ export const UserUncheckedUpdateWithoutTransactionsInputSchema: z.ZodType BudgetUserInvitationUncheckedUpdateManyWithoutCreatedByUserNestedInputSchema).optional(), createdFromInvitation: z.lazy(() => BudgetUserInvitationResponseUncheckedUpdateOneWithoutCreatedUserNestedInputSchema).optional(), categories: z.lazy(() => CategoryUncheckedUpdateManyWithoutUserNestedInputSchema).optional(), - uploadedBlobObjects: z.lazy(() => BlobObjectUncheckedUpdateManyWithoutUploadedByUserNestedInputSchema).optional() + uploadedBlobObjects: z.lazy(() => BlobObjectUncheckedUpdateManyWithoutUploadedByUserNestedInputSchema).optional(), + metadata: z.lazy(() => UserMetadataUncheckedUpdateOneWithoutUserNestedInputSchema).optional() }).strict(); export const BlobObjectUpsertWithWhereUniqueWithoutTransactionInputSchema: z.ZodType = z.object({ @@ -6579,7 +6989,8 @@ export const UserCreateWithoutCategoriesInputSchema: z.ZodType TransactionCreateNestedManyWithoutCreatedByUserInputSchema).optional(), createdBudgetUserInvitations: z.lazy(() => BudgetUserInvitationCreateNestedManyWithoutCreatedByUserInputSchema).optional(), createdFromInvitation: z.lazy(() => BudgetUserInvitationResponseCreateNestedOneWithoutCreatedUserInputSchema).optional(), - uploadedBlobObjects: z.lazy(() => BlobObjectCreateNestedManyWithoutUploadedByUserInputSchema).optional() + uploadedBlobObjects: z.lazy(() => BlobObjectCreateNestedManyWithoutUploadedByUserInputSchema).optional(), + metadata: z.lazy(() => UserMetadataCreateNestedOneWithoutUserInputSchema).optional() }).strict(); export const UserUncheckedCreateWithoutCategoriesInputSchema: z.ZodType = z.object({ @@ -6596,7 +7007,8 @@ export const UserUncheckedCreateWithoutCategoriesInputSchema: z.ZodType TransactionUncheckedCreateNestedManyWithoutCreatedByUserInputSchema).optional(), createdBudgetUserInvitations: z.lazy(() => BudgetUserInvitationUncheckedCreateNestedManyWithoutCreatedByUserInputSchema).optional(), createdFromInvitation: z.lazy(() => BudgetUserInvitationResponseUncheckedCreateNestedOneWithoutCreatedUserInputSchema).optional(), - uploadedBlobObjects: z.lazy(() => BlobObjectUncheckedCreateNestedManyWithoutUploadedByUserInputSchema).optional() + uploadedBlobObjects: z.lazy(() => BlobObjectUncheckedCreateNestedManyWithoutUploadedByUserInputSchema).optional(), + metadata: z.lazy(() => UserMetadataUncheckedCreateNestedOneWithoutUserInputSchema).optional() }).strict(); export const UserCreateOrConnectWithoutCategoriesInputSchema: z.ZodType = z.object({ @@ -6740,7 +7152,8 @@ export const UserUpdateWithoutCategoriesInputSchema: z.ZodType TransactionUpdateManyWithoutCreatedByUserNestedInputSchema).optional(), createdBudgetUserInvitations: z.lazy(() => BudgetUserInvitationUpdateManyWithoutCreatedByUserNestedInputSchema).optional(), createdFromInvitation: z.lazy(() => BudgetUserInvitationResponseUpdateOneWithoutCreatedUserNestedInputSchema).optional(), - uploadedBlobObjects: z.lazy(() => BlobObjectUpdateManyWithoutUploadedByUserNestedInputSchema).optional() + uploadedBlobObjects: z.lazy(() => BlobObjectUpdateManyWithoutUploadedByUserNestedInputSchema).optional(), + metadata: z.lazy(() => UserMetadataUpdateOneWithoutUserNestedInputSchema).optional() }).strict(); export const UserUncheckedUpdateWithoutCategoriesInputSchema: z.ZodType = z.object({ @@ -6757,7 +7170,8 @@ export const UserUncheckedUpdateWithoutCategoriesInputSchema: z.ZodType TransactionUncheckedUpdateManyWithoutCreatedByUserNestedInputSchema).optional(), createdBudgetUserInvitations: z.lazy(() => BudgetUserInvitationUncheckedUpdateManyWithoutCreatedByUserNestedInputSchema).optional(), createdFromInvitation: z.lazy(() => BudgetUserInvitationResponseUncheckedUpdateOneWithoutCreatedUserNestedInputSchema).optional(), - uploadedBlobObjects: z.lazy(() => BlobObjectUncheckedUpdateManyWithoutUploadedByUserNestedInputSchema).optional() + uploadedBlobObjects: z.lazy(() => BlobObjectUncheckedUpdateManyWithoutUploadedByUserNestedInputSchema).optional(), + metadata: z.lazy(() => UserMetadataUncheckedUpdateOneWithoutUserNestedInputSchema).optional() }).strict(); export const CategoryUpsertWithoutChildrenInputSchema: z.ZodType = z.object({ @@ -6845,7 +7259,8 @@ export const UserCreateWithoutUploadedBlobObjectsInputSchema: z.ZodType TransactionCreateNestedManyWithoutCreatedByUserInputSchema).optional(), createdBudgetUserInvitations: z.lazy(() => BudgetUserInvitationCreateNestedManyWithoutCreatedByUserInputSchema).optional(), createdFromInvitation: z.lazy(() => BudgetUserInvitationResponseCreateNestedOneWithoutCreatedUserInputSchema).optional(), - categories: z.lazy(() => CategoryCreateNestedManyWithoutUserInputSchema).optional() + categories: z.lazy(() => CategoryCreateNestedManyWithoutUserInputSchema).optional(), + metadata: z.lazy(() => UserMetadataCreateNestedOneWithoutUserInputSchema).optional() }).strict(); export const UserUncheckedCreateWithoutUploadedBlobObjectsInputSchema: z.ZodType = z.object({ @@ -6862,7 +7277,8 @@ export const UserUncheckedCreateWithoutUploadedBlobObjectsInputSchema: z.ZodType transactions: z.lazy(() => TransactionUncheckedCreateNestedManyWithoutCreatedByUserInputSchema).optional(), createdBudgetUserInvitations: z.lazy(() => BudgetUserInvitationUncheckedCreateNestedManyWithoutCreatedByUserInputSchema).optional(), createdFromInvitation: z.lazy(() => BudgetUserInvitationResponseUncheckedCreateNestedOneWithoutCreatedUserInputSchema).optional(), - categories: z.lazy(() => CategoryUncheckedCreateNestedManyWithoutUserInputSchema).optional() + categories: z.lazy(() => CategoryUncheckedCreateNestedManyWithoutUserInputSchema).optional(), + metadata: z.lazy(() => UserMetadataUncheckedCreateNestedOneWithoutUserInputSchema).optional() }).strict(); export const UserCreateOrConnectWithoutUploadedBlobObjectsInputSchema: z.ZodType = z.object({ @@ -6930,7 +7346,8 @@ export const UserUpdateWithoutUploadedBlobObjectsInputSchema: z.ZodType TransactionUpdateManyWithoutCreatedByUserNestedInputSchema).optional(), createdBudgetUserInvitations: z.lazy(() => BudgetUserInvitationUpdateManyWithoutCreatedByUserNestedInputSchema).optional(), createdFromInvitation: z.lazy(() => BudgetUserInvitationResponseUpdateOneWithoutCreatedUserNestedInputSchema).optional(), - categories: z.lazy(() => CategoryUpdateManyWithoutUserNestedInputSchema).optional() + categories: z.lazy(() => CategoryUpdateManyWithoutUserNestedInputSchema).optional(), + metadata: z.lazy(() => UserMetadataUpdateOneWithoutUserNestedInputSchema).optional() }).strict(); export const UserUncheckedUpdateWithoutUploadedBlobObjectsInputSchema: z.ZodType = z.object({ @@ -6947,7 +7364,8 @@ export const UserUncheckedUpdateWithoutUploadedBlobObjectsInputSchema: z.ZodType transactions: z.lazy(() => TransactionUncheckedUpdateManyWithoutCreatedByUserNestedInputSchema).optional(), createdBudgetUserInvitations: z.lazy(() => BudgetUserInvitationUncheckedUpdateManyWithoutCreatedByUserNestedInputSchema).optional(), createdFromInvitation: z.lazy(() => BudgetUserInvitationResponseUncheckedUpdateOneWithoutCreatedUserNestedInputSchema).optional(), - categories: z.lazy(() => CategoryUncheckedUpdateManyWithoutUserNestedInputSchema).optional() + categories: z.lazy(() => CategoryUncheckedUpdateManyWithoutUserNestedInputSchema).optional(), + metadata: z.lazy(() => UserMetadataUncheckedUpdateOneWithoutUserNestedInputSchema).optional() }).strict(); export const TransactionUpsertWithoutBlobAttachmentsInputSchema: z.ZodType = z.object({ @@ -7772,6 +8190,73 @@ export const UserFindUniqueOrThrowArgsSchema: z.ZodType = z.object({ + select: UserMetadataSelectSchema.optional(), + include: UserMetadataIncludeSchema.optional(), + where: UserMetadataWhereInputSchema.optional(), + orderBy: z.union([ UserMetadataOrderByWithRelationInputSchema.array(),UserMetadataOrderByWithRelationInputSchema ]).optional(), + cursor: UserMetadataWhereUniqueInputSchema.optional(), + take: z.number().optional(), + skip: z.number().optional(), + distinct: z.union([ UserMetadataScalarFieldEnumSchema,UserMetadataScalarFieldEnumSchema.array() ]).optional(), + relationLoadStrategy: RelationLoadStrategySchema.optional(), +}).strict() ; + +export const UserMetadataFindFirstOrThrowArgsSchema: z.ZodType = z.object({ + select: UserMetadataSelectSchema.optional(), + include: UserMetadataIncludeSchema.optional(), + where: UserMetadataWhereInputSchema.optional(), + orderBy: z.union([ UserMetadataOrderByWithRelationInputSchema.array(),UserMetadataOrderByWithRelationInputSchema ]).optional(), + cursor: UserMetadataWhereUniqueInputSchema.optional(), + take: z.number().optional(), + skip: z.number().optional(), + distinct: z.union([ UserMetadataScalarFieldEnumSchema,UserMetadataScalarFieldEnumSchema.array() ]).optional(), + relationLoadStrategy: RelationLoadStrategySchema.optional(), +}).strict() ; + +export const UserMetadataFindManyArgsSchema: z.ZodType = z.object({ + select: UserMetadataSelectSchema.optional(), + include: UserMetadataIncludeSchema.optional(), + where: UserMetadataWhereInputSchema.optional(), + orderBy: z.union([ UserMetadataOrderByWithRelationInputSchema.array(),UserMetadataOrderByWithRelationInputSchema ]).optional(), + cursor: UserMetadataWhereUniqueInputSchema.optional(), + take: z.number().optional(), + skip: z.number().optional(), + distinct: z.union([ UserMetadataScalarFieldEnumSchema,UserMetadataScalarFieldEnumSchema.array() ]).optional(), + relationLoadStrategy: RelationLoadStrategySchema.optional(), +}).strict() ; + +export const UserMetadataAggregateArgsSchema: z.ZodType = z.object({ + where: UserMetadataWhereInputSchema.optional(), + orderBy: z.union([ UserMetadataOrderByWithRelationInputSchema.array(),UserMetadataOrderByWithRelationInputSchema ]).optional(), + cursor: UserMetadataWhereUniqueInputSchema.optional(), + take: z.number().optional(), + skip: z.number().optional(), +}).strict() ; + +export const UserMetadataGroupByArgsSchema: z.ZodType = z.object({ + where: UserMetadataWhereInputSchema.optional(), + orderBy: z.union([ UserMetadataOrderByWithAggregationInputSchema.array(),UserMetadataOrderByWithAggregationInputSchema ]).optional(), + by: UserMetadataScalarFieldEnumSchema.array(), + having: UserMetadataScalarWhereWithAggregatesInputSchema.optional(), + take: z.number().optional(), + skip: z.number().optional(), +}).strict() ; + +export const UserMetadataFindUniqueArgsSchema: z.ZodType = z.object({ + select: UserMetadataSelectSchema.optional(), + include: UserMetadataIncludeSchema.optional(), + where: UserMetadataWhereUniqueInputSchema, + relationLoadStrategy: RelationLoadStrategySchema.optional(), +}).strict() ; + +export const UserMetadataFindUniqueOrThrowArgsSchema: z.ZodType = z.object({ + select: UserMetadataSelectSchema.optional(), + include: UserMetadataIncludeSchema.optional(), + where: UserMetadataWhereUniqueInputSchema, + relationLoadStrategy: RelationLoadStrategySchema.optional(), +}).strict() ; + export const UserWalletAccountFindFirstArgsSchema: z.ZodType = z.object({ select: UserWalletAccountSelectSchema.optional(), include: UserWalletAccountIncludeSchema.optional(), @@ -8549,6 +9034,56 @@ export const UserDeleteManyArgsSchema: z.ZodType = z. where: UserWhereInputSchema.optional(), }).strict() ; +export const UserMetadataCreateArgsSchema: z.ZodType = z.object({ + select: UserMetadataSelectSchema.optional(), + include: UserMetadataIncludeSchema.optional(), + data: z.union([ UserMetadataCreateInputSchema,UserMetadataUncheckedCreateInputSchema ]), + relationLoadStrategy: RelationLoadStrategySchema.optional(), +}).strict() ; + +export const UserMetadataUpsertArgsSchema: z.ZodType = z.object({ + select: UserMetadataSelectSchema.optional(), + include: UserMetadataIncludeSchema.optional(), + where: UserMetadataWhereUniqueInputSchema, + create: z.union([ UserMetadataCreateInputSchema,UserMetadataUncheckedCreateInputSchema ]), + update: z.union([ UserMetadataUpdateInputSchema,UserMetadataUncheckedUpdateInputSchema ]), + relationLoadStrategy: RelationLoadStrategySchema.optional(), +}).strict() ; + +export const UserMetadataCreateManyArgsSchema: z.ZodType = z.object({ + data: z.union([ UserMetadataCreateManyInputSchema,UserMetadataCreateManyInputSchema.array() ]), + skipDuplicates: z.boolean().optional(), +}).strict() ; + +export const UserMetadataCreateManyAndReturnArgsSchema: z.ZodType = z.object({ + data: z.union([ UserMetadataCreateManyInputSchema,UserMetadataCreateManyInputSchema.array() ]), + skipDuplicates: z.boolean().optional(), +}).strict() ; + +export const UserMetadataDeleteArgsSchema: z.ZodType = z.object({ + select: UserMetadataSelectSchema.optional(), + include: UserMetadataIncludeSchema.optional(), + where: UserMetadataWhereUniqueInputSchema, + relationLoadStrategy: RelationLoadStrategySchema.optional(), +}).strict() ; + +export const UserMetadataUpdateArgsSchema: z.ZodType = z.object({ + select: UserMetadataSelectSchema.optional(), + include: UserMetadataIncludeSchema.optional(), + data: z.union([ UserMetadataUpdateInputSchema,UserMetadataUncheckedUpdateInputSchema ]), + where: UserMetadataWhereUniqueInputSchema, + relationLoadStrategy: RelationLoadStrategySchema.optional(), +}).strict() ; + +export const UserMetadataUpdateManyArgsSchema: z.ZodType = z.object({ + data: z.union([ UserMetadataUpdateManyMutationInputSchema,UserMetadataUncheckedUpdateManyInputSchema ]), + where: UserMetadataWhereInputSchema.optional(), +}).strict() ; + +export const UserMetadataDeleteManyArgsSchema: z.ZodType = z.object({ + where: UserMetadataWhereInputSchema.optional(), +}).strict() ; + export const UserWalletAccountCreateArgsSchema: z.ZodType = z.object({ select: UserWalletAccountSelectSchema.optional(), include: UserWalletAccountIncludeSchema.optional(), diff --git a/packages/validation/src/user.zod.ts b/packages/validation/src/user.zod.ts index 9724697a..a546dadd 100644 --- a/packages/validation/src/user.zod.ts +++ b/packages/validation/src/user.zod.ts @@ -5,5 +5,9 @@ export const zCreateUser = z.object({ email: z.string().email(), name: z.string().optional(), }) - export type CreateUser = z.infer + +export const zUpdateUserMetadata = z.object({ + timezone: z.string(), +}) +export type UpdateUserMetadata = z.infer