Update delete mutation signature
This commit is contained in:
parent
6ce2f297d7
commit
866e6f718c
|
|
@ -137,7 +137,7 @@ class UpdateRoomEntry(MutateRoomEntry):
|
||||||
|
|
||||||
class DeleteRoomEntry(relay.ClientIDMutation):
|
class DeleteRoomEntry(relay.ClientIDMutation):
|
||||||
class Input:
|
class Input:
|
||||||
id = graphene.ID(required=True)
|
slug = graphene.String(required=True)
|
||||||
|
|
||||||
success = graphene.Boolean()
|
success = graphene.Boolean()
|
||||||
room_slug = graphene.String()
|
room_slug = graphene.String()
|
||||||
|
|
@ -146,8 +146,8 @@ class DeleteRoomEntry(relay.ClientIDMutation):
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def mutate_and_get_payload(cls, root, info, **kwargs):
|
def mutate_and_get_payload(cls, root, info, **kwargs):
|
||||||
id = kwargs.get('id')
|
slug = kwargs.get('slug')
|
||||||
room_entry = get_object(RoomEntry, id)
|
room_entry = RoomEntry.objects.get(slug=slug)
|
||||||
if room_entry.author.pk != info.context.user.pk:
|
if room_entry.author.pk != info.context.user.pk:
|
||||||
raise Exception('You are not the owner of this room entry')
|
raise Exception('You are not the owner of this room entry')
|
||||||
room_id = to_global_id('RoomNode', room_entry.room.pk)
|
room_id = to_global_id('RoomNode', room_entry.room.pk)
|
||||||
|
|
|
||||||
|
|
@ -65,7 +65,7 @@ class RoomEntryMutationsTestCase(SkillboxTestCase):
|
||||||
|
|
||||||
result = self.client.execute(mutation, variables={
|
result = self.client.execute(mutation, variables={
|
||||||
'input': {
|
'input': {
|
||||||
'id': to_global_id('RoomEntryNode', self.room_entry.pk)
|
'slug': self.room_entry.slug
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
self.assertIsNone(result.get('errors'))
|
self.assertIsNone(result.get('errors'))
|
||||||
|
|
|
||||||
|
|
@ -421,7 +421,7 @@ type DeleteProjectPayload {
|
||||||
}
|
}
|
||||||
|
|
||||||
input DeleteRoomEntryInput {
|
input DeleteRoomEntryInput {
|
||||||
id: ID!
|
slug: String!
|
||||||
clientMutationId: String
|
clientMutationId: String
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue