Macro is a unified workspace for teams: email, chat, docs, tasks, agents, calls, and CRM — @-linked together with shared AI memory.
TypeScript agentaiai-agentsall-in-onecrmcrm-systememaillinearmcpmessagingnotesnotionofficerustslackslack-alternativestartupstartup-toolstypescriptworkspace
fix(notification): fix some deserialization (#857)
Sean Aye27b266736148
diff --git a/infra/stacks/notification-service/index.ts b/infra/stacks/notification-service/index.tsindex 27166b649e..2e6e0a6ba4 100644--- a/infra/stacks/notification-service/index.ts+++ b/infra/stacks/notification-service/index.ts@@ -184,7 +184,7 @@ const notificationService = new NotificationService('notification-service', {containerEnvVars: [{name: 'RUST_LOG',- value: `notification_service=${stack === 'prod' ? 'debug' : 'trace'},notification_db_client=${stack === 'prod' ? 'info' : 'debug'},tower_http=info`,+ value: `error,notification_service=${stack === 'prod' ? 'debug' : 'trace'},notification_db_client=${stack === 'prod' ? 'info' : 'debug'},tower_http=info`,},{name: 'ENVIRONMENT',diff --git a/rust/cloud-storage/model_notifications/src/lib.rs b/rust/cloud-storage/model_notifications/src/lib.rsindex c7eaafddc2..e2365fbb64 100644--- a/rust/cloud-storage/model_notifications/src/lib.rs+++ b/rust/cloud-storage/model_notifications/src/lib.rs@@ -79,6 +79,7 @@ impl NotificationEvent {}}+ #[tracing::instrument(err)]pub fn try_from_type_and_meta(event_type: NotificationEventType,metadata: Option<serde_json::Value>,diff --git a/rust/cloud-storage/model_notifications/src/metadata.rs b/rust/cloud-storage/model_notifications/src/metadata.rsindex 4f833c9e2e..317284ff4f 100644--- a/rust/cloud-storage/model_notifications/src/metadata.rs+++ b/rust/cloud-storage/model_notifications/src/metadata.rs@@ -7,11 +7,15 @@ use utoipa::ToSchema;#[derive(Debug, Clone, Copy, ToSchema, Doppleganger, Serialize, Deserialize)]#[dg(backward = models_comms::channel::ChannelType)]-#[serde(rename_all = "snake_case")]+#[serde(rename_all = "camelCase")]pub enum ChannelType {+ #[serde(alias = "Public", alias = "public")]Public,+ #[serde(alias = "Organization", alias = "organization")]Organization,+ #[serde(alias = "Private", alias = "private")]Private,+ #[serde(alias = "DirectMessage", alias = "direct_message")]DirectMessage,}diff --git a/rust/cloud-storage/model_notifications/src/raw.rs b/rust/cloud-storage/model_notifications/src/raw.rsindex 9f40a059b6..d7dd84dbe7 100644--- a/rust/cloud-storage/model_notifications/src/raw.rs+++ b/rust/cloud-storage/model_notifications/src/raw.rs@@ -102,6 +102,7 @@ impl TryFrom<&RawNotification> for NotificationEventType {// Account for legacy notification event typesimpl TryFrom<&RawUserNotification> for NotificationEventType {type Error = anyhow::Error;+ #[tracing::instrument(err)]fn try_from(raw: &RawUserNotification) -> Result<Self, Self::Error> {if raw.notification_event_type == "mention" {match &raw.entity.entity_type {@@ -172,6 +173,7 @@ impl TryFrom<RawNotification> for Notification {impl TryFrom<RawUserNotification> for UserNotification {type Error = anyhow::Error;+ #[tracing::instrument(err)]fn try_from(raw: RawUserNotification) -> Result<Self, Self::Error> {let event_type = NotificationEventType::try_from(&raw).context(format!("Failed to parse notification event type {:?}",@@ -179,8 +181,7 @@ impl TryFrom<RawUserNotification> for UserNotification {))?;let notification_event =- NotificationEvent::try_from_type_and_meta(event_type, raw.notification_metadata)- .context("Failed to parse notification event ")?;+ NotificationEvent::try_from_type_and_meta(event_type, raw.notification_metadata)?;Ok(UserNotification {id: raw.notification_id,