import * as TypeGraphQL from "type-graphql" ; import graphqlFields from "graphql-fields" ; import { GraphQLResolveInfo } from "graphql" ; import { AggregatePatientArgs } from "./args/AggregatePatientArgs" ; import { CreateManyPatientArgs } from "./args/CreateManyPatientArgs" ; import { CreatePatientArgs } from "./args/CreatePatientArgs" ; import { DeleteManyPatientArgs } from "./args/DeleteManyPatientArgs" ; import { DeletePatientArgs } from "./args/DeletePatientArgs" ; import { FindFirstPatientArgs } from "./args/FindFirstPatientArgs" ; import { FindManyPatientArgs } from "./args/FindManyPatientArgs" ; import { FindUniquePatientArgs } from "./args/FindUniquePatientArgs" ; import { GroupByPatientArgs } from "./args/GroupByPatientArgs" ; import { UpdateManyPatientArgs } from "./args/UpdateManyPatientArgs" ; import { UpdatePatientArgs } from "./args/UpdatePatientArgs" ; import { UpsertPatientArgs } from "./args/UpsertPatientArgs" ; import { transformFields , getPrismaFromContext , transformCountFieldIntoSelectRelationsCount } from "../../../helpers" ; import { Patient } from "../../../models/Patient" ; import { AffectedRowsOutput } from "../../outputs/AffectedRowsOutput" ; import { AggregatePatient } from "../../outputs/AggregatePatient" ; import { PatientGroupBy } from "../../outputs/PatientGroupBy" ; @ TypeGraphQL . Resolver ( _of => Patient ) export class PatientCrudResolver { @ TypeGraphQL . Query ( _returns => Patient , { nullable : true } ) async patient ( @ TypeGraphQL . Ctx ( ) ctx , @ TypeGraphQL . Info ( ) info , @ TypeGraphQL . Args ( ) args ) { const { _count } = transformFields ( graphqlFields ( info as any ) ) ; return getPrismaFromContext ( ctx ) . patient . findUnique ( { ... args , ... ( _count && transformCountFieldIntoSelectRelationsCount ( _count ) ) , } ) ; } @ TypeGraphQL . Query ( _returns => Patient , { nullable : true } ) async findFirstPatient ( @ TypeGraphQL . Ctx ( ) ctx , @ TypeGraphQL . Info ( ) info , @ TypeGraphQL . Args ( ) args ) { const { _count } = transformFields ( graphqlFields ( info as any ) ) ; return getPrismaFromContext ( ctx ) . patient . findFirst ( { ... args , ... ( _count && transformCountFieldIntoSelectRelationsCount ( _count ) ) , } ) ; } @ TypeGraphQL . Query ( _returns => [ Patient ] , { nullable : false } ) async patients ( @ TypeGraphQL . Ctx ( ) ctx , @ TypeGraphQL . Info ( ) info , @ TypeGraphQL . Args ( ) args ) { const { _count } = transformFields ( graphqlFields ( info as any ) ) ; return getPrismaFromContext ( ctx ) . patient . findMany ( { ... args , ... ( _count && transformCountFieldIntoSelectRelationsCount ( _count ) ) , } ) ; } @ TypeGraphQL . Mutation ( _returns => Patient , { nullable : false } ) async createPatient ( @ TypeGraphQL . Ctx ( ) ctx , @ TypeGraphQL . Info ( ) info , @ TypeGraphQL . Args ( ) args ) { const { _count } = transformFields ( graphqlFields ( info as any ) ) ; return getPrismaFromContext ( ctx ) . patient . create ( { ... args , ... ( _count && transformCountFieldIntoSelectRelationsCount ( _count ) ) , } ) ; } @ TypeGraphQL . Mutation ( _returns => AffectedRowsOutput , { nullable : false } ) async createManyPatient ( @ TypeGraphQL . Ctx ( ) ctx , @ TypeGraphQL . Info ( ) info , @ TypeGraphQL . Args ( ) args ) { const { _count } = transformFields ( graphqlFields ( info as any ) ) ; return getPrismaFromContext ( ctx ) . patient . createMany ( { ... args , ... ( _count && transformCountFieldIntoSelectRelationsCount ( _count ) ) , } ) ; } @ TypeGraphQL . Mutation ( _returns => Patient , { nullable : true } ) async deletePatient ( @ TypeGraphQL . Ctx ( ) ctx , @ TypeGraphQL . Info ( ) info , @ TypeGraphQL . Args ( ) args ) { const { _count } = transformFields ( graphqlFields ( info as any ) ) ; return getPrismaFromContext ( ctx ) . patient . delete ( { ... args , ... ( _count && transformCountFieldIntoSelectRelationsCount ( _count ) ) , } ) ; } @ TypeGraphQL . Mutation ( _returns => Patient , { nullable : true } ) async updatePatient ( @ TypeGraphQL . Ctx ( ) ctx , @ TypeGraphQL . Info ( ) info , @ TypeGraphQL . Args ( ) args ) { const { _count } = transformFields ( graphqlFields ( info as any ) ) ; return getPrismaFromContext ( ctx ) . patient . update ( { ... args , ... ( _count && transformCountFieldIntoSelectRelationsCount ( _count ) ) , } ) ; } @ TypeGraphQL . Mutation ( _returns => AffectedRowsOutput , { nullable : false } ) async deleteManyPatient ( @ TypeGraphQL . Ctx ( ) ctx , @ TypeGraphQL . Info ( ) info , @ TypeGraphQL . Args ( ) args ) { const { _count } = transformFields ( graphqlFields ( info as any ) ) ; return getPrismaFromContext ( ctx ) . patient . deleteMany ( { ... args , ... ( _count && transformCountFieldIntoSelectRelationsCount ( _count ) ) , } ) ; } @ TypeGraphQL . Mutation ( _returns => AffectedRowsOutput , { nullable : false } ) async updateManyPatient ( @ TypeGraphQL . Ctx ( ) ctx , @ TypeGraphQL . Info ( ) info , @ TypeGraphQL . Args ( ) args ) { const { _count } = transformFields ( graphqlFields ( info as any ) ) ; return getPrismaFromContext ( ctx ) . patient . updateMany ( { ... args , ... ( _count && transformCountFieldIntoSelectRelationsCount ( _count ) ) , } ) ; } @ TypeGraphQL . Mutation ( _returns => Patient , { nullable : false } ) async upsertPatient ( @ TypeGraphQL . Ctx ( ) ctx , @ TypeGraphQL . Info ( ) info , @ TypeGraphQL . Args ( ) args ) { const { _count } = transformFields ( graphqlFields ( info as any ) ) ; return getPrismaFromContext ( ctx ) . patient . upsert ( { ... args , ... ( _count && transformCountFieldIntoSelectRelationsCount ( _count ) ) , } ) ; } @ TypeGraphQL . Query ( _returns => AggregatePatient , { nullable : false } ) async aggregatePatient ( @ TypeGraphQL . Ctx ( ) ctx , @ TypeGraphQL . Info ( ) info , @ TypeGraphQL . Args ( ) args ) { return getPrismaFromContext ( ctx ) . patient . aggregate ( { ... args , ... transformFields ( graphqlFields ( info as any ) ) , } ) ; } @ TypeGraphQL . Query ( _returns => [ PatientGroupBy ] , { nullable : false } ) async groupByPatient ( @ TypeGraphQL . Ctx ( ) ctx , @ TypeGraphQL . Info ( ) info , @ TypeGraphQL . Args ( ) args ) { const { _count , _avg , _sum , _min , _max } = transformFields ( graphqlFields ( info as any ) ) ; return getPrismaFromContext ( ctx ) . patient . groupBy ( { ... args , ... Object . fromEntries ( Object . entries ( { _count , _avg , _sum , _min , _max } ) . filter ( ( [ _ , v ] ) => v != null ) ) , } ) ; } }