def obtener_usuario():
    token = request.headers.get('Authorization')
    auth = UserModel.decode_jwt(token[7:])
    user_token = UserModel.select().where(
        UserModel.email == auth['payload']).get()

    user = UserModel.get_or_none(id=user_token.id)

    return user_schema.dump(user), 200
def eliminar_usuario(id):
    user = UserModel.get_or_none(id=id)

    if user is None:
        abort(
            make_response(jsonify(message="Usuario no existe", error=True),
                          404))

    user.delete()
    return user_schema.dump(user)
def obtener_datos_usuario(id):
    usuario = UserModel.get_or_none(id=id)
    return make_response(jsonify(user_schema.dump(usuario))), 200