def post(self): data = User.parser.parse_args() username = data['username'] password = data['password'] user = UserModel() user = user.create_user(username, password) return (user)
def post(self): parser = reqparse.RequestParser() parser.add_argument('username', type=str, required=True, help='This field cannot be left blank') parser.add_argument('password', type=str, required=True, help='This field cannot be left blank') data = User.parser.parse_args() username = data['username'] password = data['password'] auth = request.authorization user = UserModel() '''result = user.login(auth)''' result = user.login(username, password) return (result)
def get(self): user = UserModel() result = user.get_all() return ({'users': result}), 200
def delete(self): '''if not (current_user['admin']): return({"message":"cannot delete patient"}),401''' user = UserModel() result = user.delete_user_table() return (result), 200
def put(self, userid): '''if not (current_user['admin']): return({"message":"cannot update patient"}),401''' user = UserModel() result = user.promote_user_admin(userid) return (result), 200
def get(self, userid): '''if not (current_user['admin'] or current_user['isdoctor']): return({"message":"cannot get the specified user"}),401''' user = UserModel() result = user.get_one('userid', userid) return (result), 200