Exemple #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
Exemple #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
Exemple #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
Exemple #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
Exemple #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
Exemple #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