/** * PlatformNamespaceEvent 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 { PlatformNamespaceEvent, PlatformNamespaceEventWithRelations, PlatformNamespaceEventSelect, PlatformNamespaceEventFilter, PlatformNamespaceEventOrderBy, CreatePlatformNamespaceEventInput, UpdatePlatformNamespaceEventInput, PlatformNamespaceEventPatch, } from '../input-types'; import { connectionFieldsMap } from '../input-types'; export class PlatformNamespaceEventModel { constructor(private client: OrmClient) {} findMany( args: FindManyArgs & { select: S; } & StrictSelect ): QueryBuilder<{ platformNamespaceEvents: ConnectionResult< InferSelectResult >; }> { const { document, variables } = buildFindManyDocument( 'PlatformNamespaceEvent', 'platformNamespaceEvents', 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, }, 'PlatformNamespaceEventFilter', 'PlatformNamespaceEventOrderBy', connectionFieldsMap ); return new QueryBuilder({ client: this.client, operation: 'query', operationName: 'PlatformNamespaceEvent', fieldName: 'platformNamespaceEvents', document, variables, }); } findFirst( args: FindFirstArgs & { select: S; } & StrictSelect ): QueryBuilder<{ platformNamespaceEvent: InferSelectResult | null; }> { const { document, variables } = buildFindFirstDocument( 'PlatformNamespaceEvent', 'platformNamespaceEvents', args.select, { where: args?.where, orderBy: args?.orderBy as string[] | undefined, }, 'PlatformNamespaceEventFilter', 'PlatformNamespaceEventOrderBy', connectionFieldsMap ); return new QueryBuilder({ client: this.client, operation: 'query', operationName: 'PlatformNamespaceEvent', fieldName: 'platformNamespaceEvent', document, variables, transform: (data: { platformNamespaceEvents?: { nodes?: InferSelectResult[]; }; }) => ({ platformNamespaceEvent: data.platformNamespaceEvents?.nodes?.[0] ?? null, }), }); } findOne( args: { id: string; select: S; } & StrictSelect ): QueryBuilder<{ platformNamespaceEvent: InferSelectResult | null; }> { const { document, variables } = buildFindManyDocument( 'PlatformNamespaceEvent', 'platformNamespaceEvents', args.select, { where: { id: { equalTo: args.id, }, }, first: 1, }, 'PlatformNamespaceEventFilter', 'PlatformNamespaceEventOrderBy', connectionFieldsMap ); return new QueryBuilder({ client: this.client, operation: 'query', operationName: 'PlatformNamespaceEvent', fieldName: 'platformNamespaceEvent', document, variables, transform: (data: { platformNamespaceEvents?: { nodes?: InferSelectResult[]; }; }) => ({ platformNamespaceEvent: data.platformNamespaceEvents?.nodes?.[0] ?? null, }), }); } create( args: CreateArgs & { select: S; } & StrictSelect ): QueryBuilder<{ createPlatformNamespaceEvent: { platformNamespaceEvent: InferSelectResult; }; }> { const { document, variables } = buildCreateDocument( 'PlatformNamespaceEvent', 'createPlatformNamespaceEvent', 'platformNamespaceEvent', args.select, args.data, 'CreatePlatformNamespaceEventInput', connectionFieldsMap ); return new QueryBuilder({ client: this.client, operation: 'mutation', operationName: 'PlatformNamespaceEvent', fieldName: 'createPlatformNamespaceEvent', document, variables, }); } update( args: UpdateArgs< S, { id: string; createdAt: string; }, PlatformNamespaceEventPatch > & { select: S; } & StrictSelect ): QueryBuilder<{ updatePlatformNamespaceEvent: { platformNamespaceEvent: InferSelectResult; }; }> { const { document, variables } = buildUpdateByPkDocument( 'PlatformNamespaceEvent', 'updatePlatformNamespaceEvent', 'platformNamespaceEvent', args.select, args.where.id, args.data, 'UpdatePlatformNamespaceEventInput', 'id', 'platformNamespaceEventPatch', connectionFieldsMap, { createdAt: args.where.createdAt, } ); return new QueryBuilder({ client: this.client, operation: 'mutation', operationName: 'PlatformNamespaceEvent', fieldName: 'updatePlatformNamespaceEvent', document, variables, }); } delete( args: DeleteArgs< { id: string; createdAt: string; }, S > & { select: S; } & StrictSelect ): QueryBuilder<{ deletePlatformNamespaceEvent: { platformNamespaceEvent: InferSelectResult; }; }> { const { document, variables } = buildDeleteByPkDocument( 'PlatformNamespaceEvent', 'deletePlatformNamespaceEvent', 'platformNamespaceEvent', { id: args.where.id, createdAt: args.where.createdAt, }, 'DeletePlatformNamespaceEventInput', args.select, connectionFieldsMap ); return new QueryBuilder({ client: this.client, operation: 'mutation', operationName: 'PlatformNamespaceEvent', fieldName: 'deletePlatformNamespaceEvent', document, variables, }); } }