Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
C
CS123-Canteeneo
Project
Project
Details
Activity
Releases
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
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Willard Torres
CS123-Canteeneo
Commits
6e74f17d
Commit
6e74f17d
authored
Nov 23, 2016
by
Willard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Use plurals for api endpoints
parent
d7dc4eaa
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
4 additions
and
4 deletions
+4
-4
api.py
canteeneo/api.py
+4
-4
No files found.
canteeneo/api.py
View file @
6e74f17d
...
...
@@ -93,7 +93,7 @@ def get_auth_token():
token
=
generate_token
(
g
.
user
)
return
jsonify
({
'token'
:
token
.
decode
(
'ascii'
),
'duration'
:
600
})
@
app
.
route
(
'/api/dish
/<int:dish_id>/favorite
'
,
methods
=
[
'GET'
])
@
app
.
route
(
'/api/dish
es/<int:dish_id>/favorites
'
,
methods
=
[
'GET'
])
@
auth
.
login_required
def
favorite_dish
(
dish_id
):
dish
=
Dish
.
query
.
get
(
dish_id
)
...
...
@@ -104,7 +104,7 @@ def favorite_dish(dish_id):
db
.
session
.
commit
()
return
str
(
dish
in
g
.
user
.
dish_favorites
)
@
app
.
route
(
'/api/dish
/<int:dish_id>/review
'
,
methods
=
[
'POST'
])
@
app
.
route
(
'/api/dish
es/<int:dish_id>/reviews
'
,
methods
=
[
'POST'
])
@
auth
.
login_required
def
review_dish
(
dish_id
):
user_id
=
g
.
user
.
id
...
...
@@ -116,7 +116,7 @@ def review_dish(dish_id):
db
.
session
.
commit
()
return
'Review posted'
@
app
.
route
(
'/api/stall
/<int:stall_id>/favorite
'
,
methods
=
[
'GET'
])
@
app
.
route
(
'/api/stall
s/<int:stall_id>/favorites
'
,
methods
=
[
'GET'
])
@
auth
.
login_required
def
favorite_stall
(
stall_id
):
stall
=
Stall
.
query
.
get
(
stall_id
)
...
...
@@ -127,7 +127,7 @@ def favorite_stall(stall_id):
db
.
session
.
commit
()
return
str
(
stall
in
g
.
user
.
stall_favorites
)
@
app
.
route
(
'/api/stall
/<int:stall_id>/review
'
,
methods
=
[
'POST'
])
@
app
.
route
(
'/api/stall
s/<int:stall_id>/reviews
'
,
methods
=
[
'POST'
])
@
auth
.
login_required
def
review_stall
(
stall_id
):
user_id
=
g
.
user
.
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