/** * PlatformInfraRef 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 { PlatformInfraRef, PlatformInfraRefWithRelations, PlatformInfraRefSelect, PlatformInfraRefFilter, PlatformInfraRefOrderBy, CreatePlatformInfraRefInput, UpdatePlatformInfraRefInput, PlatformInfraRefPatch, } from '../input-types'; import { connectionFieldsMap } from '../input-types'; export class PlatformInfraRefModel { constructor(private client: OrmClient) {} findMany( args: FindManyArgs & { select: S; } & StrictSelect ): QueryBuilder<{ platformInfraRefs: ConnectionResult>; }> { const { document, variables } = buildFindManyDocument( 'PlatformInfraRef', 'platformInfraRefs', 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, }, 'PlatformInfraRefFilter', 'PlatformInfraRefOrderBy', connectionFieldsMap ); return new QueryBuilder({ client: this.client, operation: 'query', operationName: 'PlatformInfraRef', fieldName: 'platformInfraRefs', document, variables, }); } findFirst( args: FindFirstArgs & { select: S; } & StrictSelect ): QueryBuilder<{ platformInfraRef: InferSelectResult | null; }> { const { document, variables } = buildFindFirstDocument( 'PlatformInfraRef', 'platformInfraRefs', args.select, { where: args?.where, orderBy: args?.orderBy as string[] | undefined, }, 'PlatformInfraRefFilter', 'PlatformInfraRefOrderBy', connectionFieldsMap ); return new QueryBuilder({ client: this.client, operation: 'query', operationName: 'PlatformInfraRef', fieldName: 'platformInfraRef', document, variables, transform: (data: { platformInfraRefs?: { nodes?: InferSelectResult[]; }; }) => ({ platformInfraRef: data.platformInfraRefs?.nodes?.[0] ?? null, }), }); } findOne( args: { id: string; select: S; } & StrictSelect ): QueryBuilder<{ platformInfraRef: InferSelectResult | null; }> { const { document, variables } = buildFindManyDocument( 'PlatformInfraRef', 'platformInfraRefs', args.select, { where: { id: { equalTo: args.id, }, }, first: 1, }, 'PlatformInfraRefFilter', 'PlatformInfraRefOrderBy', connectionFieldsMap ); return new QueryBuilder({ client: this.client, operation: 'query', operationName: 'PlatformInfraRef', fieldName: 'platformInfraRef', document, variables, transform: (data: { platformInfraRefs?: { nodes?: InferSelectResult[]; }; }) => ({ platformInfraRef: data.platformInfraRefs?.nodes?.[0] ?? null, }), }); } create( args: CreateArgs & { select: S; } & StrictSelect ): QueryBuilder<{ createPlatformInfraRef: { platformInfraRef: InferSelectResult; }; }> { const { document, variables } = buildCreateDocument( 'PlatformInfraRef', 'createPlatformInfraRef', 'platformInfraRef', args.select, args.data, 'CreatePlatformInfraRefInput', connectionFieldsMap ); return new QueryBuilder({ client: this.client, operation: 'mutation', operationName: 'PlatformInfraRef', fieldName: 'createPlatformInfraRef', document, variables, }); } update( args: UpdateArgs< S, { id: string; scopeId: string; }, PlatformInfraRefPatch > & { select: S; } & StrictSelect ): QueryBuilder<{ updatePlatformInfraRef: { platformInfraRef: InferSelectResult; }; }> { const { document, variables } = buildUpdateByPkDocument( 'PlatformInfraRef', 'updatePlatformInfraRef', 'platformInfraRef', args.select, args.where.id, args.data, 'UpdatePlatformInfraRefInput', 'id', 'platformInfraRefPatch', connectionFieldsMap, { scopeId: args.where.scopeId, } ); return new QueryBuilder({ client: this.client, operation: 'mutation', operationName: 'PlatformInfraRef', fieldName: 'updatePlatformInfraRef', document, variables, }); } delete( args: DeleteArgs< { id: string; scopeId: string; }, S > & { select: S; } & StrictSelect ): QueryBuilder<{ deletePlatformInfraRef: { platformInfraRef: InferSelectResult; }; }> { const { document, variables } = buildDeleteByPkDocument( 'PlatformInfraRef', 'deletePlatformInfraRef', 'platformInfraRef', { id: args.where.id, scopeId: args.where.scopeId, }, 'DeletePlatformInfraRefInput', args.select, connectionFieldsMap ); return new QueryBuilder({ client: this.client, operation: 'mutation', operationName: 'PlatformInfraRef', fieldName: 'deletePlatformInfraRef', document, variables, }); } }