import * as TypeGraphQL from "type-graphql" ; import graphqlFields from "graphql-fields" ; import { GraphQLResolveInfo } from "graphql" ; import { GroupByMainUserArgs } from "./args/GroupByMainUserArgs" ; import { MainUser } from "../../../models/MainUser" ; import { MainUserGroupBy } from "../../outputs/MainUserGroupBy" ; import { transformFields , getPrismaFromContext , transformCountFieldIntoSelectRelationsCount } from "../../../helpers" ; @ TypeGraphQL . Resolver ( _of => MainUser ) export class GroupByMainUserResolver { @ TypeGraphQL . Query ( _returns => [ MainUserGroupBy ] , { nullable : false } ) async groupByMainUser ( @ TypeGraphQL . Ctx ( ) ctx , @ TypeGraphQL . Info ( ) info , @ TypeGraphQL . Args ( ) args ) { const { _count , _avg , _sum , _min , _max } = transformFields ( graphqlFields ( info as any ) ) ; return getPrismaFromContext ( ctx ) . user . groupBy ( { ... args , ... Object . fromEntries ( Object . entries ( { _count , _avg , _sum , _min , _max } ) . filter ( ( [ _ , v ] ) => v != null ) ) , } ) ; } }