Fakultas Ilmu Komputer UI

Commit 6d9d0753 authored by addffa's avatar addffa
Browse files

[REFACTOR] revisi fungsi delete mutation

parent 3b25d162
Pipeline #51247 passed with stage
in 9 minutes and 32 seconds
......@@ -22,20 +22,13 @@ class MustahikMutation(DjangoModelFormMutation):
class DeleteMustahik(graphene.Mutation):
class Arguments:
id = graphene.ID()
id = graphene.ID(required=True)
deleted = graphene.Boolean()
id_mustahik = graphene.ID()
name = graphene.String()
no_ktp = graphene.String()
def mutate(self, info, id):
mustahik = Mustahik.objects.get(pk=id)
name = mustahik.name
no_ktp = mustahik.no_ktp
mustahik.delete()
deleted = True
return DeleteMustahik(deleted=deleted, id_mustahik=id, name=name, no_ktp=no_ktp)
Mustahik.objects.get(pk=id).delete()
return DeleteMustahik(deleted=True)
class DataSourceMutation(DjangoModelFormMutation):
......@@ -47,7 +40,7 @@ class DataSourceMutation(DjangoModelFormMutation):
class DeleteDataSource(graphene.Mutation):
class Arguments:
id = graphene.ID()
id = graphene.ID(required=True)
deleted = graphene.Boolean()
......
......@@ -278,12 +278,9 @@ class MustahikGraphQLTestCase(GraphQLTestCase):
mustahik_id = mustahik.pk
response = self.query(
'''
mutation deleteMustahik($id: ID) {
mutation deleteMustahik($id: ID!) {
deleteMustahik(id: $id) {
deleted
idMustahik
name
noKtp
}
}
''',
......@@ -826,7 +823,7 @@ class MustahikGraphQLTestCase(GraphQLTestCase):
datasource = DataSource.objects.all()[0]
response = self.query(
'''
mutation deleteDataSource($id: ID) {
mutation deleteDataSource($id: ID!) {
deleteDataSource(id: $id) {
deleted
}
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment