/** * AuditLogAuth 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 { AuditLogAuth, AuditLogAuthWithRelations, AuditLogAuthSelect, AuditLogAuthFilter, AuditLogAuthOrderBy, CreateAuditLogAuthInput, UpdateAuditLogAuthInput, AuditLogAuthPatch, } from '../input-types'; import { connectionFieldsMap } from '../input-types'; export class AuditLogAuthModel { constructor(private client: OrmClient) {} findMany( args: FindManyArgs & { select: S; } & StrictSelect ): QueryBuilder<{ auditLogAuths: ConnectionResult>; }> { const { document, variables } = buildFindManyDocument( 'AuditLogAuth', 'auditLogAuths', 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, }, 'AuditLogAuthFilter', 'AuditLogAuthOrderBy', connectionFieldsMap ); return new QueryBuilder({ client: this.client, operation: 'query', operationName: 'AuditLogAuth', fieldName: 'auditLogAuths', document, variables, }); } findFirst( args: FindFirstArgs & { select: S; } & StrictSelect ): QueryBuilder<{ auditLogAuth: InferSelectResult | null; }> { const { document, variables } = buildFindFirstDocument( 'AuditLogAuth', 'auditLogAuths', args.select, { where: args?.where, orderBy: args?.orderBy as string[] | undefined, }, 'AuditLogAuthFilter', 'AuditLogAuthOrderBy', connectionFieldsMap ); return new QueryBuilder({ client: this.client, operation: 'query', operationName: 'AuditLogAuth', fieldName: 'auditLogAuth', document, variables, transform: (data: { auditLogAuths?: { nodes?: InferSelectResult[]; }; }) => ({ auditLogAuth: data.auditLogAuths?.nodes?.[0] ?? null, }), }); } findOne( args: { id: string; select: S; } & StrictSelect ): QueryBuilder<{ auditLogAuth: InferSelectResult | null; }> { const { document, variables } = buildFindManyDocument( 'AuditLogAuth', 'auditLogAuths', args.select, { where: { id: { equalTo: args.id, }, }, first: 1, }, 'AuditLogAuthFilter', 'AuditLogAuthOrderBy', connectionFieldsMap ); return new QueryBuilder({ client: this.client, operation: 'query', operationName: 'AuditLogAuth', fieldName: 'auditLogAuth', document, variables, transform: (data: { auditLogAuths?: { nodes?: InferSelectResult[]; }; }) => ({ auditLogAuth: data.auditLogAuths?.nodes?.[0] ?? null, }), }); } create( args: CreateArgs & { select: S; } & StrictSelect ): QueryBuilder<{ createAuditLogAuth: { auditLogAuth: InferSelectResult; }; }> { const { document, variables } = buildCreateDocument( 'AuditLogAuth', 'createAuditLogAuth', 'auditLogAuth', args.select, args.data, 'CreateAuditLogAuthInput', connectionFieldsMap ); return new QueryBuilder({ client: this.client, operation: 'mutation', operationName: 'AuditLogAuth', fieldName: 'createAuditLogAuth', document, variables, }); } update( args: UpdateArgs< S, { id: string; createdAt: string; }, AuditLogAuthPatch > & { select: S; } & StrictSelect ): QueryBuilder<{ updateAuditLogAuth: { auditLogAuth: InferSelectResult; }; }> { const { document, variables } = buildUpdateByPkDocument( 'AuditLogAuth', 'updateAuditLogAuth', 'auditLogAuth', args.select, args.where.id, args.data, 'UpdateAuditLogAuthInput', 'id', 'auditLogAuthPatch', connectionFieldsMap, { createdAt: args.where.createdAt, } ); return new QueryBuilder({ client: this.client, operation: 'mutation', operationName: 'AuditLogAuth', fieldName: 'updateAuditLogAuth', document, variables, }); } delete( args: DeleteArgs< { id: string; createdAt: string; }, S > & { select: S; } & StrictSelect ): QueryBuilder<{ deleteAuditLogAuth: { auditLogAuth: InferSelectResult; }; }> { const { document, variables } = buildDeleteByPkDocument( 'AuditLogAuth', 'deleteAuditLogAuth', 'auditLogAuth', { id: args.where.id, createdAt: args.where.createdAt, }, 'DeleteAuditLogAuthInput', args.select, connectionFieldsMap ); return new QueryBuilder({ client: this.client, operation: 'mutation', operationName: 'AuditLogAuth', fieldName: 'deleteAuditLogAuth', document, variables, }); } }