def put(self, param): parser = reqparse.RequestParser() parser.add_argument('placementId', type=int, required=True, help="The username field is required") data = parser.parse_args() user = LongrichUserModel.find_by_id(int(param)) if user: user.placementId = data.placementId user.save() return {"error": 0} else: return {"error": 1}
def identity(payload): user_id = payload['identity'] return LongrichUserModel.find_by_id(user_id)