On Wed, Aug 19 2020, Jiri Vlasak wrote:
+@app.route("/event/add", methods=["POST"])
POST always create new object by (REST) convention. Therefore, sending POST to endpoint "/event" is clearer.
Good point.
+def event_add():
- if request.method == "POST":
I think (but not sure) that this is unnecessary due to that only POST method is allowed (`methods=["POST"]`).
Yes, it's correct. I think we (somebody) should remove those unnecessary ifs also from the other functions.
+def add_event(uid, event_name, time):
- conn, c = open_db()
- c.execute("""insert into events (user_id, event_type, time)
values (?, (SELECT id FROM event_types WHERE name = ?), ?)""",
(uid, event_name, time))
- close_db(conn)
Different number of blank lines between functions looks ugly.
I unified the spacing in all files. This was not the only inconsistency in the number of blank lines.
Will send v2 soon.
-M.