예제 #1
0
 def get(self):
     users = User.get_all()
     user_list = []
     for user in users:
         obj = {
             "username": user.username,
             "coffeeCount": user.coffee_count
         }
         user_list.append(obj)
     
     return user_list, 200
예제 #2
0
 def get(self):
     response = {}
     user = User.find_by_id(get_jwt_identity())
     if not user.admin:
         response['status'] = "ERROR"
         response['msg'] = "No admin rights"
         return response, 403
     else:
         schema = UserSchema(many=True)
         users = User.get_all()
         return schema.dump(users).data, 200
예제 #3
0
 def get(self):
     #get all users for admin
     schema = UserSchema(many=True)
     users = User.get_all()
     return schema.dump(users).data, 200