From a5f03bbcc7c0c7f9b407217b0db69ba02d44ca5a Mon Sep 17 00:00:00 2001 From: Sudan Bhandari Date: Fri, 18 Oct 2024 16:05:56 +0545 Subject: [PATCH] Add analysis pillar delete mutation --- apps/analysis/models.py | 3 +++ apps/analysis/mutation.py | 8 ++++++++ schema.graphql | 7 +++++++ 3 files changed, 18 insertions(+) diff --git a/apps/analysis/models.py b/apps/analysis/models.py index 4292313f39..52c0920d2a 100644 --- a/apps/analysis/models.py +++ b/apps/analysis/models.py @@ -349,6 +349,9 @@ def annotate_for_analysis_pillar_summary(cls, qs): analyzed_entries=models.F('dragged_entries') + models.F('discarded_entries'), ) + def can_delete(self, user): + return self.can_modify(user) + class DiscardedEntry(models.Model): """ diff --git a/apps/analysis/mutation.py b/apps/analysis/mutation.py index 008785d341..c3bdcc0b61 100644 --- a/apps/analysis/mutation.py +++ b/apps/analysis/mutation.py @@ -307,9 +307,17 @@ class Arguments: result = graphene.Field(AnalysisType) +class DeleteAnalysisPillar(AnalysisPillarMutationMixin, PsDeleteMutation): + class Arguments: + id = graphene.ID(required=True) + model = AnalysisPillar + result = graphene.Field(AnalysisPillarType) + + class Mutation(): # Analysis Pillar analysis_pillar_update = UpdateAnalysisPillar.Field() + analysis_pillar_delete = DeleteAnalysisPillar.Field() # Discarded Entry discarded_entry_create = CreateAnalysisPillarDiscardedEntry.Field() discarded_entry_update = UpdateAnalysisPillarDiscardedEntry.Field() diff --git a/schema.graphql b/schema.graphql index a67c964c2d..faee0e9414 100644 --- a/schema.graphql +++ b/schema.graphql @@ -3739,6 +3739,12 @@ type DeleteAnalysis { result: AnalysisType } +type DeleteAnalysisPillar { + errors: [GenericScalar!] + ok: Boolean + result: AnalysisPillarType +} + type DeleteAnalysisPillarDiscardedEntry { errors: [GenericScalar!] ok: Boolean @@ -5500,6 +5506,7 @@ type ProjectMutationType { updateAssessmentRegistry(data: AssessmentRegistryCreateInputType!, id: ID!): UpdateAssessmentRegistry deleteAssessmentRegistry(id: ID!): DeleteAssessmentRegistry analysisPillarUpdate(data: AnalysisPillarUpdateInputType!, id: ID!): UpdateAnalysisPillar + analysisPillarDelete(id: ID!): DeleteAnalysisPillar discardedEntryCreate(data: DiscardedEntryCreateInputType!): CreateAnalysisPillarDiscardedEntry discardedEntryUpdate(data: DiscardedEntryUpdateInputType!, id: ID!): UpdateAnalysisPillarDiscardedEntry discardedEntryDelete(id: ID!): DeleteAnalysisPillarDiscardedEntry