core: type operation timestamps

This commit is contained in:
a.tolmachev
2026-04-19 07:27:12 +00:00
parent 8d1f5284ba
commit 179165838a
15 changed files with 229 additions and 212 deletions
+15 -15
View File
@@ -385,7 +385,7 @@ async fn insert_version_row(
.bind(serialize_option_json_value(&snapshot.generated_draft)?.map(Json))
.bind(serialize_option_json_value(&snapshot.config_export)?.map(Json))
.bind(change_note)
.bind(&snapshot.updated_at)
.bind(snapshot.updated_at)
.bind(created_by)
.execute(&mut **tx)
.await?;
@@ -717,9 +717,9 @@ fn build_operation_summary(
status: String,
current_draft_version: i32,
latest_published_version: Option<i32>,
created_at: String,
updated_at: String,
published_at: Option<String>,
created_at: OffsetDateTime,
updated_at: OffsetDateTime,
published_at: Option<OffsetDateTime>,
) -> Result<OperationSummary, RegistryError> {
let target: Target = deserialize_json_value(target_json)?;
let (target_url, target_action) = target_summary(&target);
@@ -830,9 +830,9 @@ fn build_operation_version_record(
display_name: String,
category: String,
protocol: String,
operation_created_at: String,
operation_updated_at: String,
operation_published_at: Option<String>,
operation_created_at: OffsetDateTime,
operation_updated_at: OffsetDateTime,
operation_published_at: Option<OffsetDateTime>,
version: i32,
status: String,
target_json: Value,
@@ -846,7 +846,7 @@ fn build_operation_version_record(
generated_draft_json: Option<Value>,
config_export_json: Option<Value>,
change_note: Option<String>,
created_at: String,
created_at: OffsetDateTime,
created_by: Option<String>,
) -> Result<OperationVersionRecord, RegistryError> {
let operation_id = OperationId::new(id);
@@ -859,7 +859,7 @@ fn build_operation_version_record(
version,
status,
change_note,
created_at: created_at.clone(),
created_at,
created_by,
snapshot: RegistryOperation {
id: operation_id,
@@ -1190,7 +1190,7 @@ mod tests {
workspace_id: &test_workspace_id(),
operation_id: &operation_v2.id,
version: operation_v2.version,
published_at: "2026-03-25T12:10:00Z",
published_at: &timestamp("2026-03-25T12:10:00Z"),
published_by: Some("alice"),
})
.await
@@ -1275,7 +1275,7 @@ mod tests {
operation.generated_draft = None;
operation.samples = None;
operation.config_export = None;
operation.updated_at = "2026-03-25T12:34:00Z".to_owned();
operation.updated_at = timestamp("2026-03-25T12:34:00Z");
registry
.update_operation_draft(&test_workspace_id(), &operation)
@@ -1824,7 +1824,7 @@ mod tests {
workspace_id: &test_workspace_id(),
operation_id: &operation.id,
version: operation_v2.version,
published_at: "2026-03-25T12:10:00Z",
published_at: &timestamp("2026-03-25T12:10:00Z"),
published_by: Some("alice"),
})
.await
@@ -1904,7 +1904,7 @@ mod tests {
workspace_id: &test_workspace_id(),
operation_id: &operation.id,
version: operation_v2.version,
published_at: "2026-03-25T12:10:00Z",
published_at: &timestamp("2026-03-25T12:10:00Z"),
published_by: Some("alice"),
})
.await
@@ -2415,8 +2415,8 @@ mod tests {
format_version: "v1".to_owned(),
export_mode: ExportMode::Portable,
}),
created_at: "2026-03-25T11:58:00Z".to_owned(),
updated_at: format!("2026-03-25T12:{version:02}:00Z"),
created_at: timestamp("2026-03-25T11:58:00Z"),
updated_at: timestamp(&format!("2026-03-25T12:{version:02}:00Z")),
published_at: None,
}
}