neo4j-graphql-java icon indicating copy to clipboard operation
neo4j-graphql-java copied to clipboard

Dis-/connect for mutating realations

Open Andy2003 opened this issue 3 years ago • 0 comments

given the schema

type Actor {
    name: String
}

type Movie {
    id: ID
    actors: [Actor]! @relationship(type: "ACTED_IN", direction: "IN")
}

The following update schema will be generated (only the relevant parts are shown here):

input ActorConnectFieldInput {
  where: ActorWhere
}

input ActorDisconnectFieldInput {
  where: ActorWhere
}

input MovieActorsFieldInput {
  connect: [ActorConnectFieldInput]
  create: [ActorCreateInput]
}

input MovieRelationInput {
  actors: [ActorCreateInput]
}

input MovieUpdateInput {
  id: ID
  actors: [MovieActorsUpdateFieldInput]
}

input ActorDeleteFieldInput {
  where: ActorWhere
}

input MovieActorsUpdateFieldInput {
  connect: [ActorConnectFieldInput]
  create: [ActorCreateInput]
  disconnect: [ActorDisconnectFieldInput]
  update: ActorUpdateInput
  where: ActorWhere
  delete: [ActorDeleteFieldInput]
}

input MovieConnectInput {
  actors: [ActorConnectFieldInput]
}

input MovieDisconnectInput {
  actors: [ActorDisconnectFieldInput]
}

input ActorUpdateInput {
  name: String
}

input MovieActorsDeleteInput {
  where: ActorWhere
}

input MovieDeleteInput {
  actors: [MovieActorsDeleteInput]
}

type UpdateMoviesMutationResponse {
  movies: [Movie!]!
}

type CreateActorsMutationResponse {
  actors: [Actor!]!
}

type UpdateActorsMutationResponse {
  actors: [Actor!]!
}

type Mutation {
  deleteMovies(
    where: MovieWhere
    delete: MovieDeleteInput
  ): DeleteInfo!
  deleteActors(where: ActorWhere): DeleteInfo!
  updateMovies(where: MovieWhere, update: MovieUpdateInput, connect: MovieConnectInput, disconnect: MovieDisconnectInput, create: MovieRelationInput, delete: MovieDeleteInput): UpdateMoviesMutationResponse!
  updateActors(where: ActorWhere, update: ActorUpdateInput): UpdateActorsMutationResponse!
}

Andy2003 avatar Mar 05 '21 15:03 Andy2003