[pricelist] black code

This commit is contained in:
Tim Gröger 2021-04-14 22:43:28 +02:00
parent 1d36c3ef6c
commit 32ad4471c6
1 changed files with 80 additions and 79 deletions

View File

@ -245,48 +245,48 @@ def search_drinks(name):
def create_drink(current_session): def create_drink(current_session):
"""Create Drink """Create Drink
Route: ``/pricelist/drinks`` | Method: ``POST`` Route: ``/pricelist/drinks`` | Method: ``POST``
POST-data : POST-data :
``{ ``{
article_id?: string article_id?: string
cost_per_package?: float, cost_per_package?: float,
cost_per_volume?: float, cost_per_volume?: float,
name: string, name: string,
package_size?: number, package_size?: number,
receipt?: list[string], receipt?: list[string],
tags?: list[Tag], tags?: list[Tag],
type: DrinkType, type: DrinkType,
uuid?: string, uuid?: string,
volume?: float, volume?: float,
volumes?: list[ volumes?: list[
{ {
ingredients?: list[{ ingredients?: list[{
id: int id: int
drink_ingredient?: { drink_ingredient?: {
ingredient_id: int, ingredient_id: int,
volume: float volume: float
}, },
extra_ingredient?: { extra_ingredient?: {
id: number, id: number,
} }
}], }],
prices?: list[ prices?: list[
{ {
price: float price: float
public: boolean public: boolean
} }
], ],
volume: float volume: float
} }
] ]
}`` }``
Args: Args:
current_session: Session sent with Authorization Header current_session: Session sent with Authorization Header
Returns: Returns:
JSON encoded Drink or HTTP-error JSON encoded Drink or HTTP-error
""" """
data = request.get_json() data = request.get_json()
return jsonify(pricelist_controller.set_drink(data)) return jsonify(pricelist_controller.set_drink(data))
@ -297,49 +297,49 @@ def create_drink(current_session):
def update_drink(identifier, current_session): def update_drink(identifier, current_session):
"""Modify Drink """Modify Drink
Route: ``/pricelist/drinks/<identifier>`` | Method: ``PUT`` Route: ``/pricelist/drinks/<identifier>`` | Method: ``PUT``
POST-data : POST-data :
``{ ``{
article_id?: string article_id?: string
cost_per_package?: float, cost_per_package?: float,
cost_per_volume?: float, cost_per_volume?: float,
name: string, name: string,
package_size?: number, package_size?: number,
receipt?: list[string], receipt?: list[string],
tags?: list[Tag], tags?: list[Tag],
type: DrinkType, type: DrinkType,
uuid?: string, uuid?: string,
volume?: float, volume?: float,
volumes?: list[ volumes?: list[
{ {
ingredients?: list[{ ingredients?: list[{
id: int id: int
drink_ingredient?: { drink_ingredient?: {
ingredient_id: int, ingredient_id: int,
volume: float volume: float
}, },
extra_ingredient?: { extra_ingredient?: {
id: number, id: number,
} }
}], }],
prices?: list[ prices?: list[
{ {
price: float price: float
public: boolean public: boolean
} }
], ],
volume: float volume: float
} }
] ]
}`` }``
Args: Args:
identifier: Identifier of Drink identifier: Identifier of Drink
current_session: Session sent with Authorization Header current_session: Session sent with Authorization Header
Returns: Returns:
JSON encoded Drink or HTTP-error JSON encoded Drink or HTTP-error
""" """
data = request.get_json() data = request.get_json()
logger.debug(f"update drink {data}") logger.debug(f"update drink {data}")
@ -511,6 +511,7 @@ def get_pricelist_settings_min_prices(current_session):
min_prices = [] min_prices = []
return jsonify(min_prices) return jsonify(min_prices)
@PriceListPlugin.blueprint.route("/settings/min_prices", methods=["POST"]) @PriceListPlugin.blueprint.route("/settings/min_prices", methods=["POST"])
@login_required(permission=permissions.EDIT_MIN_PRICES) @login_required(permission=permissions.EDIT_MIN_PRICES)
def post_pricelist_settings_min_prices(current_session): def post_pricelist_settings_min_prices(current_session):