mirror of
https://github.com/arcan1s/ahriman.git
synced 2025-07-15 06:55:48 +00:00
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:
@ -51,11 +51,13 @@ class EventOperations(Operations):
|
||||
Event.from_json(row)
|
||||
for row in connection.execute(
|
||||
"""
|
||||
select created, event, object_id, message, data from auditlog
|
||||
where (:event is null or event = :event)
|
||||
and (:object_id is null or object_id = :object_id)
|
||||
and repository = :repository
|
||||
order by created limit :limit offset :offset
|
||||
select created, event, object_id, message, data from (
|
||||
select * from auditlog
|
||||
where (:event is null or event = :event)
|
||||
and (:object_id is null or object_id = :object_id)
|
||||
and repository = :repository
|
||||
order by created desc limit :limit offset :offset
|
||||
) order by created asc
|
||||
""",
|
||||
{
|
||||
"event": event,
|
||||
|
@ -50,9 +50,11 @@ class LogsOperations(Operations):
|
||||
(row["created"], row["record"])
|
||||
for row in connection.execute(
|
||||
"""
|
||||
select created, record from logs
|
||||
where package_base = :package_base and repository = :repository
|
||||
order by created limit :limit offset :offset
|
||||
select created, record from (
|
||||
select * from logs
|
||||
where package_base = :package_base and repository = :repository
|
||||
order by created desc limit :limit offset :offset
|
||||
) order by created asc
|
||||
""",
|
||||
{
|
||||
"package_base": package_base,
|
||||
|
Reference in New Issue
Block a user