Skip to content

Commit 6aedd9b

Browse files
committed
feat: 404 error for data not found
1 parent 056d0c9 commit 6aedd9b

File tree

2 files changed

+3
-0
lines changed

2 files changed

+3
-0
lines changed

time_tracker_api/time_entries/time_entries_model.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -200,6 +200,8 @@ def find_all(
200200

201201
users = AzureConnection().users()
202202
add_user_email_to_time_entries(time_entries, users)
203+
elif not time_entries and len(conditions) > 1:
204+
abort(HTTPStatus.NOT_FOUND, "Time entry not found")
203205
return time_entries
204206

205207
def on_create(self, new_item_data: dict, event_context: EventContext):

time_tracker_api/time_entries/time_entries_namespace.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -201,6 +201,7 @@ class TimeEntries(Resource):
201201
@ns.doc('list_time_entries')
202202
@ns.expect(attributes_filter)
203203
@ns.marshal_list_with(time_entry)
204+
@ns.response(HTTPStatus.NOT_FOUND, 'Time entry not found')
204205
def get(self):
205206
"""List all time entries"""
206207
conditions = attributes_filter.parse_args()

0 commit comments

Comments
 (0)