Commit 6e74f17d authored by Willard's avatar Willard

Use plurals for api endpoints

parent d7dc4eaa
...@@ -93,7 +93,7 @@ def get_auth_token(): ...@@ -93,7 +93,7 @@ def get_auth_token():
token = generate_token(g.user) token = generate_token(g.user)
return jsonify({'token': token.decode('ascii'), 'duration': 600}) return jsonify({'token': token.decode('ascii'), 'duration': 600})
@app.route('/api/dish/<int:dish_id>/favorite', methods=['GET']) @app.route('/api/dishes/<int:dish_id>/favorites', methods=['GET'])
@auth.login_required @auth.login_required
def favorite_dish(dish_id): def favorite_dish(dish_id):
dish = Dish.query.get(dish_id) dish = Dish.query.get(dish_id)
...@@ -104,7 +104,7 @@ def favorite_dish(dish_id): ...@@ -104,7 +104,7 @@ def favorite_dish(dish_id):
db.session.commit() db.session.commit()
return str(dish in g.user.dish_favorites) return str(dish in g.user.dish_favorites)
@app.route('/api/dish/<int:dish_id>/review', methods=['POST']) @app.route('/api/dishes/<int:dish_id>/reviews', methods=['POST'])
@auth.login_required @auth.login_required
def review_dish(dish_id): def review_dish(dish_id):
user_id = g.user.id user_id = g.user.id
...@@ -116,7 +116,7 @@ def review_dish(dish_id): ...@@ -116,7 +116,7 @@ def review_dish(dish_id):
db.session.commit() db.session.commit()
return 'Review posted' return 'Review posted'
@app.route('/api/stall/<int:stall_id>/favorite', methods=['GET']) @app.route('/api/stalls/<int:stall_id>/favorites', methods=['GET'])
@auth.login_required @auth.login_required
def favorite_stall(stall_id): def favorite_stall(stall_id):
stall = Stall.query.get(stall_id) stall = Stall.query.get(stall_id)
...@@ -127,7 +127,7 @@ def favorite_stall(stall_id): ...@@ -127,7 +127,7 @@ def favorite_stall(stall_id):
db.session.commit() db.session.commit()
return str(stall in g.user.stall_favorites) return str(stall in g.user.stall_favorites)
@app.route('/api/stall/<int:stall_id>/review', methods=['POST']) @app.route('/api/stalls/<int:stall_id>/reviews', methods=['POST'])
@auth.login_required @auth.login_required
def review_stall(stall_id): def review_stall(stall_id):
user_id = g.user.id user_id = g.user.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