do not use execute_scalar
This commit is contained in:
parent
77722703ac
commit
c6bbbf94e3
@ -126,7 +126,7 @@ def PostShipcalls(schemaModel):
|
||||
# TODO: set ETA properly
|
||||
user_data = check_jwt()
|
||||
query = "INSERT INTO history (participant_id, shipcall_id, user_id, timestamp, eta, type, operation) VALUES (?pid?, ?scid?, ?uid?, CURRENT_TIMESTAMP, CURRENT_TIMESTAMP, 1, 1)"
|
||||
commands.execute_scalar(query, {"scid" : new_id, "pid" : user_data["participant_id"], "uid" : user_data["id"]})
|
||||
commands.execute(query, {"scid" : new_id, "pid" : user_data["participant_id"], "uid" : user_data["id"]})
|
||||
|
||||
return json.dumps({"id" : new_id}), 201, {'Content-Type': 'application/json; charset=utf-8'}
|
||||
|
||||
|
||||
@ -90,7 +90,7 @@ def PostTimes(schemaModel):
|
||||
# TODO: set ETA properly
|
||||
user_data = check_jwt()
|
||||
query = "INSERT INTO history (participant_id, shipcall_id, user_id, timestamp, eta, type, operation) VALUES (?pid?, ?scid?, ?uid?, CURRENT_TIMESTAMP, CURRENT_TIMESTAMP, 2, 1)"
|
||||
commands.execute_scalar(query, {"scid" : schemaModel["shipcall_id"], "pid" : user_data["participant_id"], "uid" : user_data["id"]})
|
||||
commands.execute(query, {"scid" : schemaModel["shipcall_id"], "pid" : user_data["participant_id"], "uid" : user_data["id"]})
|
||||
|
||||
return json.dumps({"id" : new_id}), 201, {'Content-Type': 'application/json; charset=utf-8'}
|
||||
|
||||
@ -144,7 +144,7 @@ def PutTimes(schemaModel):
|
||||
# TODO: set ETA properly
|
||||
user_data = check_jwt()
|
||||
query = "INSERT INTO history (participant_id, shipcall_id, user_id, timestamp, eta, type, operation) VALUES (?pid?, ?scid?, ?uid?, CURRENT_TIMESTAMP, CURRENT_TIMESTAMP, 2, 2)"
|
||||
commands.execute_scalar(query, {"scid" : schemaModel["shipcall_id"], "pid" : user_data["participant_id"], "uid" : user_data["id"]})
|
||||
commands.query(query, {"scid" : schemaModel["shipcall_id"], "pid" : user_data["participant_id"], "uid" : user_data["id"]})
|
||||
|
||||
# if affected_rows == 1: # this doesn't work as expected
|
||||
|
||||
@ -180,7 +180,7 @@ def DeleteTimes(options):
|
||||
# save history data
|
||||
user_data = check_jwt()
|
||||
query = "INSERT INTO history (participant_id, shipcall_id, user_id, timestamp, eta, type, operation) VALUES (?pid?, 0, ?uid?, CURRENT_TIMESTAMP, CURRENT_TIMESTAMP, 2, 3)"
|
||||
commands.execute_scalar(query, {"pid" : user_data["participant_id"], "uid" : user_data["id"]})
|
||||
commands.execute(query, {"pid" : user_data["participant_id"], "uid" : user_data["id"]})
|
||||
|
||||
if affected_rows == 1:
|
||||
return json.dumps({"id" : options["id"]}), 200, {'Content-Type': 'application/json; charset=utf-8'}
|
||||
|
||||
Reference in New Issue
Block a user