/** * PlatformSiteErrorPage 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 { PlatformSiteErrorPage, PlatformSiteErrorPageWithRelations, PlatformSiteErrorPageSelect, PlatformSiteErrorPageFilter, PlatformSiteErrorPageOrderBy, CreatePlatformSiteErrorPageInput, UpdatePlatformSiteErrorPageInput, PlatformSiteErrorPagePatch, } from '../input-types'; import { connectionFieldsMap } from '../input-types'; export class PlatformSiteErrorPageModel { constructor(private client: OrmClient) {} findMany( args: FindManyArgs & { select: S; } & StrictSelect ): QueryBuilder<{ platformSiteErrorPages: ConnectionResult< InferSelectResult >; }> { const { document, variables } = buildFindManyDocument( 'PlatformSiteErrorPage', 'platformSiteErrorPages', 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, }, 'PlatformSiteErrorPageFilter', 'PlatformSiteErrorPageOrderBy', connectionFieldsMap ); return new QueryBuilder({ client: this.client, operation: 'query', operationName: 'PlatformSiteErrorPage', fieldName: 'platformSiteErrorPages', document, variables, }); } findFirst( args: FindFirstArgs & { select: S; } & StrictSelect ): QueryBuilder<{ platformSiteErrorPage: InferSelectResult | null; }> { const { document, variables } = buildFindFirstDocument( 'PlatformSiteErrorPage', 'platformSiteErrorPages', args.select, { where: args?.where, orderBy: args?.orderBy as string[] | undefined, }, 'PlatformSiteErrorPageFilter', 'PlatformSiteErrorPageOrderBy', connectionFieldsMap ); return new QueryBuilder({ client: this.client, operation: 'query', operationName: 'PlatformSiteErrorPage', fieldName: 'platformSiteErrorPage', document, variables, transform: (data: { platformSiteErrorPages?: { nodes?: InferSelectResult[]; }; }) => ({ platformSiteErrorPage: data.platformSiteErrorPages?.nodes?.[0] ?? null, }), }); } findOne( args: { id: string; select: S; } & StrictSelect ): QueryBuilder<{ platformSiteErrorPage: InferSelectResult | null; }> { const { document, variables } = buildFindManyDocument( 'PlatformSiteErrorPage', 'platformSiteErrorPages', args.select, { where: { id: { equalTo: args.id, }, }, first: 1, }, 'PlatformSiteErrorPageFilter', 'PlatformSiteErrorPageOrderBy', connectionFieldsMap ); return new QueryBuilder({ client: this.client, operation: 'query', operationName: 'PlatformSiteErrorPage', fieldName: 'platformSiteErrorPage', document, variables, transform: (data: { platformSiteErrorPages?: { nodes?: InferSelectResult[]; }; }) => ({ platformSiteErrorPage: data.platformSiteErrorPages?.nodes?.[0] ?? null, }), }); } create( args: CreateArgs & { select: S; } & StrictSelect ): QueryBuilder<{ createPlatformSiteErrorPage: { platformSiteErrorPage: InferSelectResult; }; }> { const { document, variables } = buildCreateDocument( 'PlatformSiteErrorPage', 'createPlatformSiteErrorPage', 'platformSiteErrorPage', args.select, args.data, 'CreatePlatformSiteErrorPageInput', connectionFieldsMap ); return new QueryBuilder({ client: this.client, operation: 'mutation', operationName: 'PlatformSiteErrorPage', fieldName: 'createPlatformSiteErrorPage', document, variables, }); } update( args: UpdateArgs< S, { id: string; }, PlatformSiteErrorPagePatch > & { select: S; } & StrictSelect ): QueryBuilder<{ updatePlatformSiteErrorPage: { platformSiteErrorPage: InferSelectResult; }; }> { const { document, variables } = buildUpdateByPkDocument( 'PlatformSiteErrorPage', 'updatePlatformSiteErrorPage', 'platformSiteErrorPage', args.select, args.where.id, args.data, 'UpdatePlatformSiteErrorPageInput', 'id', 'platformSiteErrorPagePatch', connectionFieldsMap, undefined ); return new QueryBuilder({ client: this.client, operation: 'mutation', operationName: 'PlatformSiteErrorPage', fieldName: 'updatePlatformSiteErrorPage', document, variables, }); } delete( args: DeleteArgs< { id: string; }, S > & { select: S; } & StrictSelect ): QueryBuilder<{ deletePlatformSiteErrorPage: { platformSiteErrorPage: InferSelectResult; }; }> { const { document, variables } = buildDeleteByPkDocument( 'PlatformSiteErrorPage', 'deletePlatformSiteErrorPage', 'platformSiteErrorPage', { id: args.where.id, }, 'DeletePlatformSiteErrorPageInput', args.select, connectionFieldsMap ); return new QueryBuilder({ client: this.client, operation: 'mutation', operationName: 'PlatformSiteErrorPage', fieldName: 'deletePlatformSiteErrorPage', document, variables, }); } }