mirror of
https://github.com/leonvanzyl/autocoder.git
synced 2026-02-01 06:53:36 +00:00
fix: Pydantic datetime serialization for API endpoints
Problem:
Several API endpoints return 500 Internal Server Error because datetime
objects are not serializable by Pydantic. The error occurs when:
- GET /agent/{project}/status
- GET /devserver/{project}/status
- GET /schedules/{project}/next
Root cause:
Pydantic models expect strings for Optional datetime fields, but the code
was passing raw datetime objects.
Solution:
Convert datetime objects to ISO 8601 strings using .isoformat() before
returning in Pydantic response models.
Changes:
- server/routers/agent.py: Fix started_at serialization
- server/routers/devserver.py: Fix started_at serialization
- server/routers/schedules.py: Fix next_start/next_end serialization
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -129,7 +129,7 @@ async def get_devserver_status(project_name: str) -> DevServerStatus:
|
||||
pid=manager.pid,
|
||||
url=manager.detected_url,
|
||||
command=manager._command,
|
||||
started_at=manager.started_at,
|
||||
started_at=manager.started_at.isoformat() if manager.started_at else None,
|
||||
)
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user