Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
fix: #215 remove atribute filters in last time entry
  • Loading branch information
PaulRC-ioet committed Nov 16, 2020
commit 32b5111c3bbd0c2b38019803995b5c1ec7e61ae4
1 change: 1 addition & 0 deletions time_tracker_api/time_entries/time_entries_dao.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
TimeEntryCosmosDBRepository,
)
from time_tracker_api.database import CRUDDao, APICosmosDBDao
from time_tracker_api.security import current_user_id


class TimeEntriesDao(CRUDDao):
Expand Down
12 changes: 2 additions & 10 deletions time_tracker_api/time_entries/time_entries_namespace.py
Original file line number Diff line number Diff line change
Expand Up @@ -256,28 +256,20 @@ def post(self):
return time_entries_dao.create(ns.payload), HTTPStatus.CREATED


# TODO: Once this endpoint is working as expected in prod, review and
# remove unnecessary filter args. As we are using same attributes_filter
# as the get_all endpoint and some of the args are unnecessary for this endpoint.


@ns.route('/latest')
class LatestTimeEntries(Resource):
@ns.doc('list_latest_time_entries')
@ns.expect(attributes_filter)
@ns.marshal_list_with(time_entry)
@ns.response(HTTPStatus.NOT_FOUND, 'Time entry not found')
def get(self):
"""List the latest time entries"""
conditions = attributes_filter.parse_args()

return time_entries_dao.get_lastest_entries_by_project(
conditions=conditions
)
return time_entries_dao.get_lastest_entries_by_project(conditions={})


@ns.route('/<string:id>')
@ns.response(HTTPStatus.NOT_FOUND, 'This time entry does not exist')
@ns.response(HTTPStatus.UNPROCESSABLE_ENTITY, 'The id has an invalid format')
@ns.param('id', 'The unique identifier of the time entry')
class TimeEntry(Resource):
@ns.doc('get_time_entry')
Expand Down