/** * ResourceInstallation 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 { ResourceInstallation, ResourceInstallationWithRelations, ResourceInstallationSelect, ResourceInstallationFilter, ResourceInstallationOrderBy, CreateResourceInstallationInput, UpdateResourceInstallationInput, ResourceInstallationPatch, } from '../input-types'; import { connectionFieldsMap } from '../input-types'; export class ResourceInstallationModel { constructor(private client: OrmClient) {} findMany( args: FindManyArgs & { select: S; } & StrictSelect ): QueryBuilder<{ resourceInstallations: ConnectionResult< InferSelectResult >; }> { const { document, variables } = buildFindManyDocument( 'ResourceInstallation', 'resourceInstallations', 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, }, 'ResourceInstallationFilter', 'ResourceInstallationOrderBy', connectionFieldsMap ); return new QueryBuilder({ client: this.client, operation: 'query', operationName: 'ResourceInstallation', fieldName: 'resourceInstallations', document, variables, }); } findFirst( args: FindFirstArgs & { select: S; } & StrictSelect ): QueryBuilder<{ resourceInstallation: InferSelectResult | null; }> { const { document, variables } = buildFindFirstDocument( 'ResourceInstallation', 'resourceInstallations', args.select, { where: args?.where, orderBy: args?.orderBy as string[] | undefined, }, 'ResourceInstallationFilter', 'ResourceInstallationOrderBy', connectionFieldsMap ); return new QueryBuilder({ client: this.client, operation: 'query', operationName: 'ResourceInstallation', fieldName: 'resourceInstallation', document, variables, transform: (data: { resourceInstallations?: { nodes?: InferSelectResult[]; }; }) => ({ resourceInstallation: data.resourceInstallations?.nodes?.[0] ?? null, }), }); } findOne( args: { id: string; select: S; } & StrictSelect ): QueryBuilder<{ resourceInstallation: InferSelectResult | null; }> { const { document, variables } = buildFindManyDocument( 'ResourceInstallation', 'resourceInstallations', args.select, { where: { id: { equalTo: args.id, }, }, first: 1, }, 'ResourceInstallationFilter', 'ResourceInstallationOrderBy', connectionFieldsMap ); return new QueryBuilder({ client: this.client, operation: 'query', operationName: 'ResourceInstallation', fieldName: 'resourceInstallation', document, variables, transform: (data: { resourceInstallations?: { nodes?: InferSelectResult[]; }; }) => ({ resourceInstallation: data.resourceInstallations?.nodes?.[0] ?? null, }), }); } create( args: CreateArgs & { select: S; } & StrictSelect ): QueryBuilder<{ createResourceInstallation: { resourceInstallation: InferSelectResult; }; }> { const { document, variables } = buildCreateDocument( 'ResourceInstallation', 'createResourceInstallation', 'resourceInstallation', args.select, args.data, 'CreateResourceInstallationInput', connectionFieldsMap ); return new QueryBuilder({ client: this.client, operation: 'mutation', operationName: 'ResourceInstallation', fieldName: 'createResourceInstallation', document, variables, }); } update( args: UpdateArgs< S, { id: string; }, ResourceInstallationPatch > & { select: S; } & StrictSelect ): QueryBuilder<{ updateResourceInstallation: { resourceInstallation: InferSelectResult; }; }> { const { document, variables } = buildUpdateByPkDocument( 'ResourceInstallation', 'updateResourceInstallation', 'resourceInstallation', args.select, args.where.id, args.data, 'UpdateResourceInstallationInput', 'id', 'resourceInstallationPatch', connectionFieldsMap, undefined ); return new QueryBuilder({ client: this.client, operation: 'mutation', operationName: 'ResourceInstallation', fieldName: 'updateResourceInstallation', document, variables, }); } delete( args: DeleteArgs< { id: string; }, S > & { select: S; } & StrictSelect ): QueryBuilder<{ deleteResourceInstallation: { resourceInstallation: InferSelectResult; }; }> { const { document, variables } = buildDeleteByPkDocument( 'ResourceInstallation', 'deleteResourceInstallation', 'resourceInstallation', { id: args.where.id, }, 'DeleteResourceInstallationInput', args.select, connectionFieldsMap ); return new QueryBuilder({ client: this.client, operation: 'mutation', operationName: 'ResourceInstallation', fieldName: 'deleteResourceInstallation', document, variables, }); } }