Skip to content

Commit

Permalink
is pinned project added in projectDetailType
Browse files Browse the repository at this point in the history
  • Loading branch information
sudan45 committed Jan 24, 2024
1 parent 761bc69 commit 32aff10
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 0 deletions.
18 changes: 18 additions & 0 deletions apps/project/schema.py
Original file line number Diff line number Diff line change
Expand Up @@ -250,6 +250,7 @@ class Meta:
organizations = graphene.List(graphene.NonNull(ProjectOrganizationType))
has_analysis_framework = graphene.Boolean(required=True)
has_assessment_template = graphene.Boolean(required=True)
is_project_pinned = graphene.Boolean(required=True)

# NOTE: This is a custom feature
# see: https://github.com/eamigo86/graphene-django-extras/compare/graphene-v2...the-deep:graphene-v2
Expand Down Expand Up @@ -301,6 +302,12 @@ def resolve_regions(root, info, **kwargs):
return info.context.dl.project.geo_region.load(root.pk)
return info.context.dl.project.public_geo_region.load(root.pk)

def resolve_is_project_pinned(root, info, **kwargs):
return ProjectPinned.objects.filter(
project=root,
user=info.context.request.user
).exists()


class RecentActivityType(graphene.ObjectType):
id = graphene.ID(required=True)
Expand Down Expand Up @@ -447,6 +454,10 @@ class Meta:
# Other scoped queries
unified_connector = graphene.Field(UnifiedConnectorQueryType)
assisted_tagging = graphene.Field(AssistedTaggingQueryType)
is_project_pinned = graphene.Boolean(
required=True,
description='Check if user have pinned the project'
)

@staticmethod
def resolve_user_members(root, info, **kwargs):
Expand Down Expand Up @@ -496,6 +507,13 @@ def resolve_assisted_tagging(root, info, **kwargs):
if root.get_current_user_role(info.context.request.user) is not None:
return {}

@staticmethod
def resolve_is_project_pinned(root, info, **kwargs):
return ProjectPinned.objects.filter(
project=root,
user=info.context.request.user
).exists()


class UserPinnedProjectType(ClientIdMixin, DjangoObjectType):
class Meta:
Expand Down
1 change: 1 addition & 0 deletions schema.graphql
Original file line number Diff line number Diff line change
Expand Up @@ -3336,6 +3336,7 @@ type ProjectDetailType {
vizData: ProjectVizDataType
unifiedConnector: UnifiedConnectorQueryType
assistedTagging: AssistedTaggingQueryType
isProjectPinned: Boolean!
}

type ProjectExploreStatType {
Expand Down

0 comments on commit 32aff10

Please sign in to comment.