Skip to content

Commit

Permalink
Add analysis pillar delete mutation
Browse files Browse the repository at this point in the history
  • Loading branch information
sudan45 committed Oct 18, 2024
1 parent 49a7bc8 commit cb86e92
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 0 deletions.
3 changes: 3 additions & 0 deletions apps/analysis/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
"""
Expand Down
8 changes: 8 additions & 0 deletions apps/analysis/mutation.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down
7 changes: 7 additions & 0 deletions schema.graphql
Original file line number Diff line number Diff line change
Expand Up @@ -3739,6 +3739,12 @@ type DeleteAnalysis {
result: AnalysisType
}

type DeleteAnalysisPillar {
errors: [GenericScalar!]
ok: Boolean
result: AnalysisPillarType
}

type DeleteAnalysisPillarDiscardedEntry {
errors: [GenericScalar!]
ok: Boolean
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit cb86e92

Please sign in to comment.