Skip to content

Commit f6b1e07

Browse files
committed
cargo check fixes
1 parent 6d39b0c commit f6b1e07

File tree

4 files changed

+27
-29
lines changed

4 files changed

+27
-29
lines changed

rust/cloud-storage/Cargo.lock

Lines changed: 0 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

rust/cloud-storage/document_storage_service/Cargo.toml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,6 @@ models_bulk_upload = { path = "../models_bulk_upload" }
7777
models_opensearch = { path = "../models_opensearch" }
7878
models_pagination = { path = "../models_pagination", features = ["axum"] }
7979
models_permissions = { path = "../models_permissions" }
80-
models_properties = { path = "../models_properties" }
8180
properties = { path = "../properties" }
8281
models_soup = { path = "../models_soup", features = ["schema"] }
8382
rayon = "1.10.0"

rust/cloud-storage/document_storage_service/src/api/documents/delete_document.rs

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,15 @@ pub async fn delete_document_handler(
4949
) -> impl IntoResponse {
5050
tracing::info!("delete document");
5151

52+
// soft delete the document, this will remove the history and pins and mark the document as deleted
53+
if let Err(e) = macro_db_client::document::soft_delete_document(&state.db, &document_id).await {
54+
tracing::error!(error=?e, document_id=?document_id, "unable to soft delete document");
55+
return GenericResponse::builder()
56+
.message("unable to delete document")
57+
.is_error(true)
58+
.send(StatusCode::INTERNAL_SERVER_ERROR);
59+
}
60+
5261
// Unlink task parent/subtasks if this is a task (no-op for non-tasks)
5362
if let Ok(task_id) = Uuid::parse_str(&document_id) {
5463
if let Err(e) = state
@@ -67,15 +76,6 @@ pub async fn delete_document_handler(
6776
}
6877
}
6978

70-
// soft delete the document, this will remove the history and pins and mark the document as deleted
71-
if let Err(e) = macro_db_client::document::soft_delete_document(&state.db, &document_id).await {
72-
tracing::error!(error=?e, document_id=?document_id, "unable to soft delete document");
73-
return GenericResponse::builder()
74-
.message("unable to delete document")
75-
.is_error(true)
76-
.send(StatusCode::INTERNAL_SERVER_ERROR);
77-
}
78-
7979
let response_data = GenericSuccessResponse { success: true };
8080

8181
macro_project_utils::update_project_modified(

rust/cloud-storage/properties/src/outbound/task_property_queries.rs

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -40,11 +40,11 @@ pub async fn link_parent_task(
4040
tracing::debug!(old_parent = ?old_parent, "fetched current parent");
4141

4242
// 2. Remove from old parent if changed
43-
if let Some(old_parent_id) = old_parent {
44-
if Some(old_parent_id) != parent_task_id {
45-
remove_from_parent_subtasks(&mut tx, old_parent_id, task_id).await?;
46-
tracing::debug!(old_parent = %old_parent_id, "removed task from old parent's Subtasks");
47-
}
43+
if let Some(old_parent_id) = old_parent
44+
&& Some(old_parent_id) != parent_task_id
45+
{
46+
remove_from_parent_subtasks(&mut tx, old_parent_id, task_id).await?;
47+
tracing::debug!(old_parent = %old_parent_id, "removed task from old parent's Subtasks");
4848
}
4949

5050
// 3. Set new parent (returns true if task exists)
@@ -86,10 +86,10 @@ pub async fn link_subtasks(
8686
let mut tx = pool.begin().await.context("failed to begin transaction")?;
8787

8888
// Validate: can't include parent as subtask (would create mutual reference)
89-
if let Some(current_parent) = get_task_parent(&mut tx, task_id).await? {
90-
if subtask_ids.contains(&current_parent) {
91-
anyhow::bail!("cannot set parent as subtask (would create circular reference)");
92-
}
89+
if let Some(current_parent) = get_task_parent(&mut tx, task_id).await?
90+
&& subtask_ids.contains(&current_parent)
91+
{
92+
anyhow::bail!("cannot set parent as subtask (would create circular reference)");
9393
}
9494

9595
// 1. Get current subtasks & compute diff
@@ -118,15 +118,15 @@ pub async fn link_subtasks(
118118

119119
// 3. For added subtasks: remove from old parent, set new parent
120120
for subtask_id in &added {
121-
if let Some(old_parent_id) = get_task_parent(&mut tx, *subtask_id).await? {
122-
if old_parent_id != task_id {
123-
remove_from_parent_subtasks(&mut tx, old_parent_id, *subtask_id).await?;
124-
tracing::debug!(
125-
subtask = %subtask_id,
126-
old_parent = %old_parent_id,
127-
"removed subtask from old parent's Subtasks"
128-
);
129-
}
121+
if let Some(old_parent_id) = get_task_parent(&mut tx, *subtask_id).await?
122+
&& old_parent_id != task_id
123+
{
124+
remove_from_parent_subtasks(&mut tx, old_parent_id, *subtask_id).await?;
125+
tracing::debug!(
126+
subtask = %subtask_id,
127+
old_parent = %old_parent_id,
128+
"removed subtask from old parent's Subtasks"
129+
);
130130
}
131131
let _ = set_task_parent(&mut tx, *subtask_id, Some(task_id)).await?;
132132
}

0 commit comments

Comments
 (0)