Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in
Toggle navigation
S
Shoppe
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
mongo101
Shoppe
Commits
8d241fb3
Commit
8d241fb3
authored
Sep 07, 2019
by
Ahmad Anvari
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add route for order
parent
67fa4b13
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
32 additions
and
0 deletions
+32
-0
order.py
routes/order.py
+32
-0
No files found.
routes/order.py
View file @
8d241fb3
from
app
import
app
from
middlewares.auth
import
login_required
from
flask
import
request
,
jsonify
from
db.product
import
Product
from
db.order
import
Order
#
# @app.route('/orders', methods=["GET"])
# def search_products():
# tags = request.args.get('tags')
# if tags is None:
# tags = []
# else:
# tags = tags.split(',')
# count = request.args.get('count')
# if count is None:
# count = 5
# else:
# count = int(count)
# r = Product.search(count=count, tags=tags)
# return jsonify(r)
@
app
.
route
(
'/orders'
,
methods
=
[
"POST"
])
@
login_required
def
add_order
():
body
=
request
.
json
product_id
=
body
[
"product_id"
]
user_id
=
request
.
user
.
get_id
()
o
=
Order
(
user_id
=
user_id
,
product_id
=
product_id
)
id
=
o
.
store
()
return
jsonify
({
"id"
:
id
})
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment