/** * PlatformPage 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 { PlatformPage, PlatformPageWithRelations, PlatformPageSelect, PlatformPageFilter, PlatformPageOrderBy, CreatePlatformPageInput, UpdatePlatformPageInput, PlatformPagePatch, } from '../input-types'; import { connectionFieldsMap } from '../input-types'; export class PlatformPageModel { constructor(private client: OrmClient) {} findMany( args: FindManyArgs & { select: S; } & StrictSelect ): QueryBuilder<{ platformPages: ConnectionResult>; }> { const { document, variables } = buildFindManyDocument( 'PlatformPage', 'platformPages', 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, }, 'PlatformPageFilter', 'PlatformPageOrderBy', connectionFieldsMap ); return new QueryBuilder({ client: this.client, operation: 'query', operationName: 'PlatformPage', fieldName: 'platformPages', document, variables, }); } findFirst( args: FindFirstArgs & { select: S; } & StrictSelect ): QueryBuilder<{ platformPage: InferSelectResult | null; }> { const { document, variables } = buildFindFirstDocument( 'PlatformPage', 'platformPages', args.select, { where: args?.where, orderBy: args?.orderBy as string[] | undefined, }, 'PlatformPageFilter', 'PlatformPageOrderBy', connectionFieldsMap ); return new QueryBuilder({ client: this.client, operation: 'query', operationName: 'PlatformPage', fieldName: 'platformPage', document, variables, transform: (data: { platformPages?: { nodes?: InferSelectResult[]; }; }) => ({ platformPage: data.platformPages?.nodes?.[0] ?? null, }), }); } findOne( args: { id: string; select: S; } & StrictSelect ): QueryBuilder<{ platformPage: InferSelectResult | null; }> { const { document, variables } = buildFindManyDocument( 'PlatformPage', 'platformPages', args.select, { where: { id: { equalTo: args.id, }, }, first: 1, }, 'PlatformPageFilter', 'PlatformPageOrderBy', connectionFieldsMap ); return new QueryBuilder({ client: this.client, operation: 'query', operationName: 'PlatformPage', fieldName: 'platformPage', document, variables, transform: (data: { platformPages?: { nodes?: InferSelectResult[]; }; }) => ({ platformPage: data.platformPages?.nodes?.[0] ?? null, }), }); } create( args: CreateArgs & { select: S; } & StrictSelect ): QueryBuilder<{ createPlatformPage: { platformPage: InferSelectResult; }; }> { const { document, variables } = buildCreateDocument( 'PlatformPage', 'createPlatformPage', 'platformPage', args.select, args.data, 'CreatePlatformPageInput', connectionFieldsMap ); return new QueryBuilder({ client: this.client, operation: 'mutation', operationName: 'PlatformPage', fieldName: 'createPlatformPage', document, variables, }); } update( args: UpdateArgs< S, { id: string; }, PlatformPagePatch > & { select: S; } & StrictSelect ): QueryBuilder<{ updatePlatformPage: { platformPage: InferSelectResult; }; }> { const { document, variables } = buildUpdateByPkDocument( 'PlatformPage', 'updatePlatformPage', 'platformPage', args.select, args.where.id, args.data, 'UpdatePlatformPageInput', 'id', 'platformPagePatch', connectionFieldsMap, undefined ); return new QueryBuilder({ client: this.client, operation: 'mutation', operationName: 'PlatformPage', fieldName: 'updatePlatformPage', document, variables, }); } delete( args: DeleteArgs< { id: string; }, S > & { select: S; } & StrictSelect ): QueryBuilder<{ deletePlatformPage: { platformPage: InferSelectResult; }; }> { const { document, variables } = buildDeleteByPkDocument( 'PlatformPage', 'deletePlatformPage', 'platformPage', { id: args.where.id, }, 'DeletePlatformPageInput', args.select, connectionFieldsMap ); return new QueryBuilder({ client: this.client, operation: 'mutation', operationName: 'PlatformPage', fieldName: 'deletePlatformPage', document, variables, }); } }