Exemplo n.º 1
0
 def delete(self, id):
     user = User.objects(id=id).first()
     if user is None:
         status_fields = generate_status_fields(NOTFOUND)
         return status_fields, 404
     if id in current_user.blocked_user_id:
         current_user.update_one(pull_blocked_used_id=id)
         status_fields = generate_status_fields(OK)
     else:
         status_fields = generate_status_fields(NOTFOUND)
     return status_fields, 204
Exemplo n.º 2
0
 def put(self, id):
     user = User.objects(id=id).first()
     if user is None:
         status_fields = generate_status_fields(NOTFOUND)
         return status_fields, 404
     if id not in current_user.blocked_user_id:
         current_user.update_one(push_blocked_user_id=id)
         status_fields = generate_status_fields(OK)
     else:
         status_fields = generate_status_fields(EXISTING)
     return status_fields, 202
Exemplo n.º 3
0
 def delete(self, id):
     user = User.objects(id=id).first()
     if user is None:
         status_fields = generate_status_fields(NOTFOUND)
         return status_fields, 404
     if id in current_user.blocked_user_id:
         current_user.update_one(pull_blocked_used_id=id)
         status_fields = generate_status_fields(OK)
     else:
         status_fields = generate_status_fields(NOTFOUND)
     return status_fields, 204
Exemplo n.º 4
0
 def put(self, id):
     user = User.objects(id=id).first()
     if user is None:
         status_fields = generate_status_fields(NOTFOUND)
         return status_fields, 404
     if id not in current_user.blocked_user_id:
         current_user.update_one(push_blocked_user_id=id)
         status_fields = generate_status_fields(OK)
     else:
         status_fields = generate_status_fields(EXISTING)
     return status_fields, 202
Exemplo n.º 5
0
 def delete(self, id):
     user = User.objects(id=id).first()
     if user is None:
         status_fields = generate_status_fields(NOTFOUND)
         return status_fields, 404
     if user in current_user.following:
         current_user.update_one(pull_follwing=user)
         user.update_one(pull_follwer=current_user)
         status_fields = generate_status_fields(OK)
     else:
         status_fields = generate_status_fields(NOTFOUND)
     return status_fields, 204
Exemplo n.º 6
0
 def delete(self, id):
     user = User.objects(id=id).first()
     if user is None:
         status_fields = generate_status_fields(NOTFOUND)
         return status_fields, 404
     if user in current_user.following:
         current_user.update_one(pull_follwing=user)
         user.update_one(pull_follwer=current_user)
         status_fields = generate_status_fields(OK)
     else:
         status_fields = generate_status_fields(NOTFOUND)
     return status_fields, 204