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.

feat(search): add UpdateEntityName search queue message (#271)

Will Hutchinson405164c679df
diff --git a/rust/cloud-storage/search_processing_service/src/process/mod.rs b/rust/cloud-storage/search_processing_service/src/process/mod.rs
index 09686bee19..ad3354442a 100644
--- a/rust/cloud-storage/search_processing_service/src/process/mod.rs
+++ b/rust/cloud-storage/search_processing_service/src/process/mod.rs
@@ -32,6 +32,9 @@ pub async fn process_message(
);
match search_extractor_message {
+ SearchQueueMessage::UpdateEntityName(_message) => {
+ todo!()
+ }
SearchQueueMessage::RemoveUserProfile(user_profile_id) => {
tracing::trace!(user_profile_id = user_profile_id, "removing user profile");
user::remove_user_profile(&ctx.opensearch_client, &user_profile_id).await?;
diff --git a/rust/cloud-storage/sqs_client/src/search/mod.rs b/rust/cloud-storage/sqs_client/src/search/mod.rs
index 875af87846..dc1b83a61b 100644
--- a/rust/cloud-storage/sqs_client/src/search/mod.rs
+++ b/rust/cloud-storage/sqs_client/src/search/mod.rs
@@ -5,6 +5,7 @@ use crate::{
chat::{ChatMessage, RemoveChatMessage, UpdateChatMessageMetadata},
document::{DocumentId, SearchExtractorMessage},
email::{EmailLinkMessage, EmailMessage, EmailThreadMessage},
+ name::UpdateEntityName,
project::{BulkRemoveProjectMessage, ProjectMessage},
},
};
@@ -16,6 +17,7 @@ pub mod channel;
pub mod chat;
pub mod document;
pub mod email;
+pub mod name;
pub mod project;
use crate::{MAX_BATCH_SIZE, PrimaryId};
@@ -89,6 +91,9 @@ pub enum SearchQueueMessage {
// User
RemoveUserProfile(String),
+
+ // Entity Name
+ UpdateEntityName(UpdateEntityName),
}
impl PrimaryId for SearchQueueMessage {
@@ -122,6 +127,7 @@ impl PrimaryId for SearchQueueMessage {
SearchQueueMessage::BulkRemoveProjectMessage(message) => message.project_ids[0].clone(),
SearchQueueMessage::RemoveUserProfile(message) => message.clone(),
+ SearchQueueMessage::UpdateEntityName(message) => message.entity_id.clone(),
}
}
}
@@ -152,6 +158,8 @@ impl SearchQueueMessage {
SearchQueueMessage::BulkRemoveProjectMessage(_) => Operation::Remove,
// Users
SearchQueueMessage::RemoveUserProfile(_) => Operation::Remove,
+ // Entity Name
+ SearchQueueMessage::UpdateEntityName(_) => Operation::UpdateMetadata,
}
}
}
diff --git a/rust/cloud-storage/sqs_client/src/search/name.rs b/rust/cloud-storage/sqs_client/src/search/name.rs
new file mode 100644
index 0000000000..0a49cd0d7b
--- /dev/null
+++ b/rust/cloud-storage/sqs_client/src/search/name.rs
@@ -0,0 +1,20 @@
+/// Tells you the entity type that we are inserting the name for
+/// These values map directly to the names of the opensearch indices
+/// Projects is excluded because it handles names on its own
+#[derive(serde::Serialize, serde::Deserialize, PartialEq, Eq, Debug)]
+#[serde(rename_all = "lowercase")]
+pub enum NameEntityType {
+ Channels,
+ Chats,
+ Documents,
+ Emails,
+}
+
+/// Update entity name message
+/// Sent to SPS via a queue for processing to update the names index with the new name
+/// of the entity
+#[derive(serde::Serialize, serde::Deserialize, PartialEq, Eq, Debug)]
+pub struct UpdateEntityName {
+ pub entity_id: String,
+ pub entity_type: NameEntityType,
+}