Beispiel #1
0
    def __get_relationship_type(self, current_user, research):
        relationship_types = {}
        if current_user:
            relationship = ResearchRelationship.get(research.key, current_user.email)
            if relationship:
                relationship_types[research.key.id()] = relationship.type

        return relationship_types
Beispiel #2
0
    def post(self, research, user, current_user):
        relationship = ResearchRelationship.get(research.key, user.email)

        if not relationship or relationship.type != RelationshipType.WANTS_TO_JOIN:
            return bad_request('User don\'t want to join.')

        relationship.type = RelationshipType.REJECTED
        relationship.put()

        return ok_msg('Researcher rejected.')
Beispiel #3
0
Datei: me.py Projekt: szkocka/api
    def post(self, current_user, research):
        relationship = ResearchRelationship.get(research.key, current_user.email)

        if not relationship or relationship.type != RelationshipType.INVITED:
            return bad_request('You not invited.')

        relationship.type = RelationshipType.REJECTED
        relationship.put()

        return ok_msg('Invitation rejected.')
Beispiel #4
0
    def post(self, research, user, current_user):
        relationship = ResearchRelationship.get(research.key, user.email)

        if not relationship or relationship.type != RelationshipType.WANTS_TO_JOIN:
            return bad_request('User don\'t want to join.')

        research.researchers_keys.append(user.key)
        research.put()

        relationship.type = RelationshipType.APPROVED
        relationship.put()

        user.researcher_in += 1
        user.put()

        return ok_msg('Researcher accepted.')
Beispiel #5
0
Datei: me.py Projekt: szkocka/api
    def post(self, current_user, research):
        relationship = ResearchRelationship.get(research.key, current_user.email)

        if not relationship or relationship.type != RelationshipType.INVITED:
            return bad_request('You not invited.')

        research.researchers_keys.append(current_user.key)
        research.put()

        relationship.type = RelationshipType.ACCEPTED
        relationship.put()

        current_user.researcher_in += 1
        current_user.put()

        return ok_msg('Invitation accepted.')
Beispiel #6
0
 def __delete_relationship(self, research, user):
     relationship = ResearchRelationship.get(research.key, user.email)
     relationship.key.delete()
Beispiel #7
0
 def __relationship_exists(self, research, recipient):
     return ResearchRelationship.get(research.key, recipient)