Add shared timestamp utility
This commit is contained in:
@@ -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()
|
||||
|
||||
Reference in New Issue
Block a user