Skip to content

Commit

Permalink
Modifying from this point (including this)
Browse files Browse the repository at this point in the history
  • Loading branch information
ManavTriv committed Mar 23, 2024
1 parent 714fb84 commit 232109e
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions spamoverflow/views/routes.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,8 +73,16 @@ def get_emails(customer_id):
query = Email.query.filter_by(customer_id=customer_id)

if start:
try:
start = datetime.fromisoformat(start)
except:
return jsonify({'error': 'Invalid query parameters'}), 400
query = query.filter(Email.created_at >= start)
if end:
try:
end = datetime.fromisoformat(end)
except:
return jsonify({'error': 'Invalid query parameters'}), 400
query = query.filter(Email.created_at < end)
if email_from:
query = query.filter(Email.email_from == email_from)
Expand Down

0 comments on commit 232109e

Please # to comment.