/** * PlatformFile 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 { PlatformFile, PlatformFileWithRelations, PlatformFileSelect, PlatformFileFilter, PlatformFileOrderBy, UpdatePlatformFileInput, PlatformFilePatch, } from '../input-types'; import { connectionFieldsMap } from '../input-types'; export class PlatformFileModel { constructor(private client: OrmClient) {} findMany( args: FindManyArgs & { select: S; } & StrictSelect ): QueryBuilder<{ platformFiles: ConnectionResult>; }> { const { document, variables } = buildFindManyDocument( 'PlatformFile', 'platformFiles', 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, }, 'PlatformFileFilter', 'PlatformFileOrderBy', connectionFieldsMap ); return new QueryBuilder({ client: this.client, operation: 'query', operationName: 'PlatformFile', fieldName: 'platformFiles', document, variables, }); } findFirst( args: FindFirstArgs & { select: S; } & StrictSelect ): QueryBuilder<{ platformFile: InferSelectResult | null; }> { const { document, variables } = buildFindFirstDocument( 'PlatformFile', 'platformFiles', args.select, { where: args?.where, orderBy: args?.orderBy as string[] | undefined, }, 'PlatformFileFilter', 'PlatformFileOrderBy', connectionFieldsMap ); return new QueryBuilder({ client: this.client, operation: 'query', operationName: 'PlatformFile', fieldName: 'platformFile', document, variables, transform: (data: { platformFiles?: { nodes?: InferSelectResult[]; }; }) => ({ platformFile: data.platformFiles?.nodes?.[0] ?? null, }), }); } findOne( args: { id: string; select: S; } & StrictSelect ): QueryBuilder<{ platformFile: InferSelectResult | null; }> { const { document, variables } = buildFindManyDocument( 'PlatformFile', 'platformFiles', args.select, { where: { id: { equalTo: args.id, }, }, first: 1, }, 'PlatformFileFilter', 'PlatformFileOrderBy', connectionFieldsMap ); return new QueryBuilder({ client: this.client, operation: 'query', operationName: 'PlatformFile', fieldName: 'platformFile', document, variables, transform: (data: { platformFiles?: { nodes?: InferSelectResult[]; }; }) => ({ platformFile: data.platformFiles?.nodes?.[0] ?? null, }), }); } update( args: UpdateArgs< S, { id: string; }, PlatformFilePatch > & { select: S; } & StrictSelect ): QueryBuilder<{ updatePlatformFile: { platformFile: InferSelectResult; }; }> { const { document, variables } = buildUpdateByPkDocument( 'PlatformFile', 'updatePlatformFile', 'platformFile', args.select, args.where.id, args.data, 'UpdatePlatformFileInput', 'id', 'platformFilePatch', connectionFieldsMap, undefined ); return new QueryBuilder({ client: this.client, operation: 'mutation', operationName: 'PlatformFile', fieldName: 'updatePlatformFile', document, variables, }); } delete( args: DeleteArgs< { id: string; }, S > & { select: S; } & StrictSelect ): QueryBuilder<{ deletePlatformFile: { platformFile: InferSelectResult; }; }> { const { document, variables } = buildDeleteByPkDocument( 'PlatformFile', 'deletePlatformFile', 'platformFile', { id: args.where.id, }, 'DeletePlatformFileInput', args.select, connectionFieldsMap ); return new QueryBuilder({ client: this.client, operation: 'mutation', operationName: 'PlatformFile', fieldName: 'deletePlatformFile', document, variables, }); } }