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.

chore(email-service): Remove email_attachments_macro table (#1128)

Evan Hutnik19a95c95944e
diff --git a/js/app/packages/block-email/component/BaseInput.tsx b/js/app/packages/block-email/component/BaseInput.tsx
index f7a04d7a39..0ab184d3b8 100644
--- a/js/app/packages/block-email/component/BaseInput.tsx
+++ b/js/app/packages/block-email/component/BaseInput.tsx
@@ -43,7 +43,6 @@ import { logger } from '@observability';
import { useEmailLinksQuery } from '@queries/email/link';
import { useSendMessageMutation } from '@queries/email/thread';
import type {
- AttachmentMacro,
MessageToSendDbId,
MessageWithBodyReplyless,
} from '@service-email/generated/schemas';
@@ -291,7 +290,6 @@ export function BaseInput(props: {
draft?: MessageWithBodyReplyless;
preloadedBody?: string;
preloadedHtml?: string;
- preloadedAttachments?: AttachmentMacro[];
sideEffectOnSend?: (newMessageId: MessageToSendDbId | null) => void;
onMarkDone?: () => void;
setShowReply?: Setter<boolean>;
diff --git a/js/app/packages/service-clients/service-cognition/generated/tools/schemas.ts b/js/app/packages/service-clients/service-cognition/generated/tools/schemas.ts
index 85cdad3d13..2d265b3df8 100644
--- a/js/app/packages/service-clients/service-cognition/generated/tools/schemas.ts
+++ b/js/app/packages/service-clients/service-cognition/generated/tools/schemas.ts
@@ -416,14 +416,6 @@ export const ApiPaginatedThreadCursor = z.object({
type: z.enum(['System', 'User']),
})
),
- macroAttachments: z.array(
- z.object({
- dbId: z.string().uuid(),
- itemId: z.string().uuid(),
- itemType: z.string(),
- messageId: z.string().uuid(),
- })
- ),
metadata: z.object({
calendar_invite: z.boolean(),
generic_sender: z.boolean(),
diff --git a/js/app/packages/service-clients/service-cognition/generated/tools/types.ts b/js/app/packages/service-clients/service-cognition/generated/tools/types.ts
index c9f6173d26..30a69dcc13 100644
--- a/js/app/packages/service-clients/service-cognition/generated/tools/types.ts
+++ b/js/app/packages/service-clients/service-cognition/generated/tools/types.ts
@@ -795,12 +795,6 @@ export interface ApiPaginatedThreadCursor {
providerLabelId: string;
type: 'System' | 'User';
}[];
- macroAttachments: {
- dbId: string;
- itemId: string;
- itemType: string;
- messageId: string;
- }[];
metadata: {
/**
* if any email contains a calendar invite
diff --git a/js/app/packages/service-clients/service-email/generated/client.ts b/js/app/packages/service-clients/service-email/generated/client.ts
index 982333a744..e669dfc1e5 100644
--- a/js/app/packages/service-clients/service-email/generated/client.ts
+++ b/js/app/packages/service-clients/service-email/generated/client.ts
@@ -1568,66 +1568,6 @@ export const patchSettings = async (
} as patchSettingsResponse;
};
-/**
- * @summary Enables inbox syncing for user.
- */
-export type enableSyncResponse201 = {
- data: EmptyResponse;
- status: 201;
-};
-
-export type enableSyncResponse400 = {
- data: ErrorResponse;
- status: 400;
-};
-
-export type enableSyncResponse401 = {
- data: ErrorResponse;
- status: 401;
-};
-
-export type enableSyncResponse500 = {
- data: ErrorResponse;
- status: 500;
-};
-
-export type enableSyncResponseSuccess = enableSyncResponse201 & {
- headers: Headers;
-};
-export type enableSyncResponseError = (
- | enableSyncResponse400
- | enableSyncResponse401
- | enableSyncResponse500
-) & {
- headers: Headers;
-};
-
-export type enableSyncResponse =
- | enableSyncResponseSuccess
- | enableSyncResponseError;
-
-export const getEnableSyncUrl = () => {
- return `/email/sync`;
-};
-
-export const enableSync = async (
- options?: RequestInit
-): Promise<enableSyncResponse> => {
- const res = await fetch(getEnableSyncUrl(), {
- ...options,
- method: 'POST',
- });
-
- const body = [204, 205, 304].includes(res.status) ? null : await res.text();
-
- const data: enableSyncResponse['data'] = body ? JSON.parse(body) : {};
- return {
- data,
- status: res.status,
- headers: res.headers,
- } as enableSyncResponse;
-};
-
/**
* @summary Disables inbox syncing for user.
*/
diff --git a/js/app/packages/service-clients/service-email/generated/schemas/apiAttachmentMacro.ts b/js/app/packages/service-clients/service-email/generated/schemas/apiAttachmentMacro.ts
deleted file mode 100644
index 429e1dafe8..0000000000
--- a/js/app/packages/service-clients/service-email/generated/schemas/apiAttachmentMacro.ts
+++ /dev/null
@@ -1,13 +0,0 @@
-/**
- * Generated by orval v7.13.0 🍺
- * Do not edit manually.
- * email_service
- * OpenAPI spec version: 0.1.0
- */
-
-export interface ApiAttachmentMacro {
- dbId: string;
- itemId: string;
- itemType: string;
- messageId: string;
-}
diff --git a/js/app/packages/service-clients/service-email/generated/schemas/apiThreadPreviewCursorAllOf.ts b/js/app/packages/service-clients/service-email/generated/schemas/apiThreadPreviewCursorAllOf.ts
index b3b6682193..28b6f558c4 100644
--- a/js/app/packages/service-clients/service-email/generated/schemas/apiThreadPreviewCursorAllOf.ts
+++ b/js/app/packages/service-clients/service-email/generated/schemas/apiThreadPreviewCursorAllOf.ts
@@ -7,7 +7,6 @@
import type { APIEmailThreadPreviewMetadata } from './aPIEmailThreadPreviewMetadata';
import type { ApiAttachment } from './apiAttachment';
-import type { ApiAttachmentMacro } from './apiAttachmentMacro';
import type { ApiContact } from './apiContact';
import type { ApiLabel } from './apiLabel';
import type { ApiThreadPreviewCursorAllOfFrecencyScore } from './apiThreadPreviewCursorAllOfFrecencyScore';
@@ -17,6 +16,5 @@ export type ApiThreadPreviewCursorAllOf = {
contacts: ApiContact[];
frecencyScore?: ApiThreadPreviewCursorAllOfFrecencyScore;
labels: ApiLabel[];
- macroAttachments: ApiAttachmentMacro[];
metadata: APIEmailThreadPreviewMetadata;
};
diff --git a/js/app/packages/service-clients/service-email/generated/schemas/attachmentMacro.ts b/js/app/packages/service-clients/service-email/generated/schemas/attachmentMacro.ts
deleted file mode 100644
index 0e6cc6afff..0000000000
--- a/js/app/packages/service-clients/service-email/generated/schemas/attachmentMacro.ts
+++ /dev/null
@@ -1,21 +0,0 @@
-/**
- * Generated by orval v7.13.0 🍺
- * Do not edit manually.
- * email_service
- * OpenAPI spec version: 0.1.0
- */
-import type { AttachmentMacroDbId } from './attachmentMacroDbId';
-import type { AttachmentMacroMessageId } from './attachmentMacroMessageId';
-
-/**
- * Attachments of a message created when sending a message/draft through Macro FE. references
-a macro item (document, canvas, etc). These don't actually get sent to the provider when
-sending a message, but we store them so we can display the pills for the Macro objects in the FE
-when displaying the message.
- */
-export interface AttachmentMacro {
- db_id?: AttachmentMacroDbId;
- item_id: string;
- item_type: string;
- message_id?: AttachmentMacroMessageId;
-}
diff --git a/js/app/packages/service-clients/service-email/generated/schemas/attachmentMacroDbId.ts b/js/app/packages/service-clients/service-email/generated/schemas/attachmentMacroDbId.ts
deleted file mode 100644
index 76368c5e82..0000000000
--- a/js/app/packages/service-clients/service-email/generated/schemas/attachmentMacroDbId.ts
+++ /dev/null
@@ -1,8 +0,0 @@
-/**
- * Generated by orval v7.13.0 🍺
- * Do not edit manually.
- * email_service
- * OpenAPI spec version: 0.1.0
- */
-
-export type AttachmentMacroDbId = string | null;
diff --git a/js/app/packages/service-clients/service-email/generated/schemas/attachmentMacroMessageId.ts b/js/app/packages/service-clients/service-email/generated/schemas/attachmentMacroMessageId.ts
deleted file mode 100644
index 7818f2e14a..0000000000
--- a/js/app/packages/service-clients/service-email/generated/schemas/attachmentMacroMessageId.ts
+++ /dev/null
@@ -1,8 +0,0 @@
-/**
- * Generated by orval v7.13.0 🍺
- * Do not edit manually.
- * email_service
- * OpenAPI spec version: 0.1.0
- */
-
-export type AttachmentMacroMessageId = string | null;
diff --git a/js/app/packages/service-clients/service-email/generated/schemas/index.ts b/js/app/packages/service-clients/service-email/generated/schemas/index.ts
index 718858d658..7c96b9bc34 100644
--- a/js/app/packages/service-clients/service-email/generated/schemas/index.ts
+++ b/js/app/packages/service-clients/service-email/generated/schemas/index.ts
@@ -18,7 +18,6 @@ export * from './aPIThreadProviderId';
export * from './apiAttachment';
export * from './apiAttachmentContentId';
export * from './apiAttachmentFilename';
-export * from './apiAttachmentMacro';
export * from './apiAttachmentMimeType';
export * from './apiAttachmentProviderAttachmentId';
export * from './apiAttachmentSizeBytes';
@@ -51,9 +50,6 @@ export * from './attachmentDataUrl';
export * from './attachmentDbId';
export * from './attachmentDraft';
export * from './attachmentFilename';
-export * from './attachmentMacro';
-export * from './attachmentMacroDbId';
-export * from './attachmentMacroMessageId';
export * from './attachmentMimeType';
export * from './attachmentProviderId';
export * from './attachmentSfsId';
@@ -136,7 +132,6 @@ export * from './messageSubject';
export * from './messageThreadDbId';
export * from './messageToSend';
export * from './messageToSendAttachments';
-export * from './messageToSendAttachmentsMacro';
export * from './messageToSendBcc';
export * from './messageToSendBodyHtml';
export * from './messageToSendBodyMacro';
diff --git a/js/app/packages/service-clients/service-email/generated/schemas/message.ts b/js/app/packages/service-clients/service-email/generated/schemas/message.ts
index 3fbdd4cbf0..144f5cfc17 100644
--- a/js/app/packages/service-clients/service-email/generated/schemas/message.ts
+++ b/js/app/packages/service-clients/service-email/generated/schemas/message.ts
@@ -6,7 +6,6 @@
*/
import type { Attachment } from './attachment';
import type { AttachmentDraft } from './attachmentDraft';
-import type { AttachmentMacro } from './attachmentMacro';
import type { ContactInfo } from './contactInfo';
import type { Label } from './label';
import type { MessageBodyHtmlSanitized } from './messageBodyHtmlSanitized';
@@ -32,7 +31,6 @@ export interface Message {
attachments: Attachment[];
/** Uploaded file attachments for the message, if it is a draft */
attachments_draft: AttachmentDraft[];
- attachments_macro: AttachmentMacro[];
bcc: ContactInfo[];
body_html_sanitized?: MessageBodyHtmlSanitized;
body_macro?: MessageBodyMacro;
diff --git a/js/app/packages/service-clients/service-email/generated/schemas/messageToSend.ts b/js/app/packages/service-clients/service-email/generated/schemas/messageToSend.ts
index ce3c58dc8a..b4db8c3c55 100644
--- a/js/app/packages/service-clients/service-email/generated/schemas/messageToSend.ts
+++ b/js/app/packages/service-clients/service-email/generated/schemas/messageToSend.ts
@@ -5,7 +5,6 @@
* OpenAPI spec version: 0.1.0
*/
import type { MessageToSendAttachments } from './messageToSendAttachments';
-import type { MessageToSendAttachmentsMacro } from './messageToSendAttachmentsMacro';
import type { MessageToSendBcc } from './messageToSendBcc';
import type { MessageToSendBodyHtml } from './messageToSendBodyHtml';
import type { MessageToSendBodyMacro } from './messageToSendBodyMacro';
@@ -22,7 +21,6 @@ import type { MessageToSendTo } from './messageToSendTo';
export interface MessageToSend {
attachments?: MessageToSendAttachments;
- attachments_macro?: MessageToSendAttachmentsMacro;
bcc?: MessageToSendBcc;
body_html?: MessageToSendBodyHtml;
body_macro?: MessageToSendBodyMacro;
diff --git a/js/app/packages/service-clients/service-email/generated/schemas/messageToSendAttachmentsMacro.ts b/js/app/packages/service-clients/service-email/generated/schemas/messageToSendAttachmentsMacro.ts
deleted file mode 100644
index 4507662920..0000000000
--- a/js/app/packages/service-clients/service-email/generated/schemas/messageToSendAttachmentsMacro.ts
+++ /dev/null
@@ -1,9 +0,0 @@
-/**
- * Generated by orval v7.13.0 🍺
- * Do not edit manually.
- * email_service
- * OpenAPI spec version: 0.1.0
- */
-import type { AttachmentMacro } from './attachmentMacro';
-
-export type MessageToSendAttachmentsMacro = AttachmentMacro[] | null;
diff --git a/js/app/packages/service-clients/service-email/generated/schemas/threadPreviewCursor.ts b/js/app/packages/service-clients/service-email/generated/schemas/threadPreviewCursor.ts
index 9665d581f4..4dcdca88f9 100644
--- a/js/app/packages/service-clients/service-email/generated/schemas/threadPreviewCursor.ts
+++ b/js/app/packages/service-clients/service-email/generated/schemas/threadPreviewCursor.ts
@@ -5,7 +5,6 @@
* OpenAPI spec version: 0.1.0
*/
import type { Attachment } from './attachment';
-import type { AttachmentMacro } from './attachmentMacro';
import type { Contact } from './contact';
import type { ThreadPreviewCursorName } from './threadPreviewCursorName';
import type { ThreadPreviewCursorProviderId } from './threadPreviewCursorProviderId';
@@ -20,7 +19,6 @@ import type { ThreadPreviewCursorViewedAt } from './threadPreviewCursorViewedAt'
*/
export interface ThreadPreviewCursor {
attachments: Attachment[];
- attachmentsMacro: AttachmentMacro[];
createdAt: number;
id: string;
inboxVisible: boolean;
diff --git a/js/app/packages/service-clients/service-email/openapi.json b/js/app/packages/service-clients/service-email/openapi.json
index 503bc82afd..035e11bd8d 100644
--- a/js/app/packages/service-clients/service-email/openapi.json
+++ b/js/app/packages/service-clients/service-email/openapi.json
@@ -1499,53 +1499,6 @@
}
},
"/email/sync": {
- "post": {
- "tags": ["Sync"],
- "summary": "Enables inbox syncing for user.",
- "operationId": "enable_sync",
- "responses": {
- "201": {
- "description": "",
- "content": {
- "application/json": {
- "schema": {
- "$ref": "#/components/schemas/EmptyResponse"
- }
- }
- }
- },
- "400": {
- "description": "",
- "content": {
- "application/json": {
- "schema": {
- "$ref": "#/components/schemas/ErrorResponse"
- }
- }
- }
- },
- "401": {
- "description": "",
- "content": {
- "application/json": {
- "schema": {
- "$ref": "#/components/schemas/ErrorResponse"
- }
- }
- }
- },
- "500": {
- "description": "",
- "content": {
- "application/json": {
- "schema": {
- "$ref": "#/components/schemas/ErrorResponse"
- }
- }
- }
- }
- }
- },
"delete": {
"tags": ["Sync"],
"summary": "Disables inbox syncing for user.",
@@ -2185,27 +2138,6 @@
}
}
},
- "ApiAttachmentMacro": {
- "type": "object",
- "required": ["dbId", "messageId", "itemId", "itemType"],
- "properties": {
- "dbId": {
- "type": "string",
- "format": "uuid"
- },
- "itemId": {
- "type": "string",
- "format": "uuid"
- },
- "itemType": {
- "type": "string"
- },
- "messageId": {
- "type": "string",
- "format": "uuid"
- }
- }
- },
"ApiContact": {
"type": "object",
"required": ["id", "linkId"],
@@ -2310,13 +2242,7 @@
},
{
"type": "object",
- "required": [
- "attachments",
- "macroAttachments",
- "contacts",
- "labels",
- "metadata"
- ],
+ "required": ["attachments", "contacts", "labels", "metadata"],
"properties": {
"attachments": {
"type": "array",
@@ -2340,12 +2266,6 @@
"$ref": "#/components/schemas/ApiLabel"
}
},
- "macroAttachments": {
- "type": "array",
- "items": {
- "$ref": "#/components/schemas/ApiAttachmentMacro"
- }
- },
"metadata": {
"$ref": "#/components/schemas/APIEmailThreadPreviewMetadata"
}
@@ -2510,28 +2430,6 @@
}
}
},
- "AttachmentMacro": {
- "type": "object",
- "description": "Attachments of a message created when sending a message/draft through Macro FE. references\na macro item (document, canvas, etc). These don't actually get sent to the provider when\nsending a message, but we store them so we can display the pills for the Macro objects in the FE\nwhen displaying the message.",
- "required": ["item_id", "item_type"],
- "properties": {
- "db_id": {
- "type": ["string", "null"],
- "format": "uuid"
- },
- "item_id": {
- "type": "string",
- "format": "uuid"
- },
- "item_type": {
- "type": "string"
- },
- "message_id": {
- "type": ["string", "null"],
- "format": "uuid"
- }
- }
- },
"AttachmentToSend": {
"type": "object",
"description": "The attachment data we need to include when sending a message to a provider.",
@@ -3036,7 +2934,6 @@
"bcc",
"labels",
"attachments",
- "attachments_macro",
"attachments_draft",
"created_at",
"updated_at"
@@ -3055,12 +2952,6 @@
},
"description": "Uploaded file attachments for the message, if it is a draft"
},
- "attachments_macro": {
- "type": "array",
- "items": {
- "$ref": "#/components/schemas/AttachmentMacro"
- }
- },
"bcc": {
"type": "array",
"items": {
@@ -3204,12 +3095,6 @@
"$ref": "#/components/schemas/AttachmentToSend"
}
},
- "attachments_macro": {
- "type": ["array", "null"],
- "items": {
- "$ref": "#/components/schemas/AttachmentMacro"
- }
- },
"bcc": {
"type": ["array", "null"],
"items": {
@@ -3523,7 +3408,6 @@
"isDraft",
"isImportant",
"attachments",
- "attachmentsMacro",
"participants",
"sortTs",
"createdAt",
@@ -3537,12 +3421,6 @@
"$ref": "#/components/schemas/Attachment"
}
},
- "attachmentsMacro": {
- "type": "array",
- "items": {
- "$ref": "#/components/schemas/AttachmentMacro"
- }
- },
"createdAt": {
"type": "integer",
"format": "int64"
diff --git a/js/app/packages/service-clients/service-storage/generated/schemas/index.ts b/js/app/packages/service-clients/service-storage/generated/schemas/index.ts
index 42411a6346..34d796f0fc 100644
--- a/js/app/packages/service-clients/service-storage/generated/schemas/index.ts
+++ b/js/app/packages/service-clients/service-storage/generated/schemas/index.ts
@@ -498,7 +498,6 @@ export * from './soupItemOneOfThreeTag';
export * from './soupLabel';
export * from './soupLabelListVisibility';
export * from './soupLabelType';
-export * from './soupMacroAttachment';
export * from './soupMessageListVisibility';
export * from './soupPage';
export * from './soupPageNextCursor';
diff --git a/js/app/packages/service-clients/service-storage/generated/schemas/soupEnrichedEmailThreadPreviewAllOf.ts b/js/app/packages/service-clients/service-storage/generated/schemas/soupEnrichedEmailThreadPreviewAllOf.ts
index b6fab11e83..b5f15b3060 100644
--- a/js/app/packages/service-clients/service-storage/generated/schemas/soupEnrichedEmailThreadPreviewAllOf.ts
+++ b/js/app/packages/service-clients/service-storage/generated/schemas/soupEnrichedEmailThreadPreviewAllOf.ts
@@ -8,12 +8,10 @@ import type { SoupAttachment } from './soupAttachment';
import type { SoupContact } from './soupContact';
import type { SoupEmailThreadPreviewMetadata } from './soupEmailThreadPreviewMetadata';
import type { SoupLabel } from './soupLabel';
-import type { SoupMacroAttachment } from './soupMacroAttachment';
import type { SoupProperty } from './soupProperty';
export type SoupEnrichedEmailThreadPreviewAllOf = {
attachments: SoupAttachment[];
- attachmentsMacro: SoupMacroAttachment[];
labels: SoupLabel[];
metadata: SoupEmailThreadPreviewMetadata;
participants: SoupContact[];
diff --git a/js/app/packages/service-clients/service-storage/generated/schemas/soupMacroAttachment.ts b/js/app/packages/service-clients/service-storage/generated/schemas/soupMacroAttachment.ts
deleted file mode 100644
index 1d8131b76d..0000000000
--- a/js/app/packages/service-clients/service-storage/generated/schemas/soupMacroAttachment.ts
+++ /dev/null
@@ -1,14 +0,0 @@
-/**
- * Generated by orval v7.13.0 🍺
- * Do not edit manually.
- * document_storage_service
- * OpenAPI spec version: 0.1.0
- */
-
-export interface SoupMacroAttachment {
- dbId: string;
- itemId: string;
- itemType: string;
- messageId: string;
- threadId: string;
-}
diff --git a/js/app/packages/service-clients/service-storage/generated/zod.ts b/js/app/packages/service-clients/service-storage/generated/zod.ts
index a5ca4c5d7c..f33218e772 100644
--- a/js/app/packages/service-clients/service-storage/generated/zod.ts
+++ b/js/app/packages/service-clients/service-storage/generated/zod.ts
@@ -3139,15 +3139,6 @@ export const getItemsSoupResponse = zod.object({
sizeBytes: zod.number().nullish(),
})
),
- attachmentsMacro: zod.array(
- zod.object({
- dbId: zod.string().uuid(),
- itemId: zod.string().uuid(),
- itemType: zod.string(),
- messageId: zod.string().uuid(),
- threadId: zod.string().uuid(),
- })
- ),
labels: zod.array(
zod.object({
createdAt: zod.string().datetime({}),
@@ -4525,15 +4516,6 @@ export const postItemsSoupResponse = zod.object({
sizeBytes: zod.number().nullish(),
})
),
- attachmentsMacro: zod.array(
- zod.object({
- dbId: zod.string().uuid(),
- itemId: zod.string().uuid(),
- itemType: zod.string(),
- messageId: zod.string().uuid(),
- threadId: zod.string().uuid(),
- })
- ),
labels: zod.array(
zod.object({
createdAt: zod.string().datetime({}),
diff --git a/js/app/packages/service-clients/service-storage/openapi.json b/js/app/packages/service-clients/service-storage/openapi.json
index e8afecdf85..865f48786e 100644
--- a/js/app/packages/service-clients/service-storage/openapi.json
+++ b/js/app/packages/service-clients/service-storage/openapi.json
@@ -8604,7 +8604,6 @@
"type": "object",
"required": [
"attachments",
- "attachmentsMacro",
"participants",
"metadata",
"labels",
@@ -8617,12 +8616,6 @@
"$ref": "#/components/schemas/SoupAttachment"
}
},
- "attachmentsMacro": {
- "type": "array",
- "items": {
- "$ref": "#/components/schemas/SoupMacroAttachment"
- }
- },
"labels": {
"type": "array",
"items": {
@@ -8767,31 +8760,6 @@
"type": "string",
"enum": ["system", "user"]
},
- "SoupMacroAttachment": {
- "type": "object",
- "required": ["threadId", "dbId", "messageId", "itemId", "itemType"],
- "properties": {
- "dbId": {
- "type": "string",
- "format": "uuid"
- },
- "itemId": {
- "type": "string",
- "format": "uuid"
- },
- "itemType": {
- "type": "string"
- },
- "messageId": {
- "type": "string",
- "format": "uuid"
- },
- "threadId": {
- "type": "string",
- "format": "uuid"
- }
- }
- },
"SoupMessageListVisibility": {
"type": "string",
"enum": ["show", "hide"]
diff --git a/rust/cloud-storage/document_storage_service/src/api/swagger.rs b/rust/cloud-storage/document_storage_service/src/api/swagger.rs
index fd25573698..e86ca46165 100644
--- a/rust/cloud-storage/document_storage_service/src/api/swagger.rs
+++ b/rust/cloud-storage/document_storage_service/src/api/swagger.rs
@@ -105,7 +105,7 @@ use models_soup::document::SoupDocument;
use models_soup::email_thread::{
SoupAttachment, SoupContact, SoupEmailThreadPreview, SoupEmailThreadPreviewMetadata,
SoupEnrichedEmailThreadPreview, SoupLabel, SoupLabelListVisibility, SoupLabelType,
- SoupMacroAttachment, SoupMessageListVisibility,
+ SoupMessageListVisibility,
};
use models_soup::item::SoupItem;
use models_soup::project::SoupProject;
@@ -290,7 +290,6 @@ use utoipa::OpenApi;
SoupEnrichedEmailThreadPreview,
SoupEmailThreadPreview,
SoupAttachment,
- SoupMacroAttachment,
SoupContact,
SoupEmailThreadPreviewMetadata,
SoupLabel,
diff --git a/rust/cloud-storage/email/.sqlx/query-438ae6729b0b27fe7928b261fbf8a81d12562122d1824650497938280c3a2282.json b/rust/cloud-storage/email/.sqlx/query-438ae6729b0b27fe7928b261fbf8a81d12562122d1824650497938280c3a2282.json
deleted file mode 100644
index 2267b9d7a2..0000000000
--- a/rust/cloud-storage/email/.sqlx/query-438ae6729b0b27fe7928b261fbf8a81d12562122d1824650497938280c3a2282.json
+++ /dev/null
@@ -1,52 +0,0 @@
-{
- "db_name": "PostgreSQL",
- "query": "\n SELECT\n a.id,\n a.message_id,\n a.item_id as \"item_id!\",\n a.item_type as \"item_type!\",\n a.created_at,\n m.thread_id\n FROM\n email_attachments_macro a\n JOIN\n email_messages m ON a.message_id = m.id\n WHERE\n m.thread_id = ANY($1)\n ORDER BY\n a.created_at ASC\n ",
- "describe": {
- "columns": [
- {
- "ordinal": 0,
- "name": "id",
- "type_info": "Uuid"
- },
- {
- "ordinal": 1,
- "name": "message_id",
- "type_info": "Uuid"
- },
- {
- "ordinal": 2,
- "name": "item_id!",
- "type_info": "Uuid"
- },
- {
- "ordinal": 3,
- "name": "item_type!",
- "type_info": "Varchar"
- },
- {
- "ordinal": 4,
- "name": "created_at",
- "type_info": "Timestamptz"
- },
- {
- "ordinal": 5,
- "name": "thread_id",
- "type_info": "Uuid"
- }
- ],
- "parameters": {
- "Left": [
- "UuidArray"
- ]
- },
- "nullable": [
- false,
- false,
- false,
- false,
- false,
- false
- ]
- },
- "hash": "438ae6729b0b27fe7928b261fbf8a81d12562122d1824650497938280c3a2282"
-}
diff --git a/rust/cloud-storage/email/src/domain/models.rs b/rust/cloud-storage/email/src/domain/models.rs
index 559123144b..99e7cecd64 100644
--- a/rust/cloud-storage/email/src/domain/models.rs
+++ b/rust/cloud-storage/email/src/domain/models.rs
@@ -93,7 +93,6 @@ pub struct EmailThreadPreview {
pub struct EnrichedEmailThreadPreview {
pub thread: EmailThreadPreview,
pub attachments: Vec<Attachment>,
- pub attachments_macro: Vec<AttachmentMacro>,
pub labels: Vec<Label>,
pub metadata: EmailThreadPreviewMetadata,
pub frecency_score: Option<AggregateFrecency>,
@@ -167,28 +166,6 @@ impl Identify for Attachment {
}
}
-/// Attachments of a message created when sending a message/draft through Macro FE. references
-/// a macro item (document, canvas, etc). These don't actually get sent to the provider when
-/// sending a message, but we store them so we can display the pills for the Macro objects in the FE
-/// when displaying the message.
-#[derive(Debug, Clone)]
-#[non_exhaustive]
-pub struct AttachmentMacro {
- pub thread_id: Uuid,
- pub db_id: Uuid,
- pub message_id: Uuid,
- pub item_id: Uuid,
- pub item_type: String,
-}
-
-impl Identify for AttachmentMacro {
- type Id = Uuid;
-
- fn id(&self) -> Self::Id {
- self.thread_id
- }
-}
-
#[derive(Debug, Clone)]
#[non_exhaustive]
pub struct Contact {
diff --git a/rust/cloud-storage/email/src/domain/ports.rs b/rust/cloud-storage/email/src/domain/ports.rs
index cfd8cee613..47331be22b 100644
--- a/rust/cloud-storage/email/src/domain/ports.rs
+++ b/rust/cloud-storage/email/src/domain/ports.rs
@@ -1,5 +1,5 @@
use crate::domain::models::{
- Attachment, AttachmentMacro, Contact, EmailErr, EmailThreadPreview, EnrichedEmailThreadPreview,
+ Attachment, Contact, EmailErr, EmailThreadPreview, EnrichedEmailThreadPreview,
GetEmailsRequest, IntermediateThreadMetadata, Label, Link, PreviewCursorQuery, UserProvider,
};
use macro_user_id::user_id::MacroUserIdStr;
@@ -19,11 +19,6 @@ pub trait EmailRepo: Send + Sync + 'static {
thread_ids: &[Uuid],
) -> impl Future<Output = Result<Vec<Attachment>, Self::Err>> + Send;
- fn macro_attachments_by_thread_ids(
- &self,
- thread_ids: &[Uuid],
- ) -> impl Future<Output = Result<Vec<AttachmentMacro>, Self::Err>> + Send;
-
fn contacts_by_thread_ids(
&self,
thread_ids: &[Uuid],
diff --git a/rust/cloud-storage/email/src/domain/service.rs b/rust/cloud-storage/email/src/domain/service.rs
index 9683dbe8b2..b72af67936 100644
--- a/rust/cloud-storage/email/src/domain/service.rs
+++ b/rust/cloud-storage/email/src/domain/service.rs
@@ -87,14 +87,12 @@ where
let (
attachment_map_result,
- macro_attachment_map_result,
participant_result,
labels_result,
metadata_result,
frecency_scores,
) = tokio::join!(
self.email_repo.attachments_by_thread_ids(&thread_ids),
- self.email_repo.macro_attachments_by_thread_ids(&thread_ids),
self.email_repo.contacts_by_thread_ids(&thread_ids),
self.email_repo.labels_by_thread_ids(&thread_ids),
self.get_preview_metadata(&previews, &link_id),
@@ -106,10 +104,6 @@ where
.map_err(anyhow::Error::from)?
.into_iter()
.group_by(|v| v.thread_id);
- let mut macro_attachment_map = macro_attachment_map_result
- .map_err(anyhow::Error::from)?
- .into_iter()
- .group_by(|v| v.thread_id);
let mut participant_map = participant_result
.map_err(anyhow::Error::from)?
.into_iter()
@@ -133,7 +127,6 @@ where
EnrichedEmailThreadPreview {
attachments: attachment_map.remove(&thread.id).unwrap_or_default(),
- attachments_macro: macro_attachment_map.remove(&thread.id).unwrap_or_default(),
labels: labels_map.remove(&thread.id).unwrap_or_default(),
participants: participant_map.remove(&thread.id).unwrap_or_default(),
metadata: metadata_map.remove(&thread.id).unwrap_or_default(),
diff --git a/rust/cloud-storage/email/src/inbound/axum/api_types.rs b/rust/cloud-storage/email/src/inbound/axum/api_types.rs
index 65ab8bd250..0491339890 100644
--- a/rust/cloud-storage/email/src/inbound/axum/api_types.rs
+++ b/rust/cloud-storage/email/src/inbound/axum/api_types.rs
@@ -8,7 +8,7 @@ use utoipa::ToSchema;
use uuid::Uuid;
use crate::domain::models::{
- Attachment, AttachmentMacro, Contact, EmailThreadPreview, EmailThreadPreviewMetadata,
+ Attachment, Contact, EmailThreadPreview, EmailThreadPreviewMetadata,
EnrichedEmailThreadPreview, Label, LabelListVisibility, LabelType, MessageListVisibility,
};
@@ -45,8 +45,6 @@ struct ApiThreadPreviewCursor {
#[serde(flatten)]
thread: ApiThreadPreviewCursorInner,
attachments: Vec<ApiAttachment>,
- #[dg(rename = "attachments_macro")]
- macro_attachments: Vec<ApiAttachmentMacro>,
#[dg(rename = "participants")]
contacts: Vec<ApiContact>,
labels: Vec<ApiLabel>,
@@ -118,17 +116,6 @@ pub struct ApiAttachment {
created_at: DateTime<Utc>,
}
-#[derive(Debug, ToSchema, Serialize, Deserialize, Doppleganger)]
-#[cfg_attr(feature = "ai_schema", derive(schemars::JsonSchema))]
-#[serde(rename_all = "camelCase")]
-#[dg(backward = AttachmentMacro)]
-pub struct ApiAttachmentMacro {
- db_id: Uuid,
- message_id: Uuid,
- item_id: Uuid,
- item_type: String,
-}
-
#[derive(Debug, ToSchema, Serialize, Deserialize, Doppleganger)]
#[cfg_attr(feature = "ai_schema", derive(schemars::JsonSchema))]
#[serde(rename_all = "camelCase")]
diff --git a/rust/cloud-storage/email/src/outbound/email_pg_repo.rs b/rust/cloud-storage/email/src/outbound/email_pg_repo.rs
index a0b1946c09..cb946d226c 100644
--- a/rust/cloud-storage/email/src/outbound/email_pg_repo.rs
+++ b/rust/cloud-storage/email/src/outbound/email_pg_repo.rs
@@ -1,8 +1,8 @@
use crate::domain::models::{IntermediateThreadMetadata, Label};
use crate::domain::{
models::{
- Attachment, AttachmentMacro, Contact, EmailThreadPreview, Link, PreviewCursorQuery,
- PreviewView, PreviewViewStandardLabel, UserProvider,
+ Attachment, Contact, EmailThreadPreview, Link, PreviewCursorQuery, PreviewView,
+ PreviewViewStandardLabel, UserProvider,
},
ports::EmailRepo,
};
@@ -146,40 +146,6 @@ impl EmailRepo for EmailPgRepo {
.collect())
}
- async fn macro_attachments_by_thread_ids(
- &self,
- thread_ids: &[Uuid],
- ) -> Result<Vec<AttachmentMacro>, Self::Err> {
- // Query all attachments for email_messages in the provided threads
- // Include thread_id in the result set
- Ok(sqlx::query_as!(
- AttachmentMacroDbRow,
- r#"
- SELECT
- a.id,
- a.message_id,
- a.item_id as "item_id!",
- a.item_type as "item_type!",
- a.created_at,
- m.thread_id
- FROM
- email_attachments_macro a
- JOIN
- email_messages m ON a.message_id = m.id
- WHERE
- m.thread_id = ANY($1)
- ORDER BY
- a.created_at ASC
- "#,
- thread_ids
- )
- .fetch_all(&self.pool)
- .await?
- .into_iter()
- .map(AttachmentMacroDbRow::mirror)
- .collect())
- }
-
async fn contacts_by_thread_ids(&self, thread_ids: &[Uuid]) -> Result<Vec<Contact>, Self::Err> {
// Define a struct to hold the joined results
#[derive(Debug, Doppleganger)]
diff --git a/rust/cloud-storage/email/src/outbound/email_pg_repo/db_types.rs b/rust/cloud-storage/email/src/outbound/email_pg_repo/db_types.rs
index 95f4ea0e71..b922b36e5e 100644
--- a/rust/cloud-storage/email/src/outbound/email_pg_repo/db_types.rs
+++ b/rust/cloud-storage/email/src/outbound/email_pg_repo/db_types.rs
@@ -1,6 +1,6 @@
use crate::domain::models::{
- Attachment, AttachmentMacro, EmailThreadPreview, IntermediateThreadMetadata, Label,
- LabelListVisibility, LabelType, Link, MessageListVisibility,
+ Attachment, EmailThreadPreview, IntermediateThreadMetadata, Label, LabelListVisibility,
+ LabelType, Link, MessageListVisibility,
};
use chrono::{DateTime, Utc};
use doppleganger::{Doppleganger, Mirror};
@@ -8,23 +8,6 @@ use macro_user_id::{cowlike::CowLike, email::EmailStr, user_id::MacroUserIdStr};
use sqlx::Type;
use uuid::Uuid;
-#[derive(Doppleganger)]
-#[dg(forward = AttachmentMacro)]
-pub struct AttachmentMacroDbRow {
- #[dg(rename = "db_id")]
- pub id: Uuid,
- pub message_id: Uuid,
- pub item_id: Uuid,
- pub item_type: String,
- #[expect(
- dead_code,
- reason = "We need this field to use query_as with the current query, but we never read it"
- )]
- #[dg(ignore)]
- pub(crate) created_at: DateTime<Utc>,
- pub thread_id: Uuid,
-}
-
#[derive(Doppleganger)]
#[dg(forward = Attachment)]
pub struct AttachmentDbRow {
diff --git a/rust/cloud-storage/email_db_client/.sqlx/query-2515dc95b5ed56dbd15a922b7d8409b55a6cd11d3410af24ad3bc717712513e3.json b/rust/cloud-storage/email_db_client/.sqlx/query-2515dc95b5ed56dbd15a922b7d8409b55a6cd11d3410af24ad3bc717712513e3.json
deleted file mode 100644
index 6f93f89bcc..0000000000
--- a/rust/cloud-storage/email_db_client/.sqlx/query-2515dc95b5ed56dbd15a922b7d8409b55a6cd11d3410af24ad3bc717712513e3.json
+++ /dev/null
@@ -1,14 +0,0 @@
-{
- "db_name": "PostgreSQL",
- "query": "\n DELETE FROM email_attachments_macro\n WHERE id = ANY($1::uuid[])\n ",
- "describe": {
- "columns": [],
- "parameters": {
- "Left": [
- "UuidArray"
- ]
- },
- "nullable": []
- },
- "hash": "2515dc95b5ed56dbd15a922b7d8409b55a6cd11d3410af24ad3bc717712513e3"
-}
diff --git a/rust/cloud-storage/email_db_client/.sqlx/query-438ae6729b0b27fe7928b261fbf8a81d12562122d1824650497938280c3a2282.json b/rust/cloud-storage/email_db_client/.sqlx/query-438ae6729b0b27fe7928b261fbf8a81d12562122d1824650497938280c3a2282.json
deleted file mode 100644
index 2267b9d7a2..0000000000
--- a/rust/cloud-storage/email_db_client/.sqlx/query-438ae6729b0b27fe7928b261fbf8a81d12562122d1824650497938280c3a2282.json
+++ /dev/null
@@ -1,52 +0,0 @@
-{
- "db_name": "PostgreSQL",
- "query": "\n SELECT\n a.id,\n a.message_id,\n a.item_id as \"item_id!\",\n a.item_type as \"item_type!\",\n a.created_at,\n m.thread_id\n FROM\n email_attachments_macro a\n JOIN\n email_messages m ON a.message_id = m.id\n WHERE\n m.thread_id = ANY($1)\n ORDER BY\n a.created_at ASC\n ",
- "describe": {
- "columns": [
- {
- "ordinal": 0,
- "name": "id",
- "type_info": "Uuid"
- },
- {
- "ordinal": 1,
- "name": "message_id",
- "type_info": "Uuid"
- },
- {
- "ordinal": 2,
- "name": "item_id!",
- "type_info": "Uuid"
- },
- {
- "ordinal": 3,
- "name": "item_type!",
- "type_info": "Varchar"
- },
- {
- "ordinal": 4,
- "name": "created_at",
- "type_info": "Timestamptz"
- },
- {
- "ordinal": 5,
- "name": "thread_id",
- "type_info": "Uuid"
- }
- ],
- "parameters": {
- "Left": [
- "UuidArray"
- ]
- },
- "nullable": [
- false,
- false,
- false,
- false,
- false,
- false
- ]
- },
- "hash": "438ae6729b0b27fe7928b261fbf8a81d12562122d1824650497938280c3a2282"
-}
diff --git a/rust/cloud-storage/email_db_client/.sqlx/query-56f5778dd2059294d47ce9ed5958ec684fda14099c3b62d3c399b33e939a883b.json b/rust/cloud-storage/email_db_client/.sqlx/query-56f5778dd2059294d47ce9ed5958ec684fda14099c3b62d3c399b33e939a883b.json
deleted file mode 100644
index 23a605a921..0000000000
--- a/rust/cloud-storage/email_db_client/.sqlx/query-56f5778dd2059294d47ce9ed5958ec684fda14099c3b62d3c399b33e939a883b.json
+++ /dev/null
@@ -1,46 +0,0 @@
-{
- "db_name": "PostgreSQL",
- "query": "\n SELECT id, message_id, item_id, item_type, created_at\n FROM email_attachments_macro\n WHERE message_id = ANY($1)\n ORDER BY message_id, id DESC\n ",
- "describe": {
- "columns": [
- {
- "ordinal": 0,
- "name": "id",
- "type_info": "Uuid"
- },
- {
- "ordinal": 1,
- "name": "message_id",
- "type_info": "Uuid"
- },
- {
- "ordinal": 2,
- "name": "item_id",
- "type_info": "Uuid"
- },
- {
- "ordinal": 3,
- "name": "item_type",
- "type_info": "Varchar"
- },
- {
- "ordinal": 4,
- "name": "created_at",
- "type_info": "Timestamptz"
- }
- ],
- "parameters": {
- "Left": [
- "UuidArray"
- ]
- },
- "nullable": [
- false,
- false,
- false,
- false,
- false
- ]
- },
- "hash": "56f5778dd2059294d47ce9ed5958ec684fda14099c3b62d3c399b33e939a883b"
-}
diff --git a/rust/cloud-storage/email_db_client/.sqlx/query-86f0acbac1de04db70b83978e1a0df5761aec12cc7a3cdfadf177429cd2133be.json b/rust/cloud-storage/email_db_client/.sqlx/query-86f0acbac1de04db70b83978e1a0df5761aec12cc7a3cdfadf177429cd2133be.json
deleted file mode 100644
index fbb702e303..0000000000
--- a/rust/cloud-storage/email_db_client/.sqlx/query-86f0acbac1de04db70b83978e1a0df5761aec12cc7a3cdfadf177429cd2133be.json
+++ /dev/null
@@ -1,46 +0,0 @@
-{
- "db_name": "PostgreSQL",
- "query": "\n SELECT id, message_id, item_id, item_type, created_at\n FROM email_attachments_macro\n WHERE message_id = $1\n ",
- "describe": {
- "columns": [
- {
- "ordinal": 0,
- "name": "id",
- "type_info": "Uuid"
- },
- {
- "ordinal": 1,
- "name": "message_id",
- "type_info": "Uuid"
- },
- {
- "ordinal": 2,
- "name": "item_id",
- "type_info": "Uuid"
- },
- {
- "ordinal": 3,
- "name": "item_type",
- "type_info": "Varchar"
- },
- {
- "ordinal": 4,
- "name": "created_at",
- "type_info": "Timestamptz"
- }
- ],
- "parameters": {
- "Left": [
- "Uuid"
- ]
- },
- "nullable": [
- false,
- false,
- false,
- false,
- false
- ]
- },
- "hash": "86f0acbac1de04db70b83978e1a0df5761aec12cc7a3cdfadf177429cd2133be"
-}
diff --git a/rust/cloud-storage/email_db_client/fixtures/fetch_db_macro_attachments_in_bulk.sql b/rust/cloud-storage/email_db_client/fixtures/fetch_db_macro_attachments_in_bulk.sql
deleted file mode 100644
index cd8c7e647a..0000000000
--- a/rust/cloud-storage/email_db_client/fixtures/fetch_db_macro_attachments_in_bulk.sql
+++ /dev/null
@@ -1,98 +0,0 @@
--- SQL fixture for fetch_db_macro_attachments_in_bulk tests
--- Tests fetching macro attachments for multiple message IDs in a single query
-
-------------------------------------------------------------
--- User Link
-------------------------------------------------------------
-
-INSERT INTO email_links (id, macro_id, fusionauth_user_id, email_address, provider, is_sync_active, created_at, updated_at)
-VALUES ('00000000-0000-0000-0000-000000000c01', 'macro|[email protected]', '00000000-0000-0000-0000-000000000c01',
- '[email protected]', 'GMAIL', true, NOW(), NOW());
-
-------------------------------------------------------------
--- Contact
-------------------------------------------------------------
-
-INSERT INTO email_contacts (id, link_id, email_address, created_at, updated_at)
-VALUES ('00000000-0000-0000-0000-0000000cc001',
- '00000000-0000-0000-0000-000000000c01',
- NOW(), NOW());
-
-------------------------------------------------------------
--- Thread
-------------------------------------------------------------
-
-INSERT INTO email_threads (id, link_id, inbox_visible, is_read, created_at, updated_at)
-VALUES ('00000000-0000-0000-0000-00000000c201',
- '00000000-0000-0000-0000-000000000c01',
- true, false, NOW(), NOW());
-
-------------------------------------------------------------
--- Message 1: Has multiple macro attachments
-------------------------------------------------------------
-
-INSERT INTO email_messages (id, thread_id, link_id, provider_id, is_sent, from_contact_id, internal_date_ts,
- has_attachments, is_read, is_starred, is_draft, created_at, updated_at)
-VALUES ('00000000-0000-0000-0000-00000000c501',
- '00000000-0000-0000-0000-00000000c201',
- '00000000-0000-0000-0000-000000000c01',
- 'provider-msg-c501',
- FALSE,
- '00000000-0000-0000-0000-0000000cc001',
- '2025-01-05 10:00:00 +00:00',
- true, false, false, false, NOW(), NOW());
-
--- Message 1 Macro Attachment 1: Document
-INSERT INTO email_attachments_macro (id, message_id, item_id, item_type, created_at)
-VALUES ('00000000-0000-0000-0000-0000000ca001',
- '00000000-0000-0000-0000-00000000c501',
- '00000000-0000-0000-0000-000000001001',
- 'document',
- NOW());
-
--- Message 1 Macro Attachment 2: Image
-INSERT INTO email_attachments_macro (id, message_id, item_id, item_type, created_at)
-VALUES ('00000000-0000-0000-0000-0000000ca002',
- '00000000-0000-0000-0000-00000000c501',
- '00000000-0000-0000-0000-000000001002',
- 'image',
- NOW());
-
-------------------------------------------------------------
--- Message 2: Has one macro attachment
-------------------------------------------------------------
-
-INSERT INTO email_messages (id, thread_id, link_id, provider_id, is_sent, from_contact_id, internal_date_ts,
- has_attachments, is_read, is_starred, is_draft, created_at, updated_at)
-VALUES ('00000000-0000-0000-0000-00000000c502',
- '00000000-0000-0000-0000-00000000c201',
- '00000000-0000-0000-0000-000000000c01',
- 'provider-msg-c502',
- FALSE,
- '00000000-0000-0000-0000-0000000cc001',
- '2025-01-05 11:00:00 +00:00',
- true, false, false, false, NOW(), NOW());
-
--- Message 2 Macro Attachment 1: Video
-INSERT INTO email_attachments_macro (id, message_id, item_id, item_type, created_at)
-VALUES ('00000000-0000-0000-0000-0000000ca003',
- '00000000-0000-0000-0000-00000000c502',
- '00000000-0000-0000-0000-000000001003',
- 'video',
- NOW());
-
-------------------------------------------------------------
--- Message 3: No macro attachments
-------------------------------------------------------------
-
-INSERT INTO email_messages (id, thread_id, link_id, provider_id, is_sent, from_contact_id, internal_date_ts,
- has_attachments, is_read, is_starred, is_draft, created_at, updated_at)
-VALUES ('00000000-0000-0000-0000-00000000c503',
- '00000000-0000-0000-0000-00000000c201',
- '00000000-0000-0000-0000-000000000c01',
- 'provider-msg-c503',
- FALSE,
- '00000000-0000-0000-0000-0000000cc001',
- '2025-01-05 12:00:00 +00:00',
- false, false, false, false, NOW(), NOW());
diff --git a/rust/cloud-storage/email_db_client/src/attachments/marco/mod.rs b/rust/cloud-storage/email_db_client/src/attachments/marco/mod.rs
deleted file mode 100644
index e3fea069b3..0000000000
--- a/rust/cloud-storage/email_db_client/src/attachments/marco/mod.rs
+++ /dev/null
@@ -1,235 +0,0 @@
-#[cfg(test)]
-mod test;
-
-use crate::parse::db_to_service::map_db_macro_attachment_to_service;
-use crate::parse::service_to_db::map_service_macro_attachments_to_db;
-use anyhow::Context;
-use models_email::db::attachment;
-use models_email::{db, service};
-use sqlx::types::Uuid;
-use sqlx::{PgPool, Pool, Postgres};
-use std::collections::HashMap;
-
-/// inserts the metadata for attachments of an email into the database in a batch
-#[tracing::instrument(skip(tx, attachments, message_id), err)]
-pub async fn insert_macro_attachments(
- tx: &mut sqlx::PgConnection,
- message_id: Uuid,
- attachments: &mut [service::attachment::AttachmentMacro],
-) -> anyhow::Result<()> {
- if attachments.is_empty() {
- return Ok(());
- }
-
- let db_attachments = map_service_macro_attachments_to_db(attachments, message_id);
-
- let existing_attachments = sqlx::query_as!(
- db::attachment::AttachmentMacro,
- r#"
- SELECT id, message_id, item_id, item_type, created_at
- FROM email_attachments_macro
- WHERE message_id = $1
- "#,
- message_id
- )
- .fetch_all(&mut *tx)
- .await
- .with_context(|| {
- format!(
- "Failed to fetch macro attachments for message_id {}",
- message_id
- )
- })?;
-
- // Filter to find attachments that exist in the database but don't match any in db_attachments
-
- let orphaned_attachments: Vec<_> = existing_attachments
- .iter()
- .filter(|existing| {
- !db_attachments.iter().any(|attachment| {
- existing.item_id == attachment.item_id && existing.item_type == attachment.item_type
- })
- })
- .cloned()
- .collect();
-
- // Only insert attachments from db_attachments that don't match any in the database
- let new_attachments: Vec<_> = db_attachments
- .into_iter()
- .filter(|attachment| {
- !existing_attachments.iter().any(|existing| {
- existing.item_id == attachment.item_id && existing.item_type == attachment.item_type
- })
- })
- .collect();
-
- // delete orphaned attachments
- if !orphaned_attachments.is_empty() {
- let orphaned_ids: Vec<Uuid> = orphaned_attachments
- .iter()
- .map(|orphan| orphan.id)
- .collect();
- sqlx::query!(
- r#"
- DELETE FROM email_attachments_macro
- WHERE id = ANY($1::uuid[])
- "#,
- &orphaned_ids
- )
- .execute(&mut *tx)
- .await
- .with_context(|| {
- format!(
- "Failed to delete orphaned macro attachments with ids {:?} for message_id {}",
- orphaned_ids, message_id
- )
- })?;
- }
-
- if new_attachments.is_empty() {
- return Ok(());
- }
-
- let n = new_attachments.len();
- let mut attachment_ids_repeated: Vec<Uuid> = Vec::with_capacity(n);
- let mut message_ids_repeated: Vec<Uuid> = Vec::with_capacity(n);
- let mut item_ids: Vec<Uuid> = Vec::with_capacity(n);
- let mut item_types: Vec<String> = Vec::with_capacity(n);
-
- for attachment in new_attachments.into_iter() {
- attachment_ids_repeated.push(attachment.id);
- message_ids_repeated.push(attachment.message_id);
- item_ids.push(attachment.item_id);
- item_types.push(attachment.item_type);
- }
-
- // Use query() for unnest as query! has trouble inferring all Option types
- sqlx::query(
- r#"
- WITH input_rows (
- id, message_id, item_id, item_type
- ) AS (
- SELECT * FROM unnest(
- $1::uuid[], $2::uuid[], $3::uuid[], $4::varchar[]
- )
- )
- INSERT INTO email_attachments_macro (
- id, message_id, item_id, item_type
- )
- SELECT id, message_id, item_id, item_type
- FROM input_rows
- ON CONFLICT (message_id, item_id, item_type)
- DO NOTHING
- "#,
- )
- .bind(&attachment_ids_repeated)
- .bind(&message_ids_repeated)
- .bind(&item_ids)
- .bind(&item_types)
- .execute(&mut *tx)
- .await
- .with_context(|| {
- format!(
- "Failed to batch insert/update macro attachment metadata for message_id {} and item {:?}",
- message_id, item_ids
- )
- })?;
-
- Ok(())
-}
-
-/// Fetches macro attachments for multiple messages and returns a map keyed by message_id
-#[tracing::instrument(skip(pool), err)]
-pub async fn fetch_db_macro_attachments_in_bulk(
- pool: &PgPool,
- message_ids: &[Uuid],
-) -> anyhow::Result<HashMap<Uuid, Vec<attachment::AttachmentMacro>>> {
- if message_ids.is_empty() {
- return Ok(HashMap::new());
- }
-
- let results = sqlx::query_as!(
- db::attachment::AttachmentMacro,
- r#"
- SELECT id, message_id, item_id, item_type, created_at
- FROM email_attachments_macro
- WHERE message_id = ANY($1)
- ORDER BY message_id, id DESC
- "#,
- message_ids
- )
- .fetch_all(pool)
- .await
- .context("Failed to fetch macro attachments in bulk")?;
-
- let mut attachments_map: HashMap<Uuid, Vec<attachment::AttachmentMacro>> = HashMap::new();
- for attachment in results {
- attachments_map
- .entry(attachment.message_id)
- .or_default()
- .push(attachment);
- }
-
- Ok(attachments_map)
-}
-
-#[tracing::instrument(skip(db), err)]
-pub async fn get_macro_attachments_by_thread_ids(
- db: &Pool<Postgres>,
- thread_ids: &[Uuid],
-) -> anyhow::Result<HashMap<Uuid, Vec<service::attachment::AttachmentMacro>>> {
- if thread_ids.is_empty() {
- return Ok(HashMap::new());
- }
-
- // Query all attachments for email_messages in the provided threads
- // Include thread_id in the result set
- let attachments = sqlx::query!(
- r#"
- SELECT
- a.id,
- a.message_id,
- a.item_id as "item_id!",
- a.item_type as "item_type!",
- a.created_at,
- m.thread_id
- FROM
- email_attachments_macro a
- JOIN
- email_messages m ON a.message_id = m.id
- WHERE
- m.thread_id = ANY($1)
- ORDER BY
- a.created_at ASC
- "#,
- thread_ids
- )
- .fetch_all(db)
- .await
- .context("Failed to fetch macro attachments for threads")?;
-
- // Group attachments by thread_id
- let mut result: HashMap<Uuid, Vec<service::attachment::AttachmentMacro>> = HashMap::new();
-
- for record in attachments {
- // Construct db::attachment::Attachment from the query result
- let db_attachment = db::attachment::AttachmentMacro {
- id: record.id,
- message_id: record.message_id,
- item_type: record.item_type,
- item_id: record.item_id,
- created_at: record.created_at,
- };
-
- // Map the db attachment to a service attachment
- let service_attachment = map_db_macro_attachment_to_service(db_attachment);
-
- // Add to the result map
- result
- .entry(record.thread_id)
- .or_default()
- .push(service_attachment);
- }
-
- Ok(result)
-}
diff --git a/rust/cloud-storage/email_db_client/src/attachments/marco/test.rs b/rust/cloud-storage/email_db_client/src/attachments/marco/test.rs
deleted file mode 100644
index 84663113c7..0000000000
--- a/rust/cloud-storage/email_db_client/src/attachments/marco/test.rs
+++ /dev/null
@@ -1,159 +0,0 @@
-use crate::attachments::marco::fetch_db_macro_attachments_in_bulk;
-use anyhow::Result;
-use macro_db_migrator::MACRO_DB_MIGRATIONS;
-use sqlx::types::Uuid;
-use sqlx::{Pool, Postgres};
-
-#[sqlx::test(
- migrator = "MACRO_DB_MIGRATIONS",
- fixtures(
- path = "../../../fixtures",
- scripts("fetch_db_macro_attachments_in_bulk")
- )
-)]
-async fn fetch_db_macro_attachments_in_bulk_returns_attachments_grouped_by_message_id(
- pool: Pool<Postgres>,
-) -> Result<()> {
- const _: &sqlx::migrate::Migrator = &MACRO_DB_MIGRATIONS;
-
- let message_id_1 = Uuid::parse_str("00000000-0000-0000-0000-00000000c501")?;
- let message_id_2 = Uuid::parse_str("00000000-0000-0000-0000-00000000c502")?;
-
- let result = fetch_db_macro_attachments_in_bulk(&pool, &[message_id_1, message_id_2]).await?;
-
- assert_eq!(result.len(), 2);
-
- // Message 1 should have 2 attachments
- let msg_1_attachments = result.get(&message_id_1).unwrap();
- assert_eq!(msg_1_attachments.len(), 2);
-
- // Message 2 should have 1 attachment
- let msg_2_attachments = result.get(&message_id_2).unwrap();
- assert_eq!(msg_2_attachments.len(), 1);
-
- Ok(())
-}
-
-#[sqlx::test(
- migrator = "MACRO_DB_MIGRATIONS",
- fixtures(
- path = "../../../fixtures",
- scripts("fetch_db_macro_attachments_in_bulk")
- )
-)]
-async fn fetch_db_macro_attachments_in_bulk_orders_by_message_id_and_id_desc(
- pool: Pool<Postgres>,
-) -> Result<()> {
- let message_id_1 = Uuid::parse_str("00000000-0000-0000-0000-00000000c501")?;
-
- let result = fetch_db_macro_attachments_in_bulk(&pool, &[message_id_1]).await?;
-
- let msg_1_attachments = result.get(&message_id_1).unwrap();
- assert_eq!(msg_1_attachments.len(), 2);
-
- // Should be ordered by id DESC (attachment 2 before attachment 1)
- assert_eq!(
- msg_1_attachments[0].id,
- Uuid::parse_str("00000000-0000-0000-0000-0000000ca002")?
- );
- assert_eq!(
- msg_1_attachments[1].id,
- Uuid::parse_str("00000000-0000-0000-0000-0000000ca001")?
- );
-
- Ok(())
-}
-
-#[sqlx::test(
- migrator = "MACRO_DB_MIGRATIONS",
- fixtures(
- path = "../../../fixtures",
- scripts("fetch_db_macro_attachments_in_bulk")
- )
-)]
-async fn fetch_db_macro_attachments_in_bulk_returns_correct_fields(
- pool: Pool<Postgres>,
-) -> Result<()> {
- let message_id_1 = Uuid::parse_str("00000000-0000-0000-0000-00000000c501")?;
-
- let result = fetch_db_macro_attachments_in_bulk(&pool, &[message_id_1]).await?;
-
- let msg_1_attachments = result.get(&message_id_1).unwrap();
- // Find the document attachment (id ca001)
- let document_att = msg_1_attachments
- .iter()
- .find(|a| a.id == Uuid::parse_str("00000000-0000-0000-0000-0000000ca001").unwrap())
- .unwrap();
-
- assert_eq!(document_att.message_id, message_id_1);
- assert_eq!(
- document_att.item_id,
- Uuid::parse_str("00000000-0000-0000-0000-000000001001")?
- );
- assert_eq!(document_att.item_type, "document");
-
- Ok(())
-}
-
-#[sqlx::test(
- migrator = "MACRO_DB_MIGRATIONS",
- fixtures(
- path = "../../../fixtures",
- scripts("fetch_db_macro_attachments_in_bulk")
- )
-)]
-async fn fetch_db_macro_attachments_in_bulk_excludes_messages_without_attachments(
- pool: Pool<Postgres>,
-) -> Result<()> {
- let message_id_with_attachments = Uuid::parse_str("00000000-0000-0000-0000-00000000c501")?;
- let message_id_without_attachments = Uuid::parse_str("00000000-0000-0000-0000-00000000c503")?;
-
- let result = fetch_db_macro_attachments_in_bulk(
- &pool,
- &[message_id_with_attachments, message_id_without_attachments],
- )
- .await?;
-
- // Only message with attachments should be in the map
- assert_eq!(result.len(), 1);
- assert!(result.contains_key(&message_id_with_attachments));
- assert!(!result.contains_key(&message_id_without_attachments));
-
- Ok(())
-}
-
-#[sqlx::test(
- migrator = "MACRO_DB_MIGRATIONS",
- fixtures(
- path = "../../../fixtures",
- scripts("fetch_db_macro_attachments_in_bulk")
- )
-)]
-async fn fetch_db_macro_attachments_in_bulk_returns_empty_for_empty_input(
- pool: Pool<Postgres>,
-) -> Result<()> {
- let result = fetch_db_macro_attachments_in_bulk(&pool, &[]).await?;
-
- assert!(result.is_empty());
-
- Ok(())
-}
-
-#[sqlx::test(
- migrator = "MACRO_DB_MIGRATIONS",
- fixtures(
- path = "../../../fixtures",
- scripts("fetch_db_macro_attachments_in_bulk")
- )
-)]
-async fn fetch_db_macro_attachments_in_bulk_returns_empty_for_nonexistent_messages(
- pool: Pool<Postgres>,
-) -> Result<()> {
- let nonexistent_message_id = Uuid::parse_str("00000000-0000-0000-0000-00000000ffff")?;
-
- let result = fetch_db_macro_attachments_in_bulk(&pool, &[nonexistent_message_id]).await?;
-
- assert!(result.is_empty());
-
- Ok(())
-}
diff --git a/rust/cloud-storage/email_db_client/src/attachments/mod.rs b/rust/cloud-storage/email_db_client/src/attachments/mod.rs
index 58e443ddce..17a6730fba 100644
--- a/rust/cloud-storage/email_db_client/src/attachments/mod.rs
+++ b/rust/cloud-storage/email_db_client/src/attachments/mod.rs
@@ -1,4 +1,3 @@
pub mod draft;
-pub mod marco;
pub mod provider;
pub mod sfs;
diff --git a/rust/cloud-storage/email_db_client/src/messages/get.rs b/rust/cloud-storage/email_db_client/src/messages/get.rs
index 0ee804841e..0d5240299d 100644
--- a/rust/cloud-storage/email_db_client/src/messages/get.rs
+++ b/rust/cloud-storage/email_db_client/src/messages/get.rs
@@ -539,7 +539,6 @@ pub async fn convert_db_messages_to_service_concurrent(
scheduled_map,
labels_map,
attachments_map,
- macro_attachments_map,
draft_attachments_map,
) = tokio::try_join!(
contacts::get::fetch_senders_by_message_ids(pool, &message_ids),
@@ -547,7 +546,6 @@ pub async fn convert_db_messages_to_service_concurrent(
messages::scheduled::get::fetch_scheduled_messages_in_bulk(pool, &message_ids),
labels::get::fetch_message_labels_in_bulk(pool, &message_ids),
attachments::provider::fetch_db_attachments_in_bulk(pool, &message_ids_with_attachments),
- attachments::marco::fetch_db_macro_attachments_in_bulk(pool, &message_ids),
attachments::draft::fetch_db_draft_attachments_in_bulk(pool, &draft_message_ids),
)?;
@@ -564,10 +562,6 @@ pub async fn convert_db_messages_to_service_concurrent(
.get(&message_id)
.cloned()
.unwrap_or_default();
- let macro_attachments = macro_attachments_map
- .get(&message_id)
- .cloned()
- .unwrap_or_default();
let draft_attachments = draft_attachments_map
.get(&message_id)
.cloned()
@@ -583,7 +577,6 @@ pub async fn convert_db_messages_to_service_concurrent(
db_to_service::map_db_message_attachments_to_service(
service_message,
attachments,
- macro_attachments,
draft_attachments,
)
}
diff --git a/rust/cloud-storage/email_db_client/src/messages/insert.rs b/rust/cloud-storage/email_db_client/src/messages/insert.rs
index 63650b1729..1ed6e590ea 100644
--- a/rust/cloud-storage/email_db_client/src/messages/insert.rs
+++ b/rust/cloud-storage/email_db_client/src/messages/insert.rs
@@ -1,4 +1,4 @@
-use crate::attachments::{marco, provider};
+use crate::attachments::provider;
use crate::messages::replying_to_id;
use crate::messages::scheduled::delete::delete_scheduled_message;
use crate::messages::scheduled::upsert::upsert_scheduled_message;
@@ -277,9 +277,7 @@ pub async fn insert_message_to_send_db(
db_message_to_send.subject,
from_contact_id,
Utc::now(),
- service_message
- .attachments_macro.clone()
- .is_some_and(|x| !x.is_empty()),
+ false,
true,
false,
false,
@@ -298,10 +296,6 @@ pub async fn insert_message_to_send_db(
process_scheduled_message(tx, service_message, send_time, message_db_id).await?;
- if let Some(mut attachments) = service_message.attachments_macro.clone() {
- marco::insert_macro_attachments(tx, message_db_id, &mut attachments).await?;
- }
-
contacts::upsert_message::upsert_message_recipients(tx, message_db_id, &recipients).await?;
threads::update::update_thread_metadata(tx, thread_id, db_message_to_send.link_id).await?;
diff --git a/rust/cloud-storage/email_db_client/src/parse/db_to_service.rs b/rust/cloud-storage/email_db_client/src/parse/db_to_service.rs
index d52a880b49..9dfa70dc31 100644
--- a/rust/cloud-storage/email_db_client/src/parse/db_to_service.rs
+++ b/rust/cloud-storage/email_db_client/src/parse/db_to_service.rs
@@ -82,39 +82,14 @@ pub fn map_db_attachment_to_service(
}
}
-#[tracing::instrument]
-pub fn map_db_macro_attachments_to_service(
- db_attachments: Vec<attachment::AttachmentMacro>,
-) -> Vec<service::attachment::AttachmentMacro> {
- db_attachments
- .into_iter()
- .map(map_db_macro_attachment_to_service)
- .collect()
-}
-
-#[tracing::instrument]
-pub fn map_db_macro_attachment_to_service(
- db_att: db::attachment::AttachmentMacro,
-) -> service::attachment::AttachmentMacro {
- service::attachment::AttachmentMacro {
- db_id: Some(db_att.id),
- message_id: Some(db_att.message_id),
- item_type: db_att.item_type,
- item_id: db_att.item_id,
- }
-}
-
-#[tracing::instrument(skip_all, err)]
+#[tracing::instrument(skip_all)]
pub fn map_db_message_attachments_to_service(
mut service_message: message::Message,
attachments_res: Vec<db::attachment::Attachment>,
- macro_attachments_res: Vec<db::attachment::AttachmentMacro>,
draft_attachments_res: Vec<db::attachment::AttachmentDraft>,
) -> anyhow::Result<message::Message> {
service_message.attachments = map_db_attachments_to_service(attachments_res);
- service_message.attachments_macro = map_db_macro_attachments_to_service(macro_attachments_res);
-
service_message.attachments_draft = draft_attachments_res
.into_iter()
.map(|a| a.into())
@@ -158,7 +133,6 @@ pub fn map_db_message_to_message_to_send(
body_macro: db_message.body_macro,
// we don't currently support sending attachments - they get converted to macro.com links on the FE before sending
attachments: None,
- attachments_macro: None,
headers_json: db_message.headers_jsonb,
send_time: None,
}
@@ -208,7 +182,6 @@ pub fn map_attachmentless_db_message_to_service(
body_html_sanitized: db_message.body_html_sanitized,
body_macro: db_message.body_macro,
attachments: Vec::new(),
- attachments_macro: Vec::new(),
attachments_draft: Vec::new(),
headers_json: db_message.headers_jsonb,
created_at: db_message.created_at,
diff --git a/rust/cloud-storage/email_db_client/src/parse/service_to_db.rs b/rust/cloud-storage/email_db_client/src/parse/service_to_db.rs
index 6bd93aaf94..019618d19e 100644
--- a/rust/cloud-storage/email_db_client/src/parse/service_to_db.rs
+++ b/rust/cloud-storage/email_db_client/src/parse/service_to_db.rs
@@ -152,23 +152,6 @@ pub fn map_service_attachments_to_db(
.collect()
}
-#[tracing::instrument(skip(service_attachments))]
-pub fn map_service_macro_attachments_to_db(
- service_attachments: &mut [service::attachment::AttachmentMacro],
- message_db_id: Uuid,
-) -> Vec<attachment::AttachmentMacro> {
- service_attachments
- .iter_mut()
- .map(|service_attachment| attachment::AttachmentMacro {
- id: macro_uuid::generate_uuid_v7(),
- message_id: message_db_id,
- item_id: service_attachment.item_id,
- item_type: service_attachment.item_type.clone(),
- created_at: Utc::now(),
- })
- .collect()
-}
-
pub fn map_new_contact_to_db(service_msg: &Contact, id: Uuid) -> db::contact::Contact {
db::contact::Contact {
id,
diff --git a/rust/cloud-storage/email_service/src/util/process_pre_insert/clean_message/remove_trailing_br_tags.rs b/rust/cloud-storage/email_service/src/util/process_pre_insert/clean_message/remove_trailing_br_tags.rs
index 79b03eac63..6bdf57e443 100644
--- a/rust/cloud-storage/email_service/src/util/process_pre_insert/clean_message/remove_trailing_br_tags.rs
+++ b/rust/cloud-storage/email_service/src/util/process_pre_insert/clean_message/remove_trailing_br_tags.rs
@@ -143,7 +143,6 @@ mod tests {
body_html_sanitized: Some(dirty_html.to_string()),
body_text: None,
attachments: vec![],
- attachments_macro: vec![],
attachments_draft: vec![],
headers_json: None,
created_at: Default::default(),
diff --git a/rust/cloud-storage/gmail_client/src/parse/message.rs b/rust/cloud-storage/gmail_client/src/parse/message.rs
index f91490ba5c..74c4784fa3 100644
--- a/rust/cloud-storage/gmail_client/src/parse/message.rs
+++ b/rust/cloud-storage/gmail_client/src/parse/message.rs
@@ -99,7 +99,6 @@ pub fn map_message_resource_to_service(
body_html_sanitized: parsed_payload.body_html_sanitized,
body_macro: None,
attachments,
- attachments_macro: Vec::new(),
attachments_draft: Vec::new(),
headers_json: Some(serde_json::to_value(parsed_payload.all_headers)?),
created_at: Utc::now(), // Omitted - set default/ignored
diff --git a/rust/cloud-storage/macro_db_client/migrations/20260121112345_drop_email_attachments_macro.sql b/rust/cloud-storage/macro_db_client/migrations/20260121112345_drop_email_attachments_macro.sql
new file mode 100644
index 0000000000..722c66f3f9
--- /dev/null
+++ b/rust/cloud-storage/macro_db_client/migrations/20260121112345_drop_email_attachments_macro.sql
@@ -0,0 +1,2 @@
+-- Drop the email_attachments_macro table
+DROP TABLE IF EXISTS email_attachments_macro;
diff --git a/rust/cloud-storage/models_email/src/email/db/attachment.rs b/rust/cloud-storage/models_email/src/email/db/attachment.rs
index 94c1fd9729..52e120eac9 100644
--- a/rust/cloud-storage/models_email/src/email/db/attachment.rs
+++ b/rust/cloud-storage/models_email/src/email/db/attachment.rs
@@ -19,19 +19,6 @@ pub struct Attachment {
pub created_at: DateTime<Utc>,
}
-/// Attachments of a message created when sending a message/draft through Macro FE. references
-/// a macro item (document, canvas, etc). These don't actually get sent to the provider when
-/// sending a message, but we store them so we can display the pills for the Macro objects in the FE
-/// when displaying the message.
-#[derive(Debug, Clone, Serialize, Deserialize)]
-pub struct AttachmentMacro {
- pub id: Uuid,
- pub message_id: Uuid,
- pub item_id: Uuid,
- pub item_type: String,
- pub created_at: DateTime<Utc>,
-}
-
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct AttachmentSfs {
pub id: Uuid,
diff --git a/rust/cloud-storage/models_email/src/email/service/attachment.rs b/rust/cloud-storage/models_email/src/email/service/attachment.rs
index f62f3e410c..5d1087234a 100644
--- a/rust/cloud-storage/models_email/src/email/service/attachment.rs
+++ b/rust/cloud-storage/models_email/src/email/service/attachment.rs
@@ -26,21 +26,6 @@ pub struct Attachment {
pub content_id: Option<String>,
}
-/// Attachments of a message created when sending a message/draft through Macro FE. references
-/// a macro item (document, canvas, etc). These don't actually get sent to the provider when
-/// sending a message, but we store them so we can display the pills for the Macro objects in the FE
-/// when displaying the message.
-#[derive(Debug, Clone, Serialize, Deserialize, ToSchema, JsonSchema)]
-pub struct AttachmentMacro {
- #[schemars(with = "Option<String>")]
- pub db_id: Option<Uuid>,
- #[schemars(with = "Option<String>")]
- pub message_id: Option<Uuid>,
- #[schemars(with = "String")]
- pub item_id: Uuid,
- pub item_type: String,
-}
-
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct AttachmentSfs {
pub id: Uuid,
diff --git a/rust/cloud-storage/models_email/src/email/service/body_parsing/body_replyless/mod.rs b/rust/cloud-storage/models_email/src/email/service/body_parsing/body_replyless/mod.rs
index 2179b414a7..175cb9f094 100644
--- a/rust/cloud-storage/models_email/src/email/service/body_parsing/body_replyless/mod.rs
+++ b/rust/cloud-storage/models_email/src/email/service/body_parsing/body_replyless/mod.rs
@@ -115,7 +115,6 @@ mod tests {
body_html_sanitized: Some(full_email.to_string()),
body_text: None,
attachments: vec![],
- attachments_macro: vec![],
attachments_draft: vec![],
headers_json: None,
created_at: Default::default(),
diff --git a/rust/cloud-storage/models_email/src/email/service/message.rs b/rust/cloud-storage/models_email/src/email/service/message.rs
index 629fe3bb79..d6c2e3eb9b 100644
--- a/rust/cloud-storage/models_email/src/email/service/message.rs
+++ b/rust/cloud-storage/models_email/src/email/service/message.rs
@@ -2,7 +2,7 @@ use crate::db;
use crate::email::service::address::ContactInfo;
use crate::email::service::attachment::Attachment;
use crate::email::service::label::{LabelInfo, system_labels};
-use crate::service::attachment::{AttachmentDraft, AttachmentMacro, AttachmentToSend};
+use crate::service::attachment::{AttachmentDraft, AttachmentToSend};
use crate::service::body_parsing::body_parsed::{
get_body_parsed_for_message, get_body_parsed_linkless_for_message,
};
@@ -86,7 +86,6 @@ pub struct Message {
pub body_html_sanitized: Option<String>,
pub body_macro: Option<String>,
pub attachments: Vec<Attachment>,
- pub attachments_macro: Vec<AttachmentMacro>,
/// Uploaded file attachments for the message, if it is a draft
pub attachments_draft: Vec<AttachmentDraft>,
pub headers_json: Option<JsonValue>,
@@ -284,7 +283,6 @@ pub struct MessageToSend {
pub body_html: Option<String>,
pub body_macro: Option<String>,
pub attachments: Option<Vec<AttachmentToSend>>,
- pub attachments_macro: Option<Vec<AttachmentMacro>>,
pub headers_json: Option<JsonValue>,
pub send_time: Option<DateTime<Utc>>,
}
diff --git a/rust/cloud-storage/models_email/src/email/service/thread.rs b/rust/cloud-storage/models_email/src/email/service/thread.rs
index e1a3a32340..76e72b5cc9 100644
--- a/rust/cloud-storage/models_email/src/email/service/thread.rs
+++ b/rust/cloud-storage/models_email/src/email/service/thread.rs
@@ -1,5 +1,5 @@
use crate::email::service::message::Message;
-use crate::service::attachment::{Attachment, AttachmentMacro};
+use crate::service::attachment::Attachment;
use crate::service::contact::Contact;
use crate::service::message::MessageWithBodyReplyless;
use chrono::{DateTime, Utc};
@@ -122,7 +122,6 @@ pub struct ThreadPreviewCursor {
pub sender_name: Option<String>,
pub sender_photo_url: Option<String>,
pub attachments: Vec<Attachment>,
- pub attachments_macro: Vec<AttachmentMacro>,
pub participants: Vec<Contact>,
#[serde(with = "chrono::serde::ts_milliseconds")]
#[schema(value_type = i64)]
@@ -208,7 +207,6 @@ impl ThreadPreviewCursor {
sender_name: db_preview.sender_name,
sender_photo_url: db_preview.sender_photo_url,
attachments: Vec::new(),
- attachments_macro: Vec::new(),
participants: Vec::new(),
viewed_at: db_preview.viewed_at,
created_at: db_preview.created_at,
diff --git a/rust/cloud-storage/models_soup/src/email_thread.rs b/rust/cloud-storage/models_soup/src/email_thread.rs
index 6d156e5a74..42e99b5571 100644
--- a/rust/cloud-storage/models_soup/src/email_thread.rs
+++ b/rust/cloud-storage/models_soup/src/email_thread.rs
@@ -82,19 +82,6 @@ pub enum SoupLabelType {
User,
}
-#[derive(Debug, Doppleganger, Serialize, Deserialize)]
-#[cfg_attr(feature = "schema", derive(utoipa::ToSchema))]
-#[cfg_attr(feature = "mock", derive(PartialEq, Eq))]
-#[dg(backward = email::domain::models::AttachmentMacro)]
-#[serde(rename_all = "camelCase")]
-pub struct SoupMacroAttachment {
- pub thread_id: Uuid,
- pub db_id: Uuid,
- pub message_id: Uuid,
- pub item_id: Uuid,
- pub item_type: String,
-}
-
#[derive(Debug, Doppleganger, Serialize, Deserialize)]
#[cfg_attr(feature = "schema", derive(utoipa::ToSchema))]
#[cfg_attr(feature = "mock", derive(PartialEq, Eq))]
@@ -153,7 +140,6 @@ pub struct SoupEnrichedEmailThreadPreview {
#[serde(flatten)]
pub thread: SoupEmailThreadPreview,
pub attachments: Vec<SoupAttachment>,
- pub attachments_macro: Vec<SoupMacroAttachment>,
pub participants: Vec<SoupContact>,
pub metadata: SoupEmailThreadPreviewMetadata,
pub labels: Vec<SoupLabel>,
diff --git a/rust/cloud-storage/soup/src/domain/service.rs b/rust/cloud-storage/soup/src/domain/service.rs
index b98db307a4..c6ff1bac63 100644
--- a/rust/cloud-storage/soup/src/domain/service.rs
+++ b/rust/cloud-storage/soup/src/domain/service.rs
@@ -26,7 +26,7 @@ use models_soup::{
comms::SoupChannel,
email_thread::{
SoupAttachment, SoupContact, SoupEmailThreadPreview, SoupEmailThreadPreviewMetadata,
- SoupEnrichedEmailThreadPreview, SoupLabel, SoupMacroAttachment,
+ SoupEnrichedEmailThreadPreview, SoupLabel,
},
item::SoupItem,
};
@@ -274,7 +274,6 @@ where
|EnrichedEmailThreadPreview {
thread,
attachments,
- attachments_macro,
labels,
metadata,
mut frecency_score,
@@ -285,7 +284,6 @@ where
let soup_email = SoupEnrichedEmailThreadPreview {
thread: SoupEmailThreadPreview::mirror(thread),
attachments: Vec::<SoupAttachment>::mirror(attachments),
- attachments_macro: Vec::<SoupMacroAttachment>::mirror(attachments_macro),
participants: Vec::<SoupContact>::mirror(participants),
metadata: SoupEmailThreadPreviewMetadata::mirror(metadata),
labels: Vec::<SoupLabel>::mirror(labels),