Possible fix for timestamp issue
Changes to be committed: modified: server/src/server_api.py
This commit is contained in:
@@ -133,11 +133,10 @@ def get_all_records():
|
||||
|
||||
# Route to get records since a given timestamp
|
||||
@app.route(
|
||||
'/get_records_since/<timestamp_str>',
|
||||
'/get_records_since/<timestamp>',
|
||||
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/'
|
||||
'<start_timestamp_str>/<end_timestamp_str>',
|
||||
'<start_timestamp>/<end_timestamp>',
|
||||
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/<timestamp_str>', methods=['GET'])
|
||||
def get_records_until(timestamp_str):
|
||||
timestamp = parse_timestamp(timestamp_str)
|
||||
@app.route('/get_records_until/<timestamp>', methods=['GET'])
|
||||
def get_records_until(timestamp):
|
||||
if timestamp is None:
|
||||
return jsonify({'error': 'Invalid timestamp format'}), 400
|
||||
|
||||
|
||||
Reference in New Issue
Block a user