prisma1 icon indicating copy to clipboard operation
prisma1 copied to clipboard

Clone and/or copy a node

Open jcarva opened this issue 9 years ago • 2 comments

I have a type Project on my graphcool schema, and I want to copy, or clone a specific project node by ID when an event happens in my front-end (React + Apollo).

My first thought was to get the data by a query and create a new node project using the queried data, but have a mutation available that covers the workflow to clone or copy would be easier than that solution.

In that way would be extremely nice to have a way like to create, delete, or update (https://www.graph.cool/docs/reference/relay-api/mutations-vah0igucil/) to copy or clone any node, just passing the ID to the action.

I'm bringing this feature-request after discuss a little with @marktani at Graphcool Forum and Slack.

jcarva avatar Aug 06 '17 00:08 jcarva

What would happen with relationships when a node is cloned?

For example if there is a type Subproject and Project has a 1-n relationship with it, what happens when a Project is cloned? The existing relationship can't be duplicated because each Subproject can only have one Project. Should the Subproject be cloned as well? What about n-n relationships? If Subproject has relationships with other types of node as well then how does Graph.cool know how deep to take the cloning?

danmkent avatar Aug 15 '17 08:08 danmkent

This issue has been moved to graphcool/graphcool-framework.

marktani avatar Jan 23 '18 15:01 marktani