Extract import response models
This commit is contained in:
@@ -0,0 +1,55 @@
|
||||
from __future__ import annotations
|
||||
|
||||
from pydantic import BaseModel, Field
|
||||
|
||||
from api_server.import_sync_models import ImportSyncPreview
|
||||
from api_server.normalized_project_models import NormalizedProjectSummary
|
||||
|
||||
|
||||
class SnapshotSummary(BaseModel):
|
||||
snapshot_id: str
|
||||
project_id: str
|
||||
snapshot_hash: str | None
|
||||
node_count: int
|
||||
edge_count: int
|
||||
diagnostics_count: int
|
||||
unresolved_references_count: int
|
||||
|
||||
|
||||
class ImportSummary(BaseModel):
|
||||
source: str
|
||||
mode: str = "FULL_REPLACE"
|
||||
applied: bool = True
|
||||
status: str
|
||||
last_import: str
|
||||
source_path: str | None = None
|
||||
runtime_mode: str = "mock"
|
||||
runtime_diagnostics: list[str] = Field(default_factory=list)
|
||||
errors: list[str] = Field(default_factory=list)
|
||||
diagnostics_count: int = 0
|
||||
diagnostics: list[str] = Field(default_factory=list)
|
||||
object_count: int = 0
|
||||
module_count: int = 0
|
||||
form_count: int = 0
|
||||
role_count: int = 0
|
||||
extensions: list[str] = Field(default_factory=list)
|
||||
platform_version: str | None = None
|
||||
compatibility_mode: str | None = None
|
||||
snapshot: SnapshotSummary | None = None
|
||||
normalized_summary: NormalizedProjectSummary | None = None
|
||||
sync_preview: ImportSyncPreview | None = None
|
||||
|
||||
|
||||
class IndexProjectResponse(BaseModel):
|
||||
snapshot: SnapshotSummary
|
||||
|
||||
|
||||
class IncrementalFileResponse(BaseModel):
|
||||
snapshot: SnapshotSummary
|
||||
added_nodes: int
|
||||
updated_nodes: int
|
||||
removed_nodes: int
|
||||
added_edges: int
|
||||
removed_edges: int
|
||||
neo4j_projected: bool = False
|
||||
neo4j_error: str | None = None
|
||||
@@ -96,6 +96,12 @@ from api_server.html5_setup_controller import (
|
||||
)
|
||||
from api_server.import_quality_models import ImportQualityResponse
|
||||
from api_server.import_quality_service import import_quality_response as _build_import_quality_response
|
||||
from api_server.import_models import (
|
||||
ImportSummary,
|
||||
IncrementalFileResponse,
|
||||
IndexProjectResponse,
|
||||
SnapshotSummary,
|
||||
)
|
||||
from api_server.import_sync_models import ImportSyncPreview
|
||||
from api_server.import_sync_service import build_import_sync_preview as _build_import_sync_preview
|
||||
from api_server.metadata_tree_controller import (
|
||||
@@ -925,30 +931,6 @@ class ImportRequest(BaseModel):
|
||||
mode: ImportMode = ImportMode.FULL_REPLACE
|
||||
|
||||
|
||||
class ImportSummary(BaseModel):
|
||||
source: ImportSourceKind
|
||||
mode: ImportMode = ImportMode.FULL_REPLACE
|
||||
applied: bool = True
|
||||
status: str
|
||||
last_import: str
|
||||
source_path: str | None = None
|
||||
runtime_mode: str = "mock"
|
||||
runtime_diagnostics: list[str] = Field(default_factory=list)
|
||||
errors: list[str] = Field(default_factory=list)
|
||||
diagnostics_count: int = 0
|
||||
diagnostics: list[str] = Field(default_factory=list)
|
||||
object_count: int = 0
|
||||
module_count: int = 0
|
||||
form_count: int = 0
|
||||
role_count: int = 0
|
||||
extensions: list[str] = Field(default_factory=list)
|
||||
platform_version: str | None = None
|
||||
compatibility_mode: str | None = None
|
||||
snapshot: SnapshotSummary | None = None
|
||||
normalized_summary: NormalizedProjectSummary | None = None
|
||||
sync_preview: ImportSyncPreview | None = None
|
||||
|
||||
|
||||
class ProjectSetupResponse(BaseModel):
|
||||
project_id: str
|
||||
status: ProjectSetupStatus
|
||||
@@ -964,31 +946,6 @@ class IncrementalFileRequest(BaseModel):
|
||||
path: str
|
||||
|
||||
|
||||
class SnapshotSummary(BaseModel):
|
||||
snapshot_id: str
|
||||
project_id: str
|
||||
snapshot_hash: str | None
|
||||
node_count: int
|
||||
edge_count: int
|
||||
diagnostics_count: int
|
||||
unresolved_references_count: int
|
||||
|
||||
|
||||
class IndexProjectResponse(BaseModel):
|
||||
snapshot: SnapshotSummary
|
||||
|
||||
|
||||
class IncrementalFileResponse(BaseModel):
|
||||
snapshot: SnapshotSummary
|
||||
added_nodes: int
|
||||
updated_nodes: int
|
||||
removed_nodes: int
|
||||
added_edges: int
|
||||
removed_edges: int
|
||||
neo4j_projected: bool = False
|
||||
neo4j_error: str | None = None
|
||||
|
||||
|
||||
class MetadataTypeSpecResponse(BaseModel):
|
||||
code: str
|
||||
russian_name: str
|
||||
|
||||
Reference in New Issue
Block a user