Commit 77b5a6d5 authored by Ahmad Anvari's avatar Ahmad Anvari

Add feed product

parent 40f5b177
...@@ -21,8 +21,19 @@ def search_products(): ...@@ -21,8 +21,19 @@ def search_products():
@app.route('/products', methods=["POST"]) @app.route('/products', methods=["POST"])
def add_product(): def add_product():
p1 = Product(name="Lenovo ThinkPad TH230", price=193000000, tags=["laptop", "pc", "computer", "lenovo", "thinkpad"], available=int(50)) p1 = Product(name="Lenovo ThinkPad TH230",
p2 = Product(name="MSI 127", price=308000000, tags=["laptop", "pc", "computer", "msi", "gaming"], available=int(20)) price=193000000,
tags=["laptop", "pc", "computer", "lenovo", "thinkpad"],
available=int(50))
p2 = Product(name="MSI 127",
price=308000000,
tags=["laptop", "pc", "computer", "msi", "gaming"],
available=int(20))
p3 = Product(name="Macbook T2",
price=588000000,
tags=["laptop", "osx", "computer", "apple", "macbook"],
available=int(20))
p1.store() p1.store()
p2.store() p2.store()
return jsonify({"id": [p1.get_id(), p2.get_id()]}) p3.store()
return jsonify({"id": [p1.get_id(), p2.get_id(), p3.get_id()]})
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment