From 666eb9b44ae09de7ce2a0604e71761626344d777 Mon Sep 17 00:00:00 2001 From: "Muhamed H. Asadi" Date: Mon, 25 Sep 2023 00:11:06 +0330 Subject: [PATCH] Possible fix for timestamp issue Changes to be committed: modified: server/src/server_api.py --- server/src/server_api.py | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) diff --git a/server/src/server_api.py b/server/src/server_api.py index 2dde3b8..726c031 100644 --- a/server/src/server_api.py +++ b/server/src/server_api.py @@ -133,11 +133,10 @@ def get_all_records(): # Route to get records since a given timestamp @app.route( - '/get_records_since/', + '/get_records_since/', methods=['GET'] ) -def get_records_since(timestamp_str): - timestamp = parse_timestamp(timestamp_str) +def get_records_since(timestamp): if timestamp is None: return jsonify({'error': 'Invalid timestamp format'}), 400 @@ -162,13 +161,11 @@ def get_records_since(timestamp_str): # Route to get records between two timestamps @app.route( '/get_records_between/' - '/', + '/', methods=['GET'] ) -def get_records_between(start_timestamp_str, end_timestamp_str): +def get_records_between(start_timestamp, end_timestamp): # Parse the provided start and end timestamps into datetime objects - start_timestamp = parse_timestamp(start_timestamp_str) - end_timestamp = parse_timestamp(end_timestamp_str) if start_timestamp is None or end_timestamp is None: return jsonify({'error': 'Invalid timestamp format'}), 400 @@ -189,9 +186,8 @@ def get_records_between(start_timestamp_str, end_timestamp_str): return jsonify(records_list) # Route to get records until a given timestamp -@app.route('/get_records_until/', methods=['GET']) -def get_records_until(timestamp_str): - timestamp = parse_timestamp(timestamp_str) +@app.route('/get_records_until/', methods=['GET']) +def get_records_until(timestamp): if timestamp is None: return jsonify({'error': 'Invalid timestamp format'}), 400