Skip to content

Commit

Permalink
schemaType added in schema.graphql
Browse files Browse the repository at this point in the history
  • Loading branch information
sudan45 committed Jul 26, 2023
1 parent def6748 commit d19221d
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 13 deletions.
27 changes: 14 additions & 13 deletions apps/assessment_registry/dashboard_schema.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,21 +7,22 @@
from django.db.models import Count


class AssessmentCount(graphene.ObjectType):
class AssessmentCountType(graphene.ObjectType):
coordinated_joint = graphene.Field(AssessmentRegistryCoordinationTypeEnum)
coordinated_joint_display = graphene.String()
count = graphene.Int()

def resolve_coordinated_joint_display(self, info):
return AssessmentRegistry.CoordinationType(self.coordinated_joint).label
return AssessmentRegistry.CoordinationType(
self.coordinated_joint).label


class StakeholderCount(graphene.ObjectType):
class StakeholderCountType(graphene.ObjectType):
stakeholder = graphene.String()
count = graphene.Int()


class CollectionTechniqueCount(graphene.ObjectType):
class CollectionTechniqueCountType(graphene.ObjectType):
data_collection_technique = graphene.Field(
AssessmentRegistryDataCollectionTechniqueTypeEnum
)
Expand All @@ -34,10 +35,10 @@ def resolve_data_collection_technique_display(self, info):
).label


class AssessmentDashboardStatistics(graphene.ObjectType):
assessment_count = graphene.List(AssessmentCount)
stakeholder_count = graphene.List(StakeholderCount)
collection_technique_count = graphene.List(CollectionTechniqueCount)
class AssessmentDashboardStatisticsType(graphene.ObjectType):
assessment_count = graphene.List(AssessmentCountType)
stakeholder_count = graphene.List(StakeholderCountType)
collection_technique_count = graphene.List(CollectionTechniqueCountType)
model = AssessmentRegistry

def resolve_assessment_count(self, info):
Expand All @@ -48,7 +49,7 @@ def resolve_assessment_count(self, info):
.order_by("coordinated_joint")
)
return [
AssessmentCount(
AssessmentCountType(
coordinated_joint=assessment["coordinated_joint"],
count=assessment["count"],
)
Expand All @@ -63,7 +64,7 @@ def resolve_stakeholder_count(self, info):
.order_by("lead_organizations")
)
return [
StakeholderCount(
StakeholderCountType(
stakeholder=stakeholder["lead_organizations__title"],
count=stakeholder["count"],
)
Expand All @@ -80,7 +81,7 @@ def resolve_collection_technique_count(self, info):
.order_by("data_collection_technique")
)
return [
CollectionTechniqueCount(
CollectionTechniqueCountType(
data_collection_technique=technique["data_collection_technique"],
count=technique["count"],
)
Expand All @@ -90,8 +91,8 @@ def resolve_collection_technique_count(self, info):

class Query:
assessment_dashboard_statistics = graphene.Field(
AssessmentDashboardStatistics)
AssessmentDashboardStatisticsType)

@staticmethod
def resolve_assessment_dashboard_statistics(root, info, **kwargs):
return AssessmentDashboardStatistics
return AssessmentDashboardStatisticsType
24 changes: 24 additions & 0 deletions schema.graphql
Original file line number Diff line number Diff line change
Expand Up @@ -483,6 +483,18 @@ type AnalyticalStatementType {
entries: [AnalyticalStatementEntryType!]
}

type AssessmentCountType {
coordinatedJoint: AssessmentRegistryCoordinationTypeEnum
coordinatedJointDisplay: String
count: Int
}

type AssessmentDashboardStatisticsType {
assessmentCount: [AssessmentCountType]
stakeholderCount: [StakeholderCountType]
collectionTechniqueCount: [CollectionTechniqueCountType]
}

type AssessmentListType {
results: [AssessmentType!]
totalCount: Int
Expand Down Expand Up @@ -1086,6 +1098,12 @@ type ChangeUserPassword {
ok: Boolean
}

type CollectionTechniqueCountType {
dataCollectionTechnique: AssessmentRegistryDataCollectionTechniqueTypeEnum
dataCollectionTechniqueDisplay: String
count: Int
}

enum ConnectorLeadExtractionStatusEnum {
PENDING
RETRYING
Expand Down Expand Up @@ -2713,6 +2731,7 @@ type ProjectDetailType {
organizations: [ProjectOrganizationType!]
hasAnalysisFramework: Boolean!
hasAssessmentTemplate: Boolean!
assessmentDashboardStatistics: AssessmentDashboardStatisticsType
assessmentRegistry(id: ID!): AssessmentRegistryType
assessmentRegistries(createdAt: DateTime, createdAtGte: DateTime, createdAtLte: DateTime, modifiedAt: DateTime, modifiedAtGte: DateTime, modifiedAtLte: DateTime, createdBy: [ID], modifiedBy: [ID!], project: [ID], lead: [ID], search: String, page: Int = 1, pageSize: Int): AssessmentRegistryListType
assessmentRegOptions: AssessmentRegistryOptionsType
Expand Down Expand Up @@ -3423,6 +3442,11 @@ type SectionType {
widgets: [WidgetType!]
}

type StakeholderCountType {
stakeholder: String
count: Int
}

type SummaryColumnType {
colName: String
colValue: Int
Expand Down

0 comments on commit d19221d

Please sign in to comment.