Skip to content

Dis-/connect for mutating realations #184

Open
@Andy2003

Description

@Andy2003

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!
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    API-AlignmentAlign the API with the one defined by @neo4j/graphql

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions