[pricelist] delete visibleColums
This commit is contained in:
parent
62948cd591
commit
2d45c0dab9
|
@ -200,38 +200,6 @@ def pricelist_settings_min_prices():
|
|||
return no_content()
|
||||
|
||||
|
||||
@PriceListPlugin.blueprint.route("/users/<userid>/pricecalc_columns", methods=["GET", "PUT"])
|
||||
@login_required()
|
||||
def get_columns(userid, current_session: Session):
|
||||
"""Get pricecalc_columns of an user
|
||||
|
||||
Route: ``/users/<userid>/pricelist/pricecac_columns`` | Method: ``GET`` or ``PUT``
|
||||
POST-data: On ``PUT`` json encoded array of floats
|
||||
|
||||
Args:
|
||||
userid: Userid identifying the user
|
||||
current_session: Session sent with Authorization Header
|
||||
|
||||
Returns:
|
||||
GET: JSON object containing the shortcuts as float array or HTTP error
|
||||
PUT: HTTP-created or HTTP error
|
||||
"""
|
||||
if userid != current_session.user_.userid:
|
||||
raise Forbidden
|
||||
|
||||
user = userController.get_user(userid)
|
||||
if request.method == "GET":
|
||||
return jsonify(user.get_attribute("pricecalc_columns", []))
|
||||
else:
|
||||
data = request.get_json()
|
||||
if not isinstance(data, list) or not all(isinstance(n, str) for n in data):
|
||||
raise BadRequest
|
||||
data.sort(reverse=True)
|
||||
user.set_attribute("pricecalc_columns", data)
|
||||
userController.persist()
|
||||
return no_content()
|
||||
|
||||
|
||||
@PriceListPlugin.blueprint.route("/drinks/<int:identifier>/picture", methods=["POST", "GET", "DELETE"])
|
||||
def set_picture(identifier):
|
||||
|
||||
|
|
Loading…
Reference in New Issue