/** * PlatformProposal 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 { PlatformProposal, PlatformProposalWithRelations, PlatformProposalSelect, PlatformProposalFilter, PlatformProposalOrderBy, CreatePlatformProposalInput, UpdatePlatformProposalInput, PlatformProposalPatch, } from '../input-types'; import { connectionFieldsMap } from '../input-types'; export class PlatformProposalModel { constructor(private client: OrmClient) {} findMany( args: FindManyArgs & { select: S; } & StrictSelect ): QueryBuilder<{ platformProposals: ConnectionResult>; }> { const { document, variables } = buildFindManyDocument( 'PlatformProposal', 'platformProposals', 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, }, 'PlatformProposalFilter', 'PlatformProposalOrderBy', connectionFieldsMap ); return new QueryBuilder({ client: this.client, operation: 'query', operationName: 'PlatformProposal', fieldName: 'platformProposals', document, variables, }); } findFirst( args: FindFirstArgs & { select: S; } & StrictSelect ): QueryBuilder<{ platformProposal: InferSelectResult | null; }> { const { document, variables } = buildFindFirstDocument( 'PlatformProposal', 'platformProposals', args.select, { where: args?.where, orderBy: args?.orderBy as string[] | undefined, }, 'PlatformProposalFilter', 'PlatformProposalOrderBy', connectionFieldsMap ); return new QueryBuilder({ client: this.client, operation: 'query', operationName: 'PlatformProposal', fieldName: 'platformProposal', document, variables, transform: (data: { platformProposals?: { nodes?: InferSelectResult[]; }; }) => ({ platformProposal: data.platformProposals?.nodes?.[0] ?? null, }), }); } findOne( args: { id: string; select: S; } & StrictSelect ): QueryBuilder<{ platformProposal: InferSelectResult | null; }> { const { document, variables } = buildFindManyDocument( 'PlatformProposal', 'platformProposals', args.select, { where: { id: { equalTo: args.id, }, }, first: 1, }, 'PlatformProposalFilter', 'PlatformProposalOrderBy', connectionFieldsMap ); return new QueryBuilder({ client: this.client, operation: 'query', operationName: 'PlatformProposal', fieldName: 'platformProposal', document, variables, transform: (data: { platformProposals?: { nodes?: InferSelectResult[]; }; }) => ({ platformProposal: data.platformProposals?.nodes?.[0] ?? null, }), }); } create( args: CreateArgs & { select: S; } & StrictSelect ): QueryBuilder<{ createPlatformProposal: { platformProposal: InferSelectResult; }; }> { const { document, variables } = buildCreateDocument( 'PlatformProposal', 'createPlatformProposal', 'platformProposal', args.select, args.data, 'CreatePlatformProposalInput', connectionFieldsMap ); return new QueryBuilder({ client: this.client, operation: 'mutation', operationName: 'PlatformProposal', fieldName: 'createPlatformProposal', document, variables, }); } update( args: UpdateArgs< S, { id: string; }, PlatformProposalPatch > & { select: S; } & StrictSelect ): QueryBuilder<{ updatePlatformProposal: { platformProposal: InferSelectResult; }; }> { const { document, variables } = buildUpdateByPkDocument( 'PlatformProposal', 'updatePlatformProposal', 'platformProposal', args.select, args.where.id, args.data, 'UpdatePlatformProposalInput', 'id', 'platformProposalPatch', connectionFieldsMap, undefined ); return new QueryBuilder({ client: this.client, operation: 'mutation', operationName: 'PlatformProposal', fieldName: 'updatePlatformProposal', document, variables, }); } delete( args: DeleteArgs< { id: string; }, S > & { select: S; } & StrictSelect ): QueryBuilder<{ deletePlatformProposal: { platformProposal: InferSelectResult; }; }> { const { document, variables } = buildDeleteByPkDocument( 'PlatformProposal', 'deletePlatformProposal', 'platformProposal', { id: args.where.id, }, 'DeletePlatformProposalInput', args.select, connectionFieldsMap ); return new QueryBuilder({ client: this.client, operation: 'mutation', operationName: 'PlatformProposal', fieldName: 'deletePlatformProposal', document, variables, }); } }