Added product fetching and pages

This commit is contained in:
Thastertyn committed 2024-03-10 17:11:26 +01:00
1 parent 78aa03b2fb
commit 2694701337
2 files changed
+39

No files matched your search

+11
View File
@@ -4,6 +4,17 @@ from app.api import bp_product
from app.services.product_service import ProductService
@bp_product.route('/get', methods=['GET'])
def get_products():
page = request.args.get('page', default=0, type=int)
if page < 0:
return abort(400)
result, status_code = ProductService.get_products(page)
return result, status_code
@bp_product.route('/<int:id>', methods=['GET'])
def get_product_info(id: int):
fields = ['name', 'price', 'image', 'image_name', 'seller']