generated from coulomb/repo-seed
feat: reexport domain schemas from hub-core
This commit is contained in:
@@ -1,24 +1,8 @@
|
||||
import uuid
|
||||
from datetime import datetime
|
||||
|
||||
from pydantic import BaseModel, ConfigDict
|
||||
|
||||
|
||||
class DomainCreate(BaseModel):
|
||||
slug: str
|
||||
name: str
|
||||
description: str | None = None
|
||||
|
||||
|
||||
class DomainUpdate(BaseModel):
|
||||
name: str | None = None
|
||||
description: str | None = None
|
||||
status: str | None = None
|
||||
|
||||
|
||||
class DomainRename(BaseModel):
|
||||
new_slug: str
|
||||
new_name: str
|
||||
from hub_core.schemas.domain import DomainCreate, DomainRead, DomainRename, DomainUpdate
|
||||
|
||||
|
||||
class RepoStub(BaseModel):
|
||||
@@ -31,17 +15,6 @@ class RepoStub(BaseModel):
|
||||
status: str
|
||||
|
||||
|
||||
class DomainRead(BaseModel):
|
||||
model_config = ConfigDict(from_attributes=True)
|
||||
id: uuid.UUID
|
||||
slug: str
|
||||
name: str
|
||||
description: str | None = None
|
||||
status: str
|
||||
created_at: datetime
|
||||
updated_at: datetime
|
||||
|
||||
|
||||
class DomainDetail(DomainRead):
|
||||
"""Domain with entity counts and repo list."""
|
||||
topic_count: int = 0
|
||||
@@ -59,3 +32,14 @@ class DomainSummary(BaseModel):
|
||||
active_workstream_count: int = 0
|
||||
ep_count: int = 0
|
||||
td_count: int = 0
|
||||
|
||||
|
||||
__all__ = [
|
||||
"DomainCreate",
|
||||
"DomainDetail",
|
||||
"DomainRead",
|
||||
"DomainRename",
|
||||
"DomainSummary",
|
||||
"DomainUpdate",
|
||||
"RepoStub",
|
||||
]
|
||||
|
||||
@@ -1,8 +1,15 @@
|
||||
from api.schemas.agent_message import MessageCreate
|
||||
from api.schemas.doi import DoIReport
|
||||
from api.schemas.domain import DomainCreate, DomainRead, DomainRename, DomainUpdate
|
||||
from api.schemas.tpsc import GDPR_WARNING_LEVELS, TPSCCatalogRead, TPSCGDPRReport
|
||||
from hub_core.schemas.agent_message import MessageCreate as CoreMessageCreate
|
||||
from hub_core.schemas.doi import DoIReport as CoreDoIReport
|
||||
from hub_core.schemas.domain import (
|
||||
DomainCreate as CoreDomainCreate,
|
||||
DomainRead as CoreDomainRead,
|
||||
DomainRename as CoreDomainRename,
|
||||
DomainUpdate as CoreDomainUpdate,
|
||||
)
|
||||
from hub_core.schemas.tpsc import (
|
||||
GDPR_WARNING_LEVELS as CORE_GDPR_WARNING_LEVELS,
|
||||
TPSCCatalogRead as CoreTPSCCatalogRead,
|
||||
@@ -18,6 +25,13 @@ def test_state_hub_reexports_core_doi_schema() -> None:
|
||||
assert DoIReport is CoreDoIReport
|
||||
|
||||
|
||||
def test_state_hub_reexports_core_domain_base_schemas() -> None:
|
||||
assert DomainCreate is CoreDomainCreate
|
||||
assert DomainRead is CoreDomainRead
|
||||
assert DomainRename is CoreDomainRename
|
||||
assert DomainUpdate is CoreDomainUpdate
|
||||
|
||||
|
||||
def test_state_hub_reexports_core_tpsc_schemas() -> None:
|
||||
assert TPSCCatalogRead is CoreTPSCCatalogRead
|
||||
assert TPSCGDPRReport is CoreTPSCGDPRReport
|
||||
|
||||
Reference in New Issue
Block a user