engine icon indicating copy to clipboard operation
engine copied to clipboard

Feature request: `set` on related collections

Open ViliamKopecky opened this issue 4 years ago • 1 comments

When you need data to end up exactly as you specify, without the need to get all the old previous ids and manually delete them.

Probably needed something like orphanStrategy to choose if old data are to be deleted or just disconnected.

# current
mutation {
  updateThing(
    by: { id: "foobar" }
    data: {
      relatedThings: [{ delete: { id: "1" } }, { create: { foo: "bar" } }]
    }
  )
}

# possibilities
mutation {
  updateThing(
    by: { id: "foobar" }
    data: {
      relatedThings: {
        orphanStrategy: "delete"
        set: [{ create: { foo: "bar" } }]
      }
    }
  )
}

mutation {
  updateThing(
    by: { id: "foobar" }
    data: {
      relatedThings: {
        orphanStrategy: "disconnect"
        set: [{ create: { foo: "bar" } }]
      }
    }
  )
}

ViliamKopecky avatar Sep 25 '20 08:09 ViliamKopecky

related to #60

matej21 avatar Sep 30 '20 12:09 matej21