async def add_user_method(request): user = User(request.json, strict=True) user.validate() user = await db_api.add_user(user.to_native()) return json(user, status=201)
async def update_user_by_id_method(request, user_id): user_id = UserById({'user_id': user_id}).user_id user = User(request.json, strict=True) user.validate() user = db_api.update_user_by_id(user_id, user.to_native()) return json(user, status=200)