feat: serve logs and events from the newest to oldest, but keep the

ordering

So basically initial implementation, with limit=1, would emit the oldest
record in series. New implementation will return the most recent one
instead

The response is still sorted by ascension
This commit is contained in:
2024-08-28 16:53:30 +03:00
parent d57276f214
commit 1e30838be4
6 changed files with 17 additions and 13 deletions

View File

@ -39,7 +39,7 @@ async def test_get(client: TestClient) -> None:
assert not response_schema.validate(json, many=True)
events = [Event.from_json(event) for event in json]
assert events == [event1, event2]
assert events == [event2, event1]
async def test_get_with_pagination(client: TestClient) -> None:
@ -61,7 +61,7 @@ async def test_get_with_pagination(client: TestClient) -> None:
json = await response.json()
assert not response_schema.validate(json, many=True)
assert [Event.from_json(event) for event in json] == [event2]
assert [Event.from_json(event) for event in json] == [event1]
async def test_get_bad_request(client: TestClient) -> None:

View File

@ -76,7 +76,7 @@ async def test_get_with_pagination(client: TestClient, package_ahriman: Package)
logs = await response.json()
assert not response_schema.validate(logs)
assert logs == [{"created": 43.0, "message": "message 2"}]
assert logs == [{"created": 42.0, "message": "message 1"}]
async def test_get_bad_request(client: TestClient, package_ahriman: Package) -> None: