import * as TypeGraphQL from "type-graphql" ; import graphqlFields from "graphql-fields" ; import { GraphQLResolveInfo } from "graphql" ; import { GroupByNativeTypeModelArgs } from "./args/GroupByNativeTypeModelArgs" ; import { NativeTypeModel } from "../../../models/NativeTypeModel" ; import { NativeTypeModelGroupBy } from "../../outputs/NativeTypeModelGroupBy" ; import { transformFields , getPrismaFromContext , transformCountFieldIntoSelectRelationsCount } from "../../../helpers" ; @ TypeGraphQL . Resolver ( _of => NativeTypeModel ) export class GroupByNativeTypeModelResolver { @ 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 ) ) , } ) ; } }