fix: message sorting in playground (#3293)

This commit is contained in:
Ítalo Johnny 2024-08-12 19:09:08 -03:00 committed by GitHub
commit 7a93a708ee
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -2,7 +2,7 @@ from datetime import datetime, timezone
from typing import TYPE_CHECKING, Optional
from uuid import UUID, uuid4
from pydantic import field_validator, BaseModel
from pydantic import field_serializer, field_validator, BaseModel
from sqlmodel import JSON, Column, Field, Relationship, SQLModel
@ -32,6 +32,13 @@ class VertexBuildBase(SQLModel):
value = UUID(value)
return value
@field_serializer("timestamp")
@classmethod
def serialize_timestamp(cls, value):
if value.tzinfo is None:
value = value.replace(tzinfo=timezone.utc)
return value
class VertexBuildTable(VertexBuildBase, table=True): # type: ignore
__tablename__ = "vertex_build"