/** * BillingProviderModule model for ORM client * @generated by @constructive-io/graphql-codegen * DO NOT EDIT - changes will be overwritten */ import { OrmClient } from '../client'; import { QueryBuilder, buildFindManyDocument, buildFindFirstDocument, buildFindOneDocument, buildCreateDocument, buildUpdateByPkDocument, buildDeleteByPkDocument, } from '../query-builder'; import type { ConnectionResult, FindManyArgs, FindFirstArgs, CreateArgs, UpdateArgs, DeleteArgs, InferSelectResult, StrictSelect, } from '../select-types'; import type { BillingProviderModule, BillingProviderModuleWithRelations, BillingProviderModuleSelect, BillingProviderModuleFilter, BillingProviderModuleOrderBy, CreateBillingProviderModuleInput, UpdateBillingProviderModuleInput, BillingProviderModulePatch, } from '../input-types'; import { connectionFieldsMap } from '../input-types'; export class BillingProviderModuleModel { constructor(private client: OrmClient) {} findMany( args: FindManyArgs & { select: S; } & StrictSelect ): QueryBuilder<{ billingProviderModules: ConnectionResult< InferSelectResult >; }> { const { document, variables } = buildFindManyDocument( 'BillingProviderModule', 'billingProviderModules', args.select, { where: args?.where, orderBy: args?.orderBy as string[] | undefined, first: args?.first, last: args?.last, after: args?.after, before: args?.before, offset: args?.offset, }, 'BillingProviderModuleFilter', 'BillingProviderModuleOrderBy', connectionFieldsMap ); return new QueryBuilder({ client: this.client, operation: 'query', operationName: 'BillingProviderModule', fieldName: 'billingProviderModules', document, variables, }); } findFirst( args: FindFirstArgs & { select: S; } & StrictSelect ): QueryBuilder<{ billingProviderModule: InferSelectResult | null; }> { const { document, variables } = buildFindFirstDocument( 'BillingProviderModule', 'billingProviderModules', args.select, { where: args?.where, orderBy: args?.orderBy as string[] | undefined, }, 'BillingProviderModuleFilter', 'BillingProviderModuleOrderBy', connectionFieldsMap ); return new QueryBuilder({ client: this.client, operation: 'query', operationName: 'BillingProviderModule', fieldName: 'billingProviderModule', document, variables, transform: (data: { billingProviderModules?: { nodes?: InferSelectResult[]; }; }) => ({ billingProviderModule: data.billingProviderModules?.nodes?.[0] ?? null, }), }); } findOne( args: { id: string; select: S; } & StrictSelect ): QueryBuilder<{ billingProviderModule: InferSelectResult | null; }> { const { document, variables } = buildFindManyDocument( 'BillingProviderModule', 'billingProviderModules', args.select, { where: { id: { equalTo: args.id, }, }, first: 1, }, 'BillingProviderModuleFilter', 'BillingProviderModuleOrderBy', connectionFieldsMap ); return new QueryBuilder({ client: this.client, operation: 'query', operationName: 'BillingProviderModule', fieldName: 'billingProviderModule', document, variables, transform: (data: { billingProviderModules?: { nodes?: InferSelectResult[]; }; }) => ({ billingProviderModule: data.billingProviderModules?.nodes?.[0] ?? null, }), }); } create( args: CreateArgs & { select: S; } & StrictSelect ): QueryBuilder<{ createBillingProviderModule: { billingProviderModule: InferSelectResult; }; }> { const { document, variables } = buildCreateDocument( 'BillingProviderModule', 'createBillingProviderModule', 'billingProviderModule', args.select, args.data, 'CreateBillingProviderModuleInput', connectionFieldsMap ); return new QueryBuilder({ client: this.client, operation: 'mutation', operationName: 'BillingProviderModule', fieldName: 'createBillingProviderModule', document, variables, }); } update( args: UpdateArgs< S, { id: string; }, BillingProviderModulePatch > & { select: S; } & StrictSelect ): QueryBuilder<{ updateBillingProviderModule: { billingProviderModule: InferSelectResult; }; }> { const { document, variables } = buildUpdateByPkDocument( 'BillingProviderModule', 'updateBillingProviderModule', 'billingProviderModule', args.select, args.where.id, args.data, 'UpdateBillingProviderModuleInput', 'id', 'billingProviderModulePatch', connectionFieldsMap, undefined ); return new QueryBuilder({ client: this.client, operation: 'mutation', operationName: 'BillingProviderModule', fieldName: 'updateBillingProviderModule', document, variables, }); } delete( args: DeleteArgs< { id: string; }, S > & { select: S; } & StrictSelect ): QueryBuilder<{ deleteBillingProviderModule: { billingProviderModule: InferSelectResult; }; }> { const { document, variables } = buildDeleteByPkDocument( 'BillingProviderModule', 'deleteBillingProviderModule', 'billingProviderModule', { id: args.where.id, }, 'DeleteBillingProviderModuleInput', args.select, connectionFieldsMap ); return new QueryBuilder({ client: this.client, operation: 'mutation', operationName: 'BillingProviderModule', fieldName: 'deleteBillingProviderModule', document, variables, }); } }