Improve timestamp handling and event navigation
This commit is contained in:
@@ -6,6 +6,7 @@ from ..cursors import decode, decode_datetime, encode
|
||||
from ..db import get_session
|
||||
from ..models import NotificationOutbox
|
||||
from ..schemas import NotificationOutboxItem, OutboxPage
|
||||
from ..timeutil import to_utc
|
||||
|
||||
router = APIRouter()
|
||||
|
||||
@@ -38,7 +39,7 @@ async def list_outbox(
|
||||
next_cursor = None
|
||||
if len(rows) > limit:
|
||||
rows = rows[:limit]
|
||||
next_cursor = encode(rows[-1].created_at.isoformat(), rows[-1].id)
|
||||
next_cursor = encode(to_utc(rows[-1].created_at).isoformat(), rows[-1].id)
|
||||
return OutboxPage(
|
||||
items=[
|
||||
NotificationOutboxItem(
|
||||
@@ -48,9 +49,9 @@ async def list_outbox(
|
||||
incident_id=str(r.incident_id),
|
||||
event_type=r.event_type,
|
||||
attempts=r.attempts,
|
||||
next_attempt_at=r.next_attempt_at,
|
||||
next_attempt_at=to_utc(r.next_attempt_at) if r.next_attempt_at else None,
|
||||
last_error=r.last_error,
|
||||
updated_at=r.updated_at,
|
||||
updated_at=to_utc(r.updated_at),
|
||||
)
|
||||
for r in rows
|
||||
],
|
||||
|
||||
Reference in New Issue
Block a user