diff --git a/agenta-backend/agenta_backend/core/shared/dtos.py b/agenta-backend/agenta_backend/core/shared/dtos.py index 85c3b303aa..ac7efb69c7 100644 --- a/agenta-backend/agenta_backend/core/shared/dtos.py +++ b/agenta-backend/agenta_backend/core/shared/dtos.py @@ -6,7 +6,20 @@ class LifecycleDTO(BaseModel): - created_at: datetime + created_at: Optional[datetime] = None updated_at: Optional[datetime] = None updated_by_id: Optional[UUID] = None + + +class IdentifierDTO(BaseModel): + id: UUID + + +class SlugDTO(BaseModel): + slug: str + + +class HeaderDTO(BaseModel): + name: Optional[str] = None + description: Optional[str] = None diff --git a/agenta-backend/agenta_backend/dbs/postgres/shared/dbas.py b/agenta-backend/agenta_backend/dbs/postgres/shared/dbas.py index 86d2c15e7f..05b0eb0752 100644 --- a/agenta-backend/agenta_backend/dbs/postgres/shared/dbas.py +++ b/agenta-backend/agenta_backend/dbs/postgres/shared/dbas.py @@ -1,4 +1,5 @@ -from sqlalchemy import Column, UUID, TIMESTAMP, func +from sqlalchemy.dialects.postgresql import JSONB +from sqlalchemy import Column, String, UUID, TIMESTAMP, func, Integer class ProjectScopeDBA: @@ -27,3 +28,36 @@ class LifecycleDBA: UUID(as_uuid=True), nullable=True, ) + + +class IdentifierDBA: + __abstract__ = True + + id = Column(UUID(as_uuid=True), nullable=False) + + +class SlugDBA: + __abstract__ = True + + slug = Column(String, nullable=False) + + +class HeaderDBA: + __abstract__ = True + + name = Column(String, nullable=True) + description = Column(String, nullable=True) + + +class VersionedDBA: + __abstract__ = True + + slug = Column(String, nullable=False) + version = Column(Integer, nullable=False) + id = Column(UUID(as_uuid=True), nullable=False) + + +class TagsDBA: + __abstract__ = True + + tags = Column(JSONB(none_as_null=True), nullable=True)