/** * AppLimitEvent 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 { AppLimitEvent, AppLimitEventWithRelations, AppLimitEventSelect, AppLimitEventFilter, AppLimitEventOrderBy, CreateAppLimitEventInput, UpdateAppLimitEventInput, AppLimitEventPatch, } from '../input-types'; import { connectionFieldsMap } from '../input-types'; export class AppLimitEventModel { constructor(private client: OrmClient) {} findMany( args: FindManyArgs & { select: S; } & StrictSelect ): QueryBuilder<{ appLimitEvents: ConnectionResult>; }> { const { document, variables } = buildFindManyDocument( 'AppLimitEvent', 'appLimitEvents', 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, }, 'AppLimitEventFilter', 'AppLimitEventOrderBy', connectionFieldsMap ); return new QueryBuilder({ client: this.client, operation: 'query', operationName: 'AppLimitEvent', fieldName: 'appLimitEvents', document, variables, }); } findFirst( args: FindFirstArgs & { select: S; } & StrictSelect ): QueryBuilder<{ appLimitEvent: InferSelectResult | null; }> { const { document, variables } = buildFindFirstDocument( 'AppLimitEvent', 'appLimitEvents', args.select, { where: args?.where, orderBy: args?.orderBy as string[] | undefined, }, 'AppLimitEventFilter', 'AppLimitEventOrderBy', connectionFieldsMap ); return new QueryBuilder({ client: this.client, operation: 'query', operationName: 'AppLimitEvent', fieldName: 'appLimitEvent', document, variables, transform: (data: { appLimitEvents?: { nodes?: InferSelectResult[]; }; }) => ({ appLimitEvent: data.appLimitEvents?.nodes?.[0] ?? null, }), }); } findOne( args: { id: string; select: S; } & StrictSelect ): QueryBuilder<{ appLimitEvent: InferSelectResult | null; }> { const { document, variables } = buildFindManyDocument( 'AppLimitEvent', 'appLimitEvents', args.select, { where: { id: { equalTo: args.id, }, }, first: 1, }, 'AppLimitEventFilter', 'AppLimitEventOrderBy', connectionFieldsMap ); return new QueryBuilder({ client: this.client, operation: 'query', operationName: 'AppLimitEvent', fieldName: 'appLimitEvent', document, variables, transform: (data: { appLimitEvents?: { nodes?: InferSelectResult[]; }; }) => ({ appLimitEvent: data.appLimitEvents?.nodes?.[0] ?? null, }), }); } create( args: CreateArgs & { select: S; } & StrictSelect ): QueryBuilder<{ createAppLimitEvent: { appLimitEvent: InferSelectResult; }; }> { const { document, variables } = buildCreateDocument( 'AppLimitEvent', 'createAppLimitEvent', 'appLimitEvent', args.select, args.data, 'CreateAppLimitEventInput', connectionFieldsMap ); return new QueryBuilder({ client: this.client, operation: 'mutation', operationName: 'AppLimitEvent', fieldName: 'createAppLimitEvent', document, variables, }); } update( args: UpdateArgs< S, { id: string; createdAt: string; }, AppLimitEventPatch > & { select: S; } & StrictSelect ): QueryBuilder<{ updateAppLimitEvent: { appLimitEvent: InferSelectResult; }; }> { const { document, variables } = buildUpdateByPkDocument( 'AppLimitEvent', 'updateAppLimitEvent', 'appLimitEvent', args.select, args.where.id, args.data, 'UpdateAppLimitEventInput', 'id', 'appLimitEventPatch', connectionFieldsMap, { createdAt: args.where.createdAt, } ); return new QueryBuilder({ client: this.client, operation: 'mutation', operationName: 'AppLimitEvent', fieldName: 'updateAppLimitEvent', document, variables, }); } delete( args: DeleteArgs< { id: string; createdAt: string; }, S > & { select: S; } & StrictSelect ): QueryBuilder<{ deleteAppLimitEvent: { appLimitEvent: InferSelectResult; }; }> { const { document, variables } = buildDeleteByPkDocument( 'AppLimitEvent', 'deleteAppLimitEvent', 'appLimitEvent', { id: args.where.id, createdAt: args.where.createdAt, }, 'DeleteAppLimitEventInput', args.select, connectionFieldsMap ); return new QueryBuilder({ client: this.client, operation: 'mutation', operationName: 'AppLimitEvent', fieldName: 'deleteAppLimitEvent', document, variables, }); } }