Skip to content

partial update mutation #962

Discussion options

You must be logged in to vote

Set each field to nullable: true: if it's omitted no error from GraphQL is thrown.

Moreover, in the input class, each field that can be nullable/omitted should be set to optional using ?.

@InputType()
export class PositionUpdateInput implements Partial<Position> {
  @Field({ nullable: true })
  positionName?: string;

  @Field({ nullable: true })
  positionOfficeLocation?: string;

  @Field({ nullable: true })
  positionDepartment?: string;

  @Field({ nullable: true })
  positionTotalNeeded?: number;

  @Field({ nullable: true })
  positionStatus?: string;
}
@Mutation(() => Boolean, { nullable: false })
  async updatePosition(
    @Arg("positionId", type => ObjectIdScalar) positionId: Ob…

Replies: 1 comment 2 replies

Comment options

You must be logged in to vote
2 replies
@Sed9yDataBank
Comment options

@Sed9yDataBank
Comment options

Answer selected by Sed9yDataBank
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants