Exemple #1
0
def raspberry_user_put():
    body = request.get_json()
    obj = Raspberry.get({"id": body["raspberry_id"]})
    user = User.get({"id": get_jwt_identity()})
    user.raspberries.append(obj)
    db.session.commit()
    return {"message": Config.POST_MESSAGE, "object": obj}, 201
Exemple #2
0
def raspberry_user_delete():
    body = request.get_json()
    obj = Raspberry.get({"id": body["raspberry_id"]})
    user = User.get({"id": get_jwt_identity()})
    user.raspberries.remove(obj)
    db.session.commit()
    return {"message": Config.DELETE_MESSAGE}, 203
Exemple #3
0
def user_get(_id):
    obj = User.get({"id": _id})
    return jsonify(obj)