This reverts commit cdcefda954.
This commit is contained in:
@@ -0,0 +1,20 @@
|
||||
standard-wallpaper:
|
||||
inquiry:
|
||||
IT: 1.1034
|
||||
GB: 1.1154
|
||||
DE: 1.0625
|
||||
product:
|
||||
GB: 1.1154
|
||||
DE: 1.0625
|
||||
premium-wallpaper:
|
||||
inquiry:
|
||||
IT: 1.1250
|
||||
SE: 1.0462
|
||||
GB: 1.1034
|
||||
DE: 1.1143
|
||||
NL: 1.0833
|
||||
product:
|
||||
GB: 1.1034
|
||||
DE: 1.1143
|
||||
SE: 1.0462
|
||||
NL: 1.0833
|
||||
+51
-2
@@ -1,12 +1,13 @@
|
||||
from api.models.external_print_product import get_cheapest_canvas_product, get_cheapest_poster_product
|
||||
from flask import Blueprint, request, jsonify
|
||||
from flask import Blueprint, request, jsonify, abort
|
||||
from api.helpers import check_api_key
|
||||
from api.validators import validate_number, validate_exists
|
||||
from api.validators import validate_number, validate_any_of, validate_exists
|
||||
from api.models import (
|
||||
Inquiry,
|
||||
Market,
|
||||
Material,
|
||||
Product,
|
||||
PrintProduct,
|
||||
ContractCustomer,
|
||||
)
|
||||
from api.lib.prices import (
|
||||
@@ -261,6 +262,54 @@ def inquiry(inquiry_id):
|
||||
return jsonify(data)
|
||||
|
||||
|
||||
@mod.route("/list-prices/<int:market_id>/wallpaper")
|
||||
def list_prices_wallpaper(market_id):
|
||||
wallpapers = PrintProduct.query.wallpapers().all()
|
||||
result = {}
|
||||
material = Material.query.filter(Material.name == "standard-wallpaper").one()
|
||||
market = Market.query.get_or_404(market_id)
|
||||
|
||||
for wallpaper in wallpapers:
|
||||
result[wallpaper.id] = wallpaper_m2_price(
|
||||
material=material, market=market, designer=wallpaper.product.designer
|
||||
)
|
||||
return jsonify(result)
|
||||
|
||||
|
||||
@mod.route("/list-prices/<int:market_id>/canvas_external")
|
||||
def list_prices_canvas_external(market_id):
|
||||
canvases = PrintProduct.query.canvases().all()
|
||||
market = Market.query.get_or_404(market_id)
|
||||
external_product_id = get_cheapest_canvas_product()
|
||||
|
||||
result = {}
|
||||
for canvas in canvases:
|
||||
result[canvas.id] = external_product_price(
|
||||
id = external_product_id,
|
||||
market=market,
|
||||
designer=canvas.product.designer
|
||||
)
|
||||
|
||||
return jsonify(result)
|
||||
|
||||
|
||||
@mod.route("/list-prices/<int:market_id>/poster_external")
|
||||
def list_prices_poster_external(market_id):
|
||||
posters = PrintProduct.query.posters().all()
|
||||
market = Market.query.get_or_404(market_id)
|
||||
external_product_id = get_cheapest_poster_product()
|
||||
|
||||
result = {}
|
||||
for poster in posters:
|
||||
result[poster.id] = external_product_price(
|
||||
id = external_product_id,
|
||||
market=market,
|
||||
designer=poster.product.designer
|
||||
)
|
||||
|
||||
return jsonify(result)
|
||||
|
||||
|
||||
@mod.route("/external-product", methods=["GET"])
|
||||
@validate_exists("market")
|
||||
@validate_exists("id")
|
||||
|
||||
Reference in New Issue
Block a user