Add command policy audit trail
This commit is contained in:
@@ -90,3 +90,29 @@ class EventStore:
|
||||
)
|
||||
for row in rows
|
||||
]
|
||||
|
||||
async def list_by_type(self, event_type: str, limit: int = 100) -> list[Event]:
|
||||
await self.init()
|
||||
async with aiosqlite.connect(self.db_path) as db:
|
||||
db.row_factory = aiosqlite.Row
|
||||
cursor = await db.execute(
|
||||
"""
|
||||
select * from events
|
||||
where event_type = ?
|
||||
order by id desc
|
||||
limit ?
|
||||
""",
|
||||
(event_type, limit),
|
||||
)
|
||||
rows = await cursor.fetchall()
|
||||
return [
|
||||
Event(
|
||||
id=row["id"],
|
||||
task_id=row["task_id"],
|
||||
sequence=row["sequence"],
|
||||
event_type=row["event_type"],
|
||||
payload=json.loads(row["payload_json"]),
|
||||
created_at=row["created_at"],
|
||||
)
|
||||
for row in rows
|
||||
]
|
||||
|
||||
Reference in New Issue
Block a user