fix(incidents): bind durable readback tenant context
This commit is contained in:
@@ -168,13 +168,13 @@ class IncidentDBRepository(IIncidentRepository):
|
||||
record = result.scalar_one_or_none()
|
||||
return _record_to_incident(record) if record else None
|
||||
|
||||
async def get_active(self) -> list[Incident]:
|
||||
async def get_active(self, *, project_id: str | None = None) -> list[Incident]:
|
||||
"""取得所有活躍的 Incident"""
|
||||
active_statuses = [
|
||||
IncidentStatus.INVESTIGATING,
|
||||
IncidentStatus.MITIGATING,
|
||||
]
|
||||
async with get_db_context() as db:
|
||||
async with get_db_context(project_id) as db:
|
||||
result = await db.execute(
|
||||
select(IncidentRecord)
|
||||
.where(IncidentRecord.status.in_(active_statuses))
|
||||
|
||||
@@ -125,7 +125,11 @@ class IIncidentRepository(Protocol):
|
||||
"""根據 ID 取得 Incident"""
|
||||
...
|
||||
|
||||
async def get_active(self) -> list[Incident]:
|
||||
async def get_active(
|
||||
self,
|
||||
*,
|
||||
project_id: str | None = None,
|
||||
) -> list[Incident]:
|
||||
"""取得所有活躍的 Incident"""
|
||||
...
|
||||
|
||||
|
||||
Reference in New Issue
Block a user