from flask import jsonify, abort, request from app.api import bp_product from app.services.product_service import ProductService @bp_product.route('/', methods=['GET']) def all_product_info(id: int): result = ProductService.get_all_info(id) if result is not None: return jsonify(result) else: abort(404) @bp_product.route('//name', methods=['GET']) def get_name(id: int): result = ProductService.get_name(id) if result is not None: return jsonify({"name": result}) else: return abort(404) @bp_product.route('//manufacturer', methods=['GET']) def get_manufacturer(id: int): result = ProductService.get_manufacturer(id) if result is not None: return jsonify({"name": result}) else: return abort(404) @bp_product.route('//price', methods=['GET']) def get_price(id: int): result = ProductService.get_price(id) if result is not None: return jsonify({"price": result}) else: return abort(404) @bp_product.route('//image', methods=['GET']) def get_image(id: int): result = ProductService.get_image(id) if result is not None: return jsonify({"image": result}) else: return abort(404) @bp_product.route('//image_name', methods=['GET']) def get_image_name(id: int): result = ProductService.get_image_name(id) if result is not None: return jsonify({"image_name": result}) else: return abort(404) @bp_product.route('/create', methods=['POST']) def create_product_listing(): return abort(501)