/** * WebauthnAuthModule 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 { WebauthnAuthModule, WebauthnAuthModuleWithRelations, WebauthnAuthModuleSelect, WebauthnAuthModuleFilter, WebauthnAuthModuleOrderBy, CreateWebauthnAuthModuleInput, UpdateWebauthnAuthModuleInput, WebauthnAuthModulePatch, } from '../input-types'; import { connectionFieldsMap } from '../input-types'; export class WebauthnAuthModuleModel { constructor(private client: OrmClient) {} findMany( args: FindManyArgs & { select: S; } & StrictSelect ): QueryBuilder<{ webauthnAuthModules: ConnectionResult>; }> { const { document, variables } = buildFindManyDocument( 'WebauthnAuthModule', 'webauthnAuthModules', 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, }, 'WebauthnAuthModuleFilter', 'WebauthnAuthModuleOrderBy', connectionFieldsMap ); return new QueryBuilder({ client: this.client, operation: 'query', operationName: 'WebauthnAuthModule', fieldName: 'webauthnAuthModules', document, variables, }); } findFirst( args: FindFirstArgs & { select: S; } & StrictSelect ): QueryBuilder<{ webauthnAuthModule: InferSelectResult | null; }> { const { document, variables } = buildFindFirstDocument( 'WebauthnAuthModule', 'webauthnAuthModules', args.select, { where: args?.where, orderBy: args?.orderBy as string[] | undefined, }, 'WebauthnAuthModuleFilter', 'WebauthnAuthModuleOrderBy', connectionFieldsMap ); return new QueryBuilder({ client: this.client, operation: 'query', operationName: 'WebauthnAuthModule', fieldName: 'webauthnAuthModule', document, variables, transform: (data: { webauthnAuthModules?: { nodes?: InferSelectResult[]; }; }) => ({ webauthnAuthModule: data.webauthnAuthModules?.nodes?.[0] ?? null, }), }); } findOne( args: { id: string; select: S; } & StrictSelect ): QueryBuilder<{ webauthnAuthModule: InferSelectResult | null; }> { const { document, variables } = buildFindManyDocument( 'WebauthnAuthModule', 'webauthnAuthModules', args.select, { where: { id: { equalTo: args.id, }, }, first: 1, }, 'WebauthnAuthModuleFilter', 'WebauthnAuthModuleOrderBy', connectionFieldsMap ); return new QueryBuilder({ client: this.client, operation: 'query', operationName: 'WebauthnAuthModule', fieldName: 'webauthnAuthModule', document, variables, transform: (data: { webauthnAuthModules?: { nodes?: InferSelectResult[]; }; }) => ({ webauthnAuthModule: data.webauthnAuthModules?.nodes?.[0] ?? null, }), }); } create( args: CreateArgs & { select: S; } & StrictSelect ): QueryBuilder<{ createWebauthnAuthModule: { webauthnAuthModule: InferSelectResult; }; }> { const { document, variables } = buildCreateDocument( 'WebauthnAuthModule', 'createWebauthnAuthModule', 'webauthnAuthModule', args.select, args.data, 'CreateWebauthnAuthModuleInput', connectionFieldsMap ); return new QueryBuilder({ client: this.client, operation: 'mutation', operationName: 'WebauthnAuthModule', fieldName: 'createWebauthnAuthModule', document, variables, }); } update( args: UpdateArgs< S, { id: string; }, WebauthnAuthModulePatch > & { select: S; } & StrictSelect ): QueryBuilder<{ updateWebauthnAuthModule: { webauthnAuthModule: InferSelectResult; }; }> { const { document, variables } = buildUpdateByPkDocument( 'WebauthnAuthModule', 'updateWebauthnAuthModule', 'webauthnAuthModule', args.select, args.where.id, args.data, 'UpdateWebauthnAuthModuleInput', 'id', 'webauthnAuthModulePatch', connectionFieldsMap, undefined ); return new QueryBuilder({ client: this.client, operation: 'mutation', operationName: 'WebauthnAuthModule', fieldName: 'updateWebauthnAuthModule', document, variables, }); } delete( args: DeleteArgs< { id: string; }, S > & { select: S; } & StrictSelect ): QueryBuilder<{ deleteWebauthnAuthModule: { webauthnAuthModule: InferSelectResult; }; }> { const { document, variables } = buildDeleteByPkDocument( 'WebauthnAuthModule', 'deleteWebauthnAuthModule', 'webauthnAuthModule', { id: args.where.id, }, 'DeleteWebauthnAuthModuleInput', args.select, connectionFieldsMap ); return new QueryBuilder({ client: this.client, operation: 'mutation', operationName: 'WebauthnAuthModule', fieldName: 'deleteWebauthnAuthModule', document, variables, }); } }