import * as TypeGraphQL from "type-graphql" ; import graphqlFields from "graphql-fields" ; import { GraphQLResolveInfo } from "graphql" ; import { AggregateMainUserArgs } from "./args/AggregateMainUserArgs" ; import { CreateMainUserArgs } from "./args/CreateMainUserArgs" ; import { CreateManyMainUserArgs } from "./args/CreateManyMainUserArgs" ; import { DeleteMainUserArgs } from "./args/DeleteMainUserArgs" ; import { DeleteManyMainUserArgs } from "./args/DeleteManyMainUserArgs" ; import { FindFirstMainUserArgs } from "./args/FindFirstMainUserArgs" ; import { FindManyMainUserArgs } from "./args/FindManyMainUserArgs" ; import { FindUniqueMainUserArgs } from "./args/FindUniqueMainUserArgs" ; import { GroupByMainUserArgs } from "./args/GroupByMainUserArgs" ; import { UpdateMainUserArgs } from "./args/UpdateMainUserArgs" ; import { UpdateManyMainUserArgs } from "./args/UpdateManyMainUserArgs" ; import { UpsertMainUserArgs } from "./args/UpsertMainUserArgs" ; import { transformFields , getPrismaFromContext , transformCountFieldIntoSelectRelationsCount } from "../../../helpers" ; import { MainUser } from "../../../models/MainUser" ; import { AffectedRowsOutput } from "../../outputs/AffectedRowsOutput" ; import { AggregateMainUser } from "../../outputs/AggregateMainUser" ; import { MainUserGroupBy } from "../../outputs/MainUserGroupBy" ; @ TypeGraphQL . Resolver ( _of => MainUser ) export class MainUserCrudResolver { @ TypeGraphQL . Query ( _returns => MainUser , { nullable : true } ) async mainUser ( @ TypeGraphQL . Ctx ( ) ctx , @ TypeGraphQL . Info ( ) info , @ TypeGraphQL . Args ( ) args ) { const { _count } = transformFields ( graphqlFields ( info as any ) ) ; return getPrismaFromContext ( ctx ) . user . findUnique ( { ... args , ... ( _count && transformCountFieldIntoSelectRelationsCount ( _count ) ) , } ) ; } @ TypeGraphQL . Query ( _returns => MainUser , { nullable : true } ) async findFirstMainUser ( @ TypeGraphQL . Ctx ( ) ctx , @ TypeGraphQL . Info ( ) info , @ TypeGraphQL . Args ( ) args ) { const { _count } = transformFields ( graphqlFields ( info as any ) ) ; return getPrismaFromContext ( ctx ) . user . findFirst ( { ... args , ... ( _count && transformCountFieldIntoSelectRelationsCount ( _count ) ) , } ) ; } @ TypeGraphQL . Query ( _returns => [ MainUser ] , { nullable : false } ) async mainUsers ( @ TypeGraphQL . Ctx ( ) ctx , @ TypeGraphQL . Info ( ) info , @ TypeGraphQL . Args ( ) args ) { const { _count } = transformFields ( graphqlFields ( info as any ) ) ; return getPrismaFromContext ( ctx ) . user . findMany ( { ... args , ... ( _count && transformCountFieldIntoSelectRelationsCount ( _count ) ) , } ) ; } @ TypeGraphQL . Mutation ( _returns => MainUser , { nullable : false } ) async createMainUser ( @ TypeGraphQL . Ctx ( ) ctx , @ TypeGraphQL . Info ( ) info , @ TypeGraphQL . Args ( ) args ) { const { _count } = transformFields ( graphqlFields ( info as any ) ) ; return getPrismaFromContext ( ctx ) . user . create ( { ... args , ... ( _count && transformCountFieldIntoSelectRelationsCount ( _count ) ) , } ) ; } @ TypeGraphQL . Mutation ( _returns => AffectedRowsOutput , { nullable : false } ) async createManyMainUser ( @ TypeGraphQL . Ctx ( ) ctx , @ TypeGraphQL . Info ( ) info , @ TypeGraphQL . Args ( ) args ) { const { _count } = transformFields ( graphqlFields ( info as any ) ) ; return getPrismaFromContext ( ctx ) . user . createMany ( { ... args , ... ( _count && transformCountFieldIntoSelectRelationsCount ( _count ) ) , } ) ; } @ TypeGraphQL . Mutation ( _returns => MainUser , { nullable : true } ) async deleteMainUser ( @ TypeGraphQL . Ctx ( ) ctx , @ TypeGraphQL . Info ( ) info , @ TypeGraphQL . Args ( ) args ) { const { _count } = transformFields ( graphqlFields ( info as any ) ) ; return getPrismaFromContext ( ctx ) . user . delete ( { ... args , ... ( _count && transformCountFieldIntoSelectRelationsCount ( _count ) ) , } ) ; } @ TypeGraphQL . Mutation ( _returns => MainUser , { nullable : true } ) async updateMainUser ( @ TypeGraphQL . Ctx ( ) ctx , @ TypeGraphQL . Info ( ) info , @ TypeGraphQL . Args ( ) args ) { const { _count } = transformFields ( graphqlFields ( info as any ) ) ; return getPrismaFromContext ( ctx ) . user . update ( { ... args , ... ( _count && transformCountFieldIntoSelectRelationsCount ( _count ) ) , } ) ; } @ TypeGraphQL . Mutation ( _returns => AffectedRowsOutput , { nullable : false } ) async deleteManyMainUser ( @ TypeGraphQL . Ctx ( ) ctx , @ TypeGraphQL . Info ( ) info , @ TypeGraphQL . Args ( ) args ) { const { _count } = transformFields ( graphqlFields ( info as any ) ) ; return getPrismaFromContext ( ctx ) . user . deleteMany ( { ... args , ... ( _count && transformCountFieldIntoSelectRelationsCount ( _count ) ) , } ) ; } @ TypeGraphQL . Mutation ( _returns => AffectedRowsOutput , { nullable : false } ) async updateManyMainUser ( @ TypeGraphQL . Ctx ( ) ctx , @ TypeGraphQL . Info ( ) info , @ TypeGraphQL . Args ( ) args ) { const { _count } = transformFields ( graphqlFields ( info as any ) ) ; return getPrismaFromContext ( ctx ) . user . updateMany ( { ... args , ... ( _count && transformCountFieldIntoSelectRelationsCount ( _count ) ) , } ) ; } @ TypeGraphQL . Mutation ( _returns => MainUser , { nullable : false } ) async upsertMainUser ( @ TypeGraphQL . Ctx ( ) ctx , @ TypeGraphQL . Info ( ) info , @ TypeGraphQL . Args ( ) args ) { const { _count } = transformFields ( graphqlFields ( info as any ) ) ; return getPrismaFromContext ( ctx ) . user . upsert ( { ... args , ... ( _count && transformCountFieldIntoSelectRelationsCount ( _count ) ) , } ) ; } @ TypeGraphQL . Query ( _returns => AggregateMainUser , { nullable : false } ) async aggregateMainUser ( @ TypeGraphQL . Ctx ( ) ctx , @ TypeGraphQL . Info ( ) info , @ TypeGraphQL . Args ( ) args ) { return getPrismaFromContext ( ctx ) . user . aggregate ( { ... args , ... transformFields ( graphqlFields ( info as any ) ) , } ) ; } @ 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 ) ) , } ) ; } }