import * as TypeGraphQL from "type-graphql" ; import graphqlFields from "graphql-fields" ; import { GraphQLResolveInfo } from "graphql" ; import { AggregateNativeTypeModelArgs } from "./args/AggregateNativeTypeModelArgs" ; import { CreateManyNativeTypeModelArgs } from "./args/CreateManyNativeTypeModelArgs" ; import { CreateNativeTypeModelArgs } from "./args/CreateNativeTypeModelArgs" ; import { DeleteManyNativeTypeModelArgs } from "./args/DeleteManyNativeTypeModelArgs" ; import { DeleteNativeTypeModelArgs } from "./args/DeleteNativeTypeModelArgs" ; import { FindFirstNativeTypeModelArgs } from "./args/FindFirstNativeTypeModelArgs" ; import { FindManyNativeTypeModelArgs } from "./args/FindManyNativeTypeModelArgs" ; import { FindUniqueNativeTypeModelArgs } from "./args/FindUniqueNativeTypeModelArgs" ; import { GroupByNativeTypeModelArgs } from "./args/GroupByNativeTypeModelArgs" ; import { UpdateManyNativeTypeModelArgs } from "./args/UpdateManyNativeTypeModelArgs" ; import { UpdateNativeTypeModelArgs } from "./args/UpdateNativeTypeModelArgs" ; import { UpsertNativeTypeModelArgs } from "./args/UpsertNativeTypeModelArgs" ; import { transformFields , getPrismaFromContext , transformCountFieldIntoSelectRelationsCount } from "../../../helpers" ; import { NativeTypeModel } from "../../../models/NativeTypeModel" ; import { AffectedRowsOutput } from "../../outputs/AffectedRowsOutput" ; import { AggregateNativeTypeModel } from "../../outputs/AggregateNativeTypeModel" ; import { NativeTypeModelGroupBy } from "../../outputs/NativeTypeModelGroupBy" ; @ TypeGraphQL . Resolver ( _of => NativeTypeModel ) export class NativeTypeModelCrudResolver { @ TypeGraphQL . Query ( _returns => NativeTypeModel , { nullable : true } ) async nativeTypeModel ( @ TypeGraphQL . Ctx ( ) ctx , @ TypeGraphQL . Info ( ) info , @ TypeGraphQL . Args ( ) args ) { const { _count } = transformFields ( graphqlFields ( info as any ) ) ; return getPrismaFromContext ( ctx ) . nativeTypeModel . findUnique ( { ... args , ... ( _count && transformCountFieldIntoSelectRelationsCount ( _count ) ) , } ) ; } @ TypeGraphQL . Query ( _returns => NativeTypeModel , { nullable : true } ) async findFirstNativeTypeModel ( @ TypeGraphQL . Ctx ( ) ctx , @ TypeGraphQL . Info ( ) info , @ TypeGraphQL . Args ( ) args ) { const { _count } = transformFields ( graphqlFields ( info as any ) ) ; return getPrismaFromContext ( ctx ) . nativeTypeModel . findFirst ( { ... args , ... ( _count && transformCountFieldIntoSelectRelationsCount ( _count ) ) , } ) ; } @ TypeGraphQL . Query ( _returns => [ NativeTypeModel ] , { nullable : false } ) async nativeTypeModels ( @ TypeGraphQL . Ctx ( ) ctx , @ TypeGraphQL . Info ( ) info , @ TypeGraphQL . Args ( ) args ) { const { _count } = transformFields ( graphqlFields ( info as any ) ) ; return getPrismaFromContext ( ctx ) . nativeTypeModel . findMany ( { ... args , ... ( _count && transformCountFieldIntoSelectRelationsCount ( _count ) ) , } ) ; } @ TypeGraphQL . Mutation ( _returns => NativeTypeModel , { nullable : false } ) async createNativeTypeModel ( @ TypeGraphQL . Ctx ( ) ctx , @ TypeGraphQL . Info ( ) info , @ TypeGraphQL . Args ( ) args ) { const { _count } = transformFields ( graphqlFields ( info as any ) ) ; return getPrismaFromContext ( ctx ) . nativeTypeModel . create ( { ... args , ... ( _count && transformCountFieldIntoSelectRelationsCount ( _count ) ) , } ) ; } @ TypeGraphQL . Mutation ( _returns => AffectedRowsOutput , { nullable : false } ) async createManyNativeTypeModel ( @ TypeGraphQL . Ctx ( ) ctx , @ TypeGraphQL . Info ( ) info , @ TypeGraphQL . Args ( ) args ) { const { _count } = transformFields ( graphqlFields ( info as any ) ) ; return getPrismaFromContext ( ctx ) . nativeTypeModel . createMany ( { ... args , ... ( _count && transformCountFieldIntoSelectRelationsCount ( _count ) ) , } ) ; } @ TypeGraphQL . Mutation ( _returns => NativeTypeModel , { nullable : true } ) async deleteNativeTypeModel ( @ TypeGraphQL . Ctx ( ) ctx , @ TypeGraphQL . Info ( ) info , @ TypeGraphQL . Args ( ) args ) { const { _count } = transformFields ( graphqlFields ( info as any ) ) ; return getPrismaFromContext ( ctx ) . nativeTypeModel . delete ( { ... args , ... ( _count && transformCountFieldIntoSelectRelationsCount ( _count ) ) , } ) ; } @ TypeGraphQL . Mutation ( _returns => NativeTypeModel , { nullable : true } ) async updateNativeTypeModel ( @ TypeGraphQL . Ctx ( ) ctx , @ TypeGraphQL . Info ( ) info , @ TypeGraphQL . Args ( ) args ) { const { _count } = transformFields ( graphqlFields ( info as any ) ) ; return getPrismaFromContext ( ctx ) . nativeTypeModel . update ( { ... args , ... ( _count && transformCountFieldIntoSelectRelationsCount ( _count ) ) , } ) ; } @ TypeGraphQL . Mutation ( _returns => AffectedRowsOutput , { nullable : false } ) async deleteManyNativeTypeModel ( @ TypeGraphQL . Ctx ( ) ctx , @ TypeGraphQL . Info ( ) info , @ TypeGraphQL . Args ( ) args ) { const { _count } = transformFields ( graphqlFields ( info as any ) ) ; return getPrismaFromContext ( ctx ) . nativeTypeModel . deleteMany ( { ... args , ... ( _count && transformCountFieldIntoSelectRelationsCount ( _count ) ) , } ) ; } @ TypeGraphQL . Mutation ( _returns => AffectedRowsOutput , { nullable : false } ) async updateManyNativeTypeModel ( @ TypeGraphQL . Ctx ( ) ctx , @ TypeGraphQL . Info ( ) info , @ TypeGraphQL . Args ( ) args ) { const { _count } = transformFields ( graphqlFields ( info as any ) ) ; return getPrismaFromContext ( ctx ) . nativeTypeModel . updateMany ( { ... args , ... ( _count && transformCountFieldIntoSelectRelationsCount ( _count ) ) , } ) ; } @ TypeGraphQL . Mutation ( _returns => NativeTypeModel , { nullable : false } ) async upsertNativeTypeModel ( @ TypeGraphQL . Ctx ( ) ctx , @ TypeGraphQL . Info ( ) info , @ TypeGraphQL . Args ( ) args ) { const { _count } = transformFields ( graphqlFields ( info as any ) ) ; return getPrismaFromContext ( ctx ) . nativeTypeModel . upsert ( { ... args , ... ( _count && transformCountFieldIntoSelectRelationsCount ( _count ) ) , } ) ; } @ TypeGraphQL . Query ( _returns => AggregateNativeTypeModel , { nullable : false } ) async aggregateNativeTypeModel ( @ TypeGraphQL . Ctx ( ) ctx , @ TypeGraphQL . Info ( ) info , @ TypeGraphQL . Args ( ) args ) { return getPrismaFromContext ( ctx ) . nativeTypeModel . aggregate ( { ... args , ... transformFields ( graphqlFields ( info as any ) ) , } ) ; } @ TypeGraphQL . Query ( _returns => [ NativeTypeModelGroupBy ] , { nullable : false } ) async groupByNativeTypeModel ( @ TypeGraphQL . Ctx ( ) ctx , @ TypeGraphQL . Info ( ) info , @ TypeGraphQL . Args ( ) args ) { const { _count , _avg , _sum , _min , _max } = transformFields ( graphqlFields ( info as any ) ) ; return getPrismaFromContext ( ctx ) . nativeTypeModel . groupBy ( { ... args , ... Object . fromEntries ( Object . entries ( { _count , _avg , _sum , _min , _max } ) . filter ( ( [ _ , v ] ) => v != null ) ) , } ) ; } }