diff --git a/services/api-server/src/api_server/import_summary_service.py b/services/api-server/src/api_server/import_summary_service.py index 406a42f..f9def14 100644 --- a/services/api-server/src/api_server/import_summary_service.py +++ b/services/api-server/src/api_server/import_summary_service.py @@ -1,11 +1,10 @@ from __future__ import annotations -from datetime import datetime, timezone - from api_server.import_models import ImportSummary, SnapshotSummary from api_server.import_sync_models import ImportSyncPreview from api_server.normalized_project_models import NormalizedProjectSummary from api_server.normalized_project_service import normalized_project_summary +from api_server.time_utils import current_timestamp from one_c_normalizer import NormalizedProject from sir import NodeKind, SirSnapshot @@ -45,7 +44,7 @@ def import_summary_from_snapshot( mode=mode, applied=applied, status=status, - last_import=_current_timestamp(), + last_import=current_timestamp(), source_path=None, runtime_mode=runtime_mode, runtime_diagnostics=runtime_diagnostics, @@ -82,7 +81,7 @@ def import_summary_from_snapshot( mode=mode, applied=applied, status=status, - last_import=_current_timestamp(), + last_import=current_timestamp(), source_path=snapshot.metadata.source_root, runtime_mode=runtime_mode, runtime_diagnostics=runtime_diagnostics, @@ -125,7 +124,3 @@ def _summary_extensions( if empty_counts: return [] return list(metadata.get("extensions", default)) - - -def _current_timestamp() -> str: - return datetime.now(timezone.utc).isoformat() diff --git a/services/api-server/src/api_server/main.py b/services/api-server/src/api_server/main.py index d834200..7712277 100644 --- a/services/api-server/src/api_server/main.py +++ b/services/api-server/src/api_server/main.py @@ -153,6 +153,7 @@ from api_server.snapshot_module_service import ( module_sources_for_object as _snapshot_module_sources_for_object, snapshot_bsl_completion_items as _snapshot_bsl_completion_items, ) +from api_server.time_utils import current_timestamp as _current_timestamp from impact_engine import object_impact, routine_impact from incremental_indexer import rebuild_changed_file from integration_topology import IntegrationKind, build_integration_topology @@ -7225,12 +7226,6 @@ def _load_normalized_project(project_id: str) -> NormalizedProject | None: return normalized -def _current_timestamp() -> str: - from datetime import datetime, timezone - - return datetime.now(timezone.utc).isoformat() - - def _import_quality_response(project_id: str) -> ImportQualityResponse: normalized = _load_normalized_project(project_id) summary = _normalized_project_summary(normalized) if normalized is not None else None diff --git a/services/api-server/src/api_server/time_utils.py b/services/api-server/src/api_server/time_utils.py new file mode 100644 index 0000000..32f44d1 --- /dev/null +++ b/services/api-server/src/api_server/time_utils.py @@ -0,0 +1,7 @@ +from __future__ import annotations + +from datetime import datetime, timezone + + +def current_timestamp() -> str: + return datetime.now(timezone.utc).isoformat()