Fix graphql queries
This commit is contained in:
@ -0,0 +1,19 @@
|
||||
import * as TypeGraphQL from "type-graphql";
|
||||
import type { GraphQLResolveInfo } from "graphql";
|
||||
import { UpdateOnePersonArgs } from "./args/UpdateOnePersonArgs";
|
||||
import { Person } from "../../../models/Person";
|
||||
import { transformInfoIntoPrismaArgs, getPrismaFromContext, transformCountFieldIntoSelectRelationsCount } from "../../../helpers";
|
||||
|
||||
@TypeGraphQL.Resolver(_of => Person)
|
||||
export class UpdateOnePersonResolver {
|
||||
@TypeGraphQL.Mutation(_returns => Person, {
|
||||
nullable: true
|
||||
})
|
||||
async updateOnePerson(@TypeGraphQL.Ctx() ctx: any, @TypeGraphQL.Info() info: GraphQLResolveInfo, @TypeGraphQL.Args() args: UpdateOnePersonArgs): Promise<Person | null> {
|
||||
const { _count } = transformInfoIntoPrismaArgs(info);
|
||||
return getPrismaFromContext(ctx).person.update({
|
||||
...args,
|
||||
...(_count && transformCountFieldIntoSelectRelationsCount(_count)),
|
||||
});
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user