Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions rust/cloud-storage/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions rust/cloud-storage/document_storage_service/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@ models_bulk_upload = { path = "../models_bulk_upload" }
models_opensearch = { path = "../models_opensearch" }
models_pagination = { path = "../models_pagination", features = ["axum"] }
models_permissions = { path = "../models_permissions" }
properties = { path = "../properties" }
models_soup = { path = "../models_soup", features = ["schema"] }
rayon = "1.10.0"
redis = { workspace = true, features = [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ use frecency::{domain::services::FrecencyQueryServiceImpl, outbound::postgres::F
use macro_auth::middleware::decode_jwt::JwtValidationArgs;
use macro_env_var::env_var;
use macro_redis_cluster_client::Redis;
use properties::{PropertiesPgRepo, PropertiesServiceImpl};
use soup::{
domain::service::SoupImpl, inbound::axum_router::SoupRouterState,
outbound::pg_soup_repo::PgSoupRepo,
Expand All @@ -32,6 +33,7 @@ type DssSoupState = SoupRouterState<
>;

type SystemPropertiesService = SystemPropertiesServiceImpl<PgSystemPropertiesRepository>;
type PropertiesService = PropertiesServiceImpl<PropertiesPgRepo>;

#[derive(Clone, FromRef)]
pub(crate) struct ApiContext {
Expand All @@ -48,6 +50,7 @@ pub(crate) struct ApiContext {
pub conn_gateway_client: Arc<ConnectionGatewayClient>,
pub sync_service_client: Arc<SyncServiceClient>,
pub system_properties_service: Arc<SystemPropertiesService>,
pub properties_service: Arc<PropertiesService>,
pub jwt_validation_args: JwtValidationArgs,
pub config: Arc<Config>,
pub dss_auth_key: DocumentStorageServiceAuthKey,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,10 @@ use model::response::{
};
use model::user::UserContext;
use models_permissions::share_permission::access_level::OwnerAccessLevel;
use properties::PropertiesService;
use serde::Deserialize;
use sqs_client::search::{SearchQueueMessage, document::DocumentId};
use uuid::Uuid;

#[derive(Deserialize)]
pub struct Params {
Expand Down Expand Up @@ -46,6 +48,7 @@ pub async fn delete_document_handler(
doc: Extension<DocumentBasic>,
) -> impl IntoResponse {
tracing::info!("delete document");

// soft delete the document, this will remove the history and pins and mark the document as deleted
if let Err(e) = macro_db_client::document::soft_delete_document(&state.db, &document_id).await {
tracing::error!(error=?e, document_id=?document_id, "unable to soft delete document");
Expand All @@ -55,6 +58,24 @@ pub async fn delete_document_handler(
.send(StatusCode::INTERNAL_SERVER_ERROR);
}

// Unlink task parent/subtasks if this is a task (no-op for non-tasks)
if let Ok(task_id) = Uuid::parse_str(&document_id) {
if let Err(e) = state
.properties_service
.link_parent_task(task_id, None)
.await
{
tracing::warn!(error = ?e, "failed to unlink parent task on delete");
}
if let Err(e) = state
.properties_service
.link_subtasks(task_id, vec![])
.await
{
tracing::warn!(error = ?e, "failed to unlink subtasks on delete");
}
}

let response_data = GenericSuccessResponse { success: true };

macro_project_utils::update_project_modified(
Expand Down
3 changes: 3 additions & 0 deletions rust/cloud-storage/document_storage_service/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ use macro_entrypoint::MacroEntrypoint;
use macro_env_var::env_var;
use macro_middleware::auth::internal_access::InternalApiSecretKey;
use macro_redis_cluster_client::Redis;
use properties::{PropertiesPgRepo, PropertiesServiceImpl};
use secretsmanager_client::SecretManager;
use soup::{
domain::service::SoupImpl, inbound::axum_router::SoupRouterState,
Expand Down Expand Up @@ -187,6 +188,7 @@ async fn main() -> anyhow::Result<()> {
EmailServiceImpl::new(EmailPgRepo::new(db.clone()), frecency_service.clone());
let system_properties_service =
SystemPropertiesServiceImpl::new(PgSystemPropertiesRepository::new(db.clone()));
let properties_service = PropertiesServiceImpl::new(PropertiesPgRepo::new(db.clone()));
let api_context = ApiContext {
soup_router_state: SoupRouterState::new(
SoupImpl::new(
Expand All @@ -213,6 +215,7 @@ async fn main() -> anyhow::Result<()> {
conn_gateway_client: Arc::new(conn_gateway_client),
sync_service_client: Arc::new(sync_service_client),
system_properties_service: Arc::new(system_properties_service),
properties_service: Arc::new(properties_service),
config: Arc::new(config),
jwt_validation_args,
dss_auth_key,
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading
Loading