def mutate_and_get_payload(cls, root, info, **args):
        reviewee = get_node(args['reviewee_id'], info, User)
        reviewer = info.context.user

        if reviewee is None:
            return SavePersonReviewMutation(person_review=None)

        person_review = save_person_review(reviewee=reviewee, reviewer=reviewer, **args)
        return SavePersonReviewMutation(person_review=person_review)
    def mutate_and_get_payload(cls, root, info, **args):
        project_review = get_node(args['project_review_id'], info,
                                  ProjectReview)
        user = info.context.user

        if project_review is None:
            return DeleteProjectReviewMutation(deleted_project_review_id=None)

        project_review_id = delete_project_review(user, project_review)
        deleted_project_review_id = get_node_global_id(ProjectReviewNode,
                                                       project_review_id)
        return DeleteProjectReviewMutation(
            deleted_project_review_id=deleted_project_review_id)
Beispiel #3
0
    def mutate_and_get_payload(cls, root, info, **args):
        project = get_node(args['project_id'], info, Project)
        reviewee = info.context.user

        reviewers_id = args.get('reviewers_id', None)
        if reviewers_id is not None:
            reviewers = [
                get_node(reviewer_id, info, User)
                for reviewer_id in reviewers_id
            ]
            reviewers = list(filter(None, reviewers))  # remove None values
        else:
            reviewers = None

        if project is None:
            return SaveProjectReviewMutation(project_review=None)

        project_review = save_project_review(project,
                                             reviewee,
                                             reviewers=reviewers,
                                             **args)
        return SaveProjectReviewMutation(project_review=project_review)
Beispiel #4
0
    def mutate_and_get_payload(cls, root, info, **args):
        project_review = get_node(args['project_review_id'], info,
                                  ProjectReview)
        user = info.context.user

        if project_review is None:
            return SaveManagerProjectCommentMutation(
                manager_project_comment=None)

        manager_project_comment = save_manager_project_comment(
            project_review, user, **args)
        return SaveManagerProjectCommentMutation(
            manager_project_comment=manager_project_comment)
 def resolve_find_person_review(self, info, reviewee_id):
     reviewee = get_node(reviewee_id, info, User)
     reviewer = info.context.user
     return get_or_create_person_review(reviewee=reviewee,
                                        reviewer=reviewer)
 def resolve_project_reviews(self, info, reviewee_id=None):
     user = info.context.user
     if reviewee_id is None:
         return get_all_project_reviews(user=user)
     reviewee = get_node(reviewee_id, info, User)
     return get_user_project_reviews(user=user, reviewee=reviewee)
 def resolve_node(self, info, id):
     return get_node(global_id=id, info=info)