Skip to content

armgit / macro

Public Imported from GitHub
0

Macro is a unified workspace for teams: email, chat, docs, tasks, agents, calls, and CRM — @-linked together with shared AI memory.

718 B
Raw Blame
use opensearch_client::OpensearchClient;

#[tracing::instrument(skip(opensearch_client))]
pub async fn remove_user_profile(
    opensearch_client: &OpensearchClient,
    user_profile_id: &str,
) -> anyhow::Result<()> {
    if !user_profile_id.starts_with("macro|") {
        anyhow::bail!("user id must start with `macro|`");
    }

    // Delete documents of user
    opensearch_client
        .delete_documents_by_owner_id(user_profile_id)
        .await?;

    // Delete chats of user
    opensearch_client
        .delete_chat_by_user_id(user_profile_id)
        .await?;

    // Delete emails of user
    opensearch_client
        .delete_email_messages_by_user_id(user_profile_id)
        .await?;

    Ok(())
}