/** * OrgOwnerGrant 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 { OrgOwnerGrant, OrgOwnerGrantWithRelations, OrgOwnerGrantSelect, OrgOwnerGrantFilter, OrgOwnerGrantOrderBy, CreateOrgOwnerGrantInput, UpdateOrgOwnerGrantInput, OrgOwnerGrantPatch, } from '../input-types'; import { connectionFieldsMap } from '../input-types'; export class OrgOwnerGrantModel { constructor(private client: OrmClient) {} findMany( args: FindManyArgs & { select: S; } & StrictSelect ): QueryBuilder<{ orgOwnerGrants: ConnectionResult>; }> { const { document, variables } = buildFindManyDocument( 'OrgOwnerGrant', 'orgOwnerGrants', 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, }, 'OrgOwnerGrantFilter', 'OrgOwnerGrantOrderBy', connectionFieldsMap ); return new QueryBuilder({ client: this.client, operation: 'query', operationName: 'OrgOwnerGrant', fieldName: 'orgOwnerGrants', document, variables, }); } findFirst( args: FindFirstArgs & { select: S; } & StrictSelect ): QueryBuilder<{ orgOwnerGrant: InferSelectResult | null; }> { const { document, variables } = buildFindFirstDocument( 'OrgOwnerGrant', 'orgOwnerGrants', args.select, { where: args?.where, orderBy: args?.orderBy as string[] | undefined, }, 'OrgOwnerGrantFilter', 'OrgOwnerGrantOrderBy', connectionFieldsMap ); return new QueryBuilder({ client: this.client, operation: 'query', operationName: 'OrgOwnerGrant', fieldName: 'orgOwnerGrant', document, variables, transform: (data: { orgOwnerGrants?: { nodes?: InferSelectResult[]; }; }) => ({ orgOwnerGrant: data.orgOwnerGrants?.nodes?.[0] ?? null, }), }); } findOne( args: { id: string; select: S; } & StrictSelect ): QueryBuilder<{ orgOwnerGrant: InferSelectResult | null; }> { const { document, variables } = buildFindManyDocument( 'OrgOwnerGrant', 'orgOwnerGrants', args.select, { where: { id: { equalTo: args.id, }, }, first: 1, }, 'OrgOwnerGrantFilter', 'OrgOwnerGrantOrderBy', connectionFieldsMap ); return new QueryBuilder({ client: this.client, operation: 'query', operationName: 'OrgOwnerGrant', fieldName: 'orgOwnerGrant', document, variables, transform: (data: { orgOwnerGrants?: { nodes?: InferSelectResult[]; }; }) => ({ orgOwnerGrant: data.orgOwnerGrants?.nodes?.[0] ?? null, }), }); } create( args: CreateArgs & { select: S; } & StrictSelect ): QueryBuilder<{ createOrgOwnerGrant: { orgOwnerGrant: InferSelectResult; }; }> { const { document, variables } = buildCreateDocument( 'OrgOwnerGrant', 'createOrgOwnerGrant', 'orgOwnerGrant', args.select, args.data, 'CreateOrgOwnerGrantInput', connectionFieldsMap ); return new QueryBuilder({ client: this.client, operation: 'mutation', operationName: 'OrgOwnerGrant', fieldName: 'createOrgOwnerGrant', document, variables, }); } update( args: UpdateArgs< S, { id: string; }, OrgOwnerGrantPatch > & { select: S; } & StrictSelect ): QueryBuilder<{ updateOrgOwnerGrant: { orgOwnerGrant: InferSelectResult; }; }> { const { document, variables } = buildUpdateByPkDocument( 'OrgOwnerGrant', 'updateOrgOwnerGrant', 'orgOwnerGrant', args.select, args.where.id, args.data, 'UpdateOrgOwnerGrantInput', 'id', 'orgOwnerGrantPatch', connectionFieldsMap, undefined ); return new QueryBuilder({ client: this.client, operation: 'mutation', operationName: 'OrgOwnerGrant', fieldName: 'updateOrgOwnerGrant', document, variables, }); } delete( args: DeleteArgs< { id: string; }, S > & { select: S; } & StrictSelect ): QueryBuilder<{ deleteOrgOwnerGrant: { orgOwnerGrant: InferSelectResult; }; }> { const { document, variables } = buildDeleteByPkDocument( 'OrgOwnerGrant', 'deleteOrgOwnerGrant', 'orgOwnerGrant', { id: args.where.id, }, 'DeleteOrgOwnerGrantInput', args.select, connectionFieldsMap ); return new QueryBuilder({ client: this.client, operation: 'mutation', operationName: 'OrgOwnerGrant', fieldName: 'deleteOrgOwnerGrant', document, variables, }); } }