graphene-django-cud icon indicating copy to clipboard operation
graphene-django-cud copied to clipboard

Allow overwriting return ids in Batch Delete

Open rymanso opened this issue 3 years ago • 2 comments

Currently, return ids in both the DeleteMutation and the BatchDeleteMutation are base64 encoded using the to_global_id function in graphql_relay. The purpose is to ensure that between different models, ids of objects remain unique.

In DeleteMutation, there is a classmethod named get_return_id that can be overridden safely so long as you have your own ids that are unique between models.

However, the BatchDeleteMutation does not have this functionality, and this PR adds that so that users do not have to explicitly decode returned global ids - so long as they are already unique between different models.

Further, graphene-python allows the use of custom nodes. This PR will go hand in hand with this, if you choose to override the to_global_id method.

rymanso avatar Feb 03 '22 11:02 rymanso

Great! But please use the get_return_id from DeleteMutation as the template for your implementation, as it contains some additional complexity which can be useful here as well.

tOgg1 avatar Mar 13 '22 14:03 tOgg1

Apologies for the delayed response. I think I've added the complexity you are referring to in the DeleteMutation!

rymanso avatar Jun 10 '22 00:06 rymanso