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(connection): delete document invalidation (#1852)

Will Hutchinsond619d7fec37b
diff --git a/rust/cloud-storage/Cargo.lock b/rust/cloud-storage/Cargo.lock
index dc0c60784e..f88900a1d5 100644
--- a/rust/cloud-storage/Cargo.lock
+++ b/rust/cloud-storage/Cargo.lock
@@ -96,6 +96,7 @@ dependencies = [
"axum",
"chrono",
"comms",
+ "connection",
"cool_asserts",
"documents",
"email",
@@ -2929,6 +2930,7 @@ dependencies = [
"comms",
"comms_db_client",
"comms_service",
+ "connection",
"connection_gateway_client",
"cool_asserts",
"cowlike",
diff --git a/rust/cloud-storage/ai_tools/Cargo.toml b/rust/cloud-storage/ai_tools/Cargo.toml
index 528c6c1a86..ac4f3ae22a 100644
--- a/rust/cloud-storage/ai_tools/Cargo.toml
+++ b/rust/cloud-storage/ai_tools/Cargo.toml
@@ -6,16 +6,21 @@ version = "0.1.0"
[dependencies]
ai = { path = "../ai" }
+ai_format = { path = "../ai_format" }
ai_toolset = { path = "../ai_toolset" }
+anthropic = { path = "../anthropic" }
anyhow.workspace = true
async-trait.workspace = true
axum = { workspace = true, features = ["macros"] }
chrono.workspace = true
comms = { path = "../comms", features = ["outbound"] }
+connection = { path = "../connection", default-features = false, features = [
+ "ports",
+] }
documents = { path = "../documents", features = ["ai_tools"] }
email = { path = "../email", features = ["ai_schema", "axum", "outbound"] }
-entity_access = { path = "../entity_access" }
email_service_client = { path = "../email_service_client" }
+entity_access = { path = "../entity_access" }
frecency = { path = "../frecency", features = ["outbound", "postgres"] }
item_filters = { path = "../item_filters" }
lazy_static.workspace = true
@@ -45,8 +50,6 @@ tokio.workspace = true
tracing.workspace = true
utoipa.workspace = true
uuid.workspace = true
-ai_format= { path = "../ai_format" }
-anthropic = { path = "../anthropic"}
[dev-dependencies]
cool_asserts = "2"
diff --git a/rust/cloud-storage/ai_tools/src/tool_context.rs b/rust/cloud-storage/ai_tools/src/tool_context.rs
index 8737289c76..2f84aff349 100644
--- a/rust/cloud-storage/ai_tools/src/tool_context.rs
+++ b/rust/cloud-storage/ai_tools/src/tool_context.rs
@@ -3,6 +3,7 @@ use comms::{
domain::service::ChannelServiceImpl,
outbound::postgres::{comms_repo::PgCommsRepo, user_repo::PgUserRepo},
};
+use connection::domain::ports::ConnectionService;
use documents::{
domain::ports::TaskPropertiesPort,
inbound::toolset::DocumentToolContext,
@@ -53,11 +54,25 @@ impl TaskPropertiesPort for NoOpTaskProperties {
}
}
+/// No-op connection service
+#[derive(Clone)]
+pub struct NoOpConnectionService;
+
+impl ConnectionService for NoOpConnectionService {
+ async fn send_invalidation_event<'a, T: std::fmt::Debug + serde::Serialize + Send>(
+ &self,
+ _invalidation_event: connection::domain::models::InvalidationEvent<'a, T>,
+ ) -> Result<(), connection::domain::models::ConnectionError> {
+ Ok(())
+ }
+}
+
/// Type alias for the document service implementation used by AI tools
pub type ToolDocumentService = documents::domain::service::DocumentServiceImpl<
PgDocumentRepo,
S3UploadUrlAdapter,
NoOpTaskProperties,
+ NoOpConnectionService,
>;
/// Type alias for the entity access service implementation
diff --git a/rust/cloud-storage/connection/src/domain/models.rs b/rust/cloud-storage/connection/src/domain/models.rs
index 5259f0a6ba..8778ed789f 100644
--- a/rust/cloud-storage/connection/src/domain/models.rs
+++ b/rust/cloud-storage/connection/src/domain/models.rs
@@ -2,8 +2,7 @@
use std::borrow::Cow;
-use entity_access::domain::models::EntityType;
-use macro_user_id::user_id::MacroUserIdStr;
+use entity_access::domain::models::{EntityAccessAuth, EntityType};
/// The invalidation message type
pub const INVALIDATION_MESSAGE_TYPE: &str = "invalidation";
@@ -18,6 +17,7 @@ pub enum ConnectionError {
/// Reason for an entity to be invalidated
#[derive(Debug, serde::Serialize)]
+#[serde(rename_all = "lowercase")]
pub enum InvalidationReason {
/// The entity was deleted
Deleted,
@@ -29,6 +29,7 @@ pub enum InvalidationReason {
/// An invalidation event
#[derive(Debug, serde::Serialize)]
+#[serde(rename_all = "lowercase")]
pub struct InvalidationEvent<'a, T: std::fmt::Debug + serde::Serialize> {
/// The id of the entity to invalidate
pub entity_id: Cow<'a, str>,
@@ -36,8 +37,9 @@ pub struct InvalidationEvent<'a, T: std::fmt::Debug + serde::Serialize> {
pub entity_type: EntityType,
/// The reason for invalidation
pub invalidation_reason: InvalidationReason,
- /// The user who created the invalidation
- pub invalidated_by: MacroUserIdStr<'a>,
+ /// The creator of the invalidation
+ pub invalidated_by: EntityAccessAuth,
/// Any additional metadata
- pub metadata: T,
+ #[serde(skip_serializing_if = "Option::is_none")]
+ pub metadata: Option<T>,
}
diff --git a/rust/cloud-storage/connection/src/domain/service.rs b/rust/cloud-storage/connection/src/domain/service.rs
index 7928912ba3..fabded4ebe 100644
--- a/rust/cloud-storage/connection/src/domain/service.rs
+++ b/rust/cloud-storage/connection/src/domain/service.rs
@@ -46,16 +46,24 @@ impl<E: EntityAccessService, Cgw: ConnectionGateway> ConnectionService
.map_err(|e| ConnectionError::Internal(e.into()))?;
// Filter out user who made the invalidation
- let users = users
- .into_iter()
- .filter_map(|p| {
- if p.as_ref() != invalidation_event.invalidated_by.as_ref() {
- Some(p.0)
- } else {
- None
- }
- })
- .collect::<Vec<MacroUserId<Lowercase<'a>>>>();
+ let users = match &invalidation_event.invalidated_by {
+ entity_access::domain::models::EntityAccessAuth::Authenticated(macro_user_id_str) => {
+ users
+ .into_iter()
+ .filter_map(|p| {
+ if p.as_ref() != macro_user_id_str.as_ref() {
+ Some(p.0)
+ } else {
+ None
+ }
+ })
+ .collect::<Vec<MacroUserId<Lowercase<'a>>>>()
+ }
+ entity_access::domain::models::EntityAccessAuth::Unauthenticated
+ | entity_access::domain::models::EntityAccessAuth::Internal => {
+ users.into_iter().map(|s| s.0.to_owned()).collect()
+ }
+ };
if users.is_empty() {
tracing::trace!("no users to send invalidation to");
diff --git a/rust/cloud-storage/document_cognition_service/src/api/context/test.rs b/rust/cloud-storage/document_cognition_service/src/api/context/test.rs
index 576c56d2db..bc77f8263d 100644
--- a/rust/cloud-storage/document_cognition_service/src/api/context/test.rs
+++ b/rust/cloud-storage/document_cognition_service/src/api/context/test.rs
@@ -273,6 +273,7 @@ pub async fn test_api_context(pool: sqlx::Pool<sqlx::Postgres>) -> std::sync::Ar
s3_upload_adapter,
ai_tools::NoOpTaskProperties,
pool.clone(),
+ ai_tools::NoOpConnectionService,
);
let entity_access_service = entity_access::domain::service::EntityAccessServiceImpl::new(
entity_access::outbound::PgAccessRepository::new(pool.clone()),
diff --git a/rust/cloud-storage/document_cognition_service/src/main.rs b/rust/cloud-storage/document_cognition_service/src/main.rs
index 043be3e44c..d21aa89cd6 100644
--- a/rust/cloud-storage/document_cognition_service/src/main.rs
+++ b/rust/cloud-storage/document_cognition_service/src/main.rs
@@ -1,6 +1,6 @@
#![recursion_limit = "256"]
use crate::api::context::ApiContext;
-use ai_tools::NoOpTaskProperties;
+use ai_tools::{NoOpConnectionService, NoOpTaskProperties};
use anyhow::Context;
use comms::domain::service::ChannelServiceImpl;
use comms::outbound::postgres::comms_repo::PgCommsRepo;
@@ -271,6 +271,7 @@ async fn main() -> anyhow::Result<()> {
s3_upload_adapter,
NoOpTaskProperties,
db.clone(),
+ NoOpConnectionService,
);
let entity_access_service = EntityAccessServiceImpl::new(PgAccessRepository::new(db.clone()));
let lexical_client_for_tools = (*lexical_client).clone();
diff --git a/rust/cloud-storage/document_storage_service/Cargo.toml b/rust/cloud-storage/document_storage_service/Cargo.toml
index 84a8ae563c..da266551b7 100644
--- a/rust/cloud-storage/document_storage_service/Cargo.toml
+++ b/rust/cloud-storage/document_storage_service/Cargo.toml
@@ -48,6 +48,9 @@ cloudfront_sign = { workspace = true }
comms = { path = "../comms", features = ["outbound"] }
comms_db_client = { path = "../comms_db_client" }
comms_service = { path = "../comms_service" }
+connection = { path = "../connection", default-features = false, features = [
+ "outbound",
+] }
connection_gateway_client = { path = "../connection_gateway_client" }
cowlike = { path = "../cowlike" }
document_sub_type = { path = "../document_sub_type" }
diff --git a/rust/cloud-storage/document_storage_service/src/api/context.rs b/rust/cloud-storage/document_storage_service/src/api/context.rs
index 70a78619ea..fcc0d19f18 100644
--- a/rust/cloud-storage/document_storage_service/src/api/context.rs
+++ b/rust/cloud-storage/document_storage_service/src/api/context.rs
@@ -10,6 +10,10 @@ use comms::{
outbound::postgres::{comms_repo::PgCommsRepo, user_repo::PgUserRepo},
};
use comms_service::CommsHandlerState;
+use connection::{
+ domain::service::ConnectionServiceImpl,
+ outbound::connection_gateway_client::ConnectionGatewayImpl,
+};
use connection_gateway_client::client::ConnectionGatewayClient;
use documents_hex::domain::ports::TaskPropertiesPort;
use documents_hex::domain::service::DocumentServiceImpl;
@@ -121,12 +125,16 @@ impl TaskPropertiesPort for TaskPropertiesAdapter {
}
}
-/// Type alias for the documents router state.
-pub(crate) type DocumentsState = DocumentRouterState<
- DocumentServiceImpl<PgDocumentRepo, S3UploadUrlAdapter, TaskPropertiesAdapter>,
- EntityAccessService,
+pub(crate) type DocumentService = DocumentServiceImpl<
+ PgDocumentRepo,
+ S3UploadUrlAdapter,
+ TaskPropertiesAdapter,
+ ConnectionServiceImpl<EntityAccessService, ConnectionGatewayImpl>,
>;
+/// Type alias for the documents router state.
+pub(crate) type DocumentsState = DocumentRouterState<DocumentService, EntityAccessService>;
+
/// Type alias for the ChannelServiceImpl used by comms
pub(crate) type CommsChannelService =
ChannelServiceImpl<PgCommsRepo, PgUserRepo, FrecencyPgStorage>;
@@ -138,13 +146,9 @@ pub(crate) type CommsState = CommsRouterState<CommsChannelService>;
pub(crate) type DssChannelsState =
ChannelsRouterState<ChannelMessagesServiceImpl<PgChannelMessagesRepo>, EntityAccessService>;
-/// Type alias for the document service used by the github sync service.
-pub(crate) type GithubDocumentService =
- DocumentServiceImpl<PgDocumentRepo, S3UploadUrlAdapter, TaskPropertiesAdapter>;
-
/// Type alias for the github sync service.
pub(crate) type GithubSyncServiceType =
- GithubSyncServiceImpl<GithubDocumentService, PgGithubSyncRepo, GithubSyncClientImpl>;
+ GithubSyncServiceImpl<DocumentService, PgGithubSyncRepo, GithubSyncClientImpl>;
#[derive(Clone, FromRef)]
pub(crate) struct ApiContext {
diff --git a/rust/cloud-storage/document_storage_service/src/api/internal/mod.rs b/rust/cloud-storage/document_storage_service/src/api/internal/mod.rs
index 60454c9a0f..5a3d7b3212 100644
--- a/rust/cloud-storage/document_storage_service/src/api/internal/mod.rs
+++ b/rust/cloud-storage/document_storage_service/src/api/internal/mod.rs
@@ -1,4 +1,3 @@
-use super::context::TaskPropertiesAdapter;
use super::{
context::{ApiContext, EntityAccessService},
documents::{export_document, get_document_version},
@@ -15,6 +14,7 @@ use super::{
},
user::populate_items,
};
+use crate::api::context::DocumentService;
use crate::api::items::get_item_ids;
use crate::api::threads::get_thread_access_level;
use crate::api::{documents::get_documents_metadata, items::validate_item_ids};
@@ -22,9 +22,6 @@ use axum::{
Router,
routing::{delete, get, post, put},
};
-use documents_hex::domain::service::DocumentServiceImpl;
-use documents_hex::outbound::pg_document_repo::PgDocumentRepo;
-use documents_hex::outbound::s3_upload_url::S3UploadUrlAdapter;
use macro_middleware::{
auth::ensure_user_exists,
cloud_storage::{document::ensure_document_exists, thread::ensure_thread_exists},
@@ -53,7 +50,7 @@ pub fn router(state: ApiContext) -> Router<ApiContext> {
.route(
"/documents/:document_id",
get(documents_hex::inbound::axum_router::get_document_handler::<
- DocumentServiceImpl<PgDocumentRepo, S3UploadUrlAdapter, TaskPropertiesAdapter>,
+ DocumentService,
EntityAccessService,
>)
.layer(ensure_document_exists_middleware.clone()),
@@ -84,7 +81,7 @@ pub fn router(state: ApiContext) -> Router<ApiContext> {
"/documents/:document_id/location_v3",
get(
documents_hex::inbound::axum_router::get_location_v3_handler::<
- DocumentServiceImpl<PgDocumentRepo, S3UploadUrlAdapter, TaskPropertiesAdapter>,
+ DocumentService,
EntityAccessService,
>,
)
@@ -102,7 +99,7 @@ pub fn router(state: ApiContext) -> Router<ApiContext> {
"/documents",
post(
documents_hex::inbound::axum_router::create_document_handler::<
- DocumentServiceImpl<PgDocumentRepo, S3UploadUrlAdapter, TaskPropertiesAdapter>,
+ DocumentService,
EntityAccessService,
>,
),
diff --git a/rust/cloud-storage/document_storage_service/src/main.rs b/rust/cloud-storage/document_storage_service/src/main.rs
index 8ecdf2584a..16e0720331 100644
--- a/rust/cloud-storage/document_storage_service/src/main.rs
+++ b/rust/cloud-storage/document_storage_service/src/main.rs
@@ -18,6 +18,10 @@ use comms::{
outbound::postgres::{comms_repo::PgCommsRepo, user_repo::PgUserRepo},
};
use config::{Config, Environment};
+use connection::{
+ domain::service::ConnectionServiceImpl,
+ outbound::connection_gateway_client::ConnectionGatewayImpl,
+};
use connection_gateway_client::client::ConnectionGatewayClient;
use documents_hex::domain::models::CloudFrontConfig;
use documents_hex::domain::service::DocumentServiceImpl;
@@ -312,6 +316,12 @@ async fn main() -> anyhow::Result<()> {
config.vars.document_storage_bucket.as_ref(),
config.vars.docx_document_upload_bucket.as_ref(),
);
+
+ let connection_service = ConnectionServiceImpl::new(
+ entity_access_service.clone(),
+ Arc::new(ConnectionGatewayImpl::new(conn_gateway_client.clone())),
+ );
+
let document_service = Arc::new(DocumentServiceImpl::new(
document_repo,
cloudfront_config,
@@ -319,6 +329,7 @@ async fn main() -> anyhow::Result<()> {
s3_upload_adapter,
TaskPropertiesAdapter(system_properties_service.clone()),
db.clone(),
+ connection_service,
));
let github_webhook_secret = secretsmanager_client
diff --git a/rust/cloud-storage/documents/Cargo.toml b/rust/cloud-storage/documents/Cargo.toml
index 79c0788bbc..93fc79caa3 100644
--- a/rust/cloud-storage/documents/Cargo.toml
+++ b/rust/cloud-storage/documents/Cargo.toml
@@ -26,12 +26,7 @@ axum = [
]
default = ["ai_tools", "axum", "inbound", "outbound", "ports"]
inbound = ["axum", "ports"]
-outbound = [
- "dep:aws-sdk-s3",
- "dep:base64",
- "dep:hex",
- "ports",
-]
+outbound = ["dep:aws-sdk-s3", "dep:base64", "dep:hex", "ports"]
ports = ["dep:tokio"]
[dependencies]
diff --git a/rust/cloud-storage/documents/examples/documents_toolset.rs b/rust/cloud-storage/documents/examples/documents_toolset.rs
index 41ac16624a..6aa1317dea 100644
--- a/rust/cloud-storage/documents/examples/documents_toolset.rs
+++ b/rust/cloud-storage/documents/examples/documents_toolset.rs
@@ -21,6 +21,7 @@
use ai::tool::tool_loop::cli::Cli;
use ai::tool::types::RequestContext;
use ai::types::Model;
+use connection::domain::ports::ConnectionService;
use documents::domain::models::CloudFrontConfig;
use documents::domain::ports::TaskPropertiesPort;
use documents::domain::service::DocumentServiceImpl;
@@ -35,6 +36,19 @@ use sqlx::PgPool;
use std::sync::Arc;
use sync_service_client::SyncServiceClient;
+/// No-op connection service
+#[derive(Clone)]
+struct NoOpConnectionService;
+
+impl ConnectionService for NoOpConnectionService {
+ async fn send_invalidation_event<'a, T: std::fmt::Debug + serde::Serialize + Send>(
+ &self,
+ _invalidation_event: connection::domain::models::InvalidationEvent<'a, T>,
+ ) -> Result<(), connection::domain::models::ConnectionError> {
+ Ok(())
+ }
+}
+
/// No-op task properties service (not needed for toolset example).
#[derive(Clone)]
struct NoOpTaskProperties;
@@ -112,6 +126,7 @@ async fn main() {
s3_upload_adapter,
NoOpTaskProperties,
pool,
+ NoOpConnectionService,
);
let lexical_client = LexicalClient::new(sync_service_auth_key, lexical_service_url);
diff --git a/rust/cloud-storage/documents/src/domain/service.rs b/rust/cloud-storage/documents/src/domain/service.rs
index 1a06feec6d..53f2ff387e 100644
--- a/rust/cloud-storage/documents/src/domain/service.rs
+++ b/rust/cloud-storage/documents/src/domain/service.rs
@@ -3,11 +3,14 @@
#[cfg(test)]
mod tests;
+use std::borrow::Cow;
use std::str::FromStr;
use std::time::{SystemTime, UNIX_EPOCH};
use anyhow::anyhow;
use cloudfront_sign::{SignedOptions, get_signed_url};
+use connection::domain::models::{InvalidationEvent, InvalidationReason};
+use connection::domain::ports::ConnectionService;
use document_sub_type::DocumentSubType;
use entity_access::domain::models::{
EntityAccessAuth, EntityAccessReceipt, OwnerAccessLevel, ViewAccessLevel,
@@ -29,17 +32,23 @@ use super::models::{CloudFrontConfig, CreateDocumentRepoArgs, DocumentError, Loc
use super::ports::{DocumentRepo, DocumentService, PresignedUploadUrlPort, TaskPropertiesPort};
/// The concrete document service implementation.
-pub struct DocumentServiceImpl<R: DocumentRepo, U: PresignedUploadUrlPort, T: TaskPropertiesPort> {
+pub struct DocumentServiceImpl<
+ R: DocumentRepo,
+ U: PresignedUploadUrlPort,
+ T: TaskPropertiesPort,
+ C: ConnectionService,
+> {
repo: R,
cloudfront_config: CloudFrontConfig,
sync_service_client: sync_service_client::SyncServiceClient,
upload_url_service: U,
task_properties_service: T,
+ connection_service: C,
db: PgPool,
}
-impl<R: DocumentRepo, U: PresignedUploadUrlPort, T: TaskPropertiesPort>
- DocumentServiceImpl<R, U, T>
+impl<R: DocumentRepo, U: PresignedUploadUrlPort, T: TaskPropertiesPort, C: ConnectionService>
+ DocumentServiceImpl<R, U, T, C>
{
/// Create a new document service.
pub fn new(
@@ -49,6 +58,7 @@ impl<R: DocumentRepo, U: PresignedUploadUrlPort, T: TaskPropertiesPort>
upload_url_service: U,
task_properties_service: T,
db: PgPool,
+ connection_service: C,
) -> Self {
Self {
repo,
@@ -57,6 +67,7 @@ impl<R: DocumentRepo, U: PresignedUploadUrlPort, T: TaskPropertiesPort>
upload_url_service,
task_properties_service,
db,
+ connection_service,
}
}
@@ -269,8 +280,8 @@ impl<R: DocumentRepo, U: PresignedUploadUrlPort, T: TaskPropertiesPort>
}
}
-impl<R: DocumentRepo, U: PresignedUploadUrlPort, T: TaskPropertiesPort> DocumentService
- for DocumentServiceImpl<R, U, T>
+impl<R: DocumentRepo, U: PresignedUploadUrlPort, T: TaskPropertiesPort, C: ConnectionService>
+ DocumentService for DocumentServiceImpl<R, U, T, C>
{
#[tracing::instrument(err, skip(self))]
async fn get_document(
@@ -409,6 +420,20 @@ impl<R: DocumentRepo, U: PresignedUploadUrlPort, T: TaskPropertiesPort> Document
EntityAccessAuth::Unauthenticated | EntityAccessAuth::Internal => (),
}
+ let _ = self
+ .connection_service
+ .send_invalidation_event(InvalidationEvent::<()> {
+ invalidation_reason: InvalidationReason::Deleted,
+ entity_id: Cow::Borrowed(&entity_access_receipt.entity().entity_id),
+ entity_type: entity_access_receipt.entity().entity_type,
+ invalidated_by: entity_access_receipt.auth().clone(),
+ metadata: None,
+ })
+ .await
+ .inspect_err(|e| {
+ tracing::error!(error=?e, "failed to send invalidation event");
+ });
+
Ok(())
}
diff --git a/rust/cloud-storage/entity_access/src/domain/models.rs b/rust/cloud-storage/entity_access/src/domain/models.rs
index 2d1ded143c..218d3f798e 100644
--- a/rust/cloud-storage/entity_access/src/domain/models.rs
+++ b/rust/cloud-storage/entity_access/src/domain/models.rs
@@ -2,7 +2,7 @@
use std::marker::PhantomData;
-use macro_user_id::{lowercased::Lowercase, user_id::MacroUserId};
+use macro_user_id::user_id::MacroUserIdStr;
use serde::{Deserialize, Serialize};
pub use model_entity::EntityType;
@@ -158,7 +158,7 @@ pub enum ChannelRoleResult {
}
/// A given entity
-#[derive(Debug)]
+#[derive(Debug, Clone)]
pub struct Entity {
/// The id of the entity
pub entity_id: String,
@@ -167,10 +167,11 @@ pub struct Entity {
}
/// The entity access auth type
-#[derive(Debug)]
+#[derive(Debug, Clone, serde::Serialize)]
+#[serde(untagged)]
pub enum EntityAccessAuth {
/// The user is authenticated
- Authenticated(MacroUserId<Lowercase<'static>>),
+ Authenticated(MacroUserIdStr<'static>),
/// The user is unauthenticated
Unauthenticated,
/// Internally authenticated
@@ -181,7 +182,7 @@ pub enum EntityAccessAuth {
///
/// The type parameter `T` encodes the minimum permission that was verified
/// when this receipt was created.
-#[derive(Debug)]
+#[derive(Debug, Clone)]
pub struct EntityAccessReceipt<T: RequiredPermission> {
/// The entity access authentication method
pub(crate) auth: EntityAccessAuth,
diff --git a/rust/cloud-storage/entity_access/src/domain/service.rs b/rust/cloud-storage/entity_access/src/domain/service.rs
index 8f24a850ec..12b56b1db5 100644
--- a/rust/cloud-storage/entity_access/src/domain/service.rs
+++ b/rust/cloud-storage/entity_access/src/domain/service.rs
@@ -97,7 +97,7 @@ where
}
Ok(EntityAccessReceipt {
- auth: EntityAccessAuth::Authenticated(user_id.clone().into_owned()),
+ auth: EntityAccessAuth::Authenticated(MacroUserIdStr(user_id.clone().into_owned())),
entity: Entity {
entity_id: entity_id.to_string(),
entity_type,
diff --git a/rust/cloud-storage/entity_access/src/inbound/axum_extractors/channel.rs b/rust/cloud-storage/entity_access/src/inbound/axum_extractors/channel.rs
index b95a8b208f..563d614fb4 100644
--- a/rust/cloud-storage/entity_access/src/inbound/axum_extractors/channel.rs
+++ b/rust/cloud-storage/entity_access/src/inbound/axum_extractors/channel.rs
@@ -115,7 +115,7 @@ where
entity_id: channel_id,
entity_type: EntityType::Channel,
},
- auth: EntityAccessAuth::Authenticated(macro_user_id.0),
+ auth: EntityAccessAuth::Authenticated(macro_user_id),
entity_permission: permission,
_marker: PhantomData,
},
diff --git a/rust/cloud-storage/entity_access/src/inbound/axum_extractors/chat.rs b/rust/cloud-storage/entity_access/src/inbound/axum_extractors/chat.rs
index b5b28a5a65..e19df25093 100644
--- a/rust/cloud-storage/entity_access/src/inbound/axum_extractors/chat.rs
+++ b/rust/cloud-storage/entity_access/src/inbound/axum_extractors/chat.rs
@@ -94,7 +94,7 @@ where
entity_id: chat_context.id.clone(),
entity_type: EntityType::Chat,
},
- auth: EntityAccessAuth::Authenticated(user_id.clone().0),
+ auth: EntityAccessAuth::Authenticated(user_id.clone()),
entity_permission: EntityPermission::AccessLevel {
access_level: AccessLevel::Owner,
},
@@ -132,7 +132,7 @@ where
entity_type: EntityType::Chat,
},
auth: macro_user_id
- .map(|m| EntityAccessAuth::Authenticated(m.0))
+ .map(EntityAccessAuth::Authenticated)
.unwrap_or(EntityAccessAuth::Unauthenticated),
entity_permission: permission,
_marker: PhantomData,
diff --git a/rust/cloud-storage/entity_access/src/inbound/axum_extractors/document.rs b/rust/cloud-storage/entity_access/src/inbound/axum_extractors/document.rs
index 78d4d3c5a4..194b92b85b 100644
--- a/rust/cloud-storage/entity_access/src/inbound/axum_extractors/document.rs
+++ b/rust/cloud-storage/entity_access/src/inbound/axum_extractors/document.rs
@@ -99,7 +99,7 @@ where
entity_id: document_context.document_id.clone(),
entity_type: EntityType::Document,
},
- auth: EntityAccessAuth::Authenticated(user_id.clone().0),
+ auth: EntityAccessAuth::Authenticated(user_id.clone()),
entity_permission: EntityPermission::AccessLevel {
access_level: AccessLevel::Owner,
},
@@ -141,7 +141,7 @@ where
entity_type: EntityType::Document,
},
auth: macro_user_id
- .map(|m| EntityAccessAuth::Authenticated(m.0))
+ .map(EntityAccessAuth::Authenticated)
.unwrap_or(EntityAccessAuth::Unauthenticated),
entity_permission: permission,
_marker: PhantomData,
diff --git a/rust/cloud-storage/entity_access/src/inbound/axum_extractors/entity_permission.rs b/rust/cloud-storage/entity_access/src/inbound/axum_extractors/entity_permission.rs
index 7c992fbc32..b3b35b6ec1 100644
--- a/rust/cloud-storage/entity_access/src/inbound/axum_extractors/entity_permission.rs
+++ b/rust/cloud-storage/entity_access/src/inbound/axum_extractors/entity_permission.rs
@@ -122,7 +122,7 @@ where
entity_type: parsed_type,
},
auth: macro_user_id
- .map(|m| EntityAccessAuth::Authenticated(m.0))
+ .map(EntityAccessAuth::Authenticated)
.unwrap_or(EntityAccessAuth::Unauthenticated),
entity_permission: permission,
_marker: PhantomData,
diff --git a/rust/cloud-storage/entity_access/src/inbound/axum_extractors/history.rs b/rust/cloud-storage/entity_access/src/inbound/axum_extractors/history.rs
index ac811002b9..162d5a01e4 100644
--- a/rust/cloud-storage/entity_access/src/inbound/axum_extractors/history.rs
+++ b/rust/cloud-storage/entity_access/src/inbound/axum_extractors/history.rs
@@ -113,7 +113,7 @@ where
entity_type,
},
auth: macro_user_id
- .map(|m| EntityAccessAuth::Authenticated(m.0))
+ .map(EntityAccessAuth::Authenticated)
.unwrap_or(EntityAccessAuth::Unauthenticated),
entity_permission: permission,
_marker: PhantomData,
diff --git a/rust/cloud-storage/entity_access/src/inbound/axum_extractors/internal_entity_access.rs b/rust/cloud-storage/entity_access/src/inbound/axum_extractors/internal_entity_access.rs
deleted file mode 100644
index e69de29bb2..0000000000
diff --git a/rust/cloud-storage/entity_access/src/inbound/axum_extractors/project.rs b/rust/cloud-storage/entity_access/src/inbound/axum_extractors/project.rs
index 83574a48ea..003f09afee 100644
--- a/rust/cloud-storage/entity_access/src/inbound/axum_extractors/project.rs
+++ b/rust/cloud-storage/entity_access/src/inbound/axum_extractors/project.rs
@@ -95,7 +95,7 @@ where
entity_id: project_context.id.clone(),
entity_type: EntityType::Project,
},
- auth: EntityAccessAuth::Authenticated(user_id.clone().0),
+ auth: EntityAccessAuth::Authenticated(user_id.clone()),
entity_permission: EntityPermission::AccessLevel {
access_level: AccessLevel::Owner,
},
@@ -137,7 +137,7 @@ where
entity_type: EntityType::Project,
},
auth: macro_user_id
- .map(|m| EntityAccessAuth::Authenticated(m.0))
+ .map(EntityAccessAuth::Authenticated)
.unwrap_or(EntityAccessAuth::Unauthenticated),
entity_permission: permission,
_marker: PhantomData,
@@ -313,7 +313,7 @@ where
entity_type: EntityType::Project,
},
auth: macro_user_id
- .map(|m| EntityAccessAuth::Authenticated(m.0))
+ .map(EntityAccessAuth::Authenticated)
.unwrap_or(EntityAccessAuth::Unauthenticated),
entity_permission: permission,
_marker: PhantomData,
diff --git a/rust/cloud-storage/entity_access/src/inbound/axum_extractors/thread.rs b/rust/cloud-storage/entity_access/src/inbound/axum_extractors/thread.rs
index 4d1e1ab818..45564d539f 100644
--- a/rust/cloud-storage/entity_access/src/inbound/axum_extractors/thread.rs
+++ b/rust/cloud-storage/entity_access/src/inbound/axum_extractors/thread.rs
@@ -114,7 +114,7 @@ where
entity_type: EntityType::EmailThread,
},
auth: macro_user_id
- .map(|m| EntityAccessAuth::Authenticated(m.0))
+ .map(EntityAccessAuth::Authenticated)
.unwrap_or(EntityAccessAuth::Unauthenticated),
entity_permission: permission,
_marker: PhantomData,