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
chore: remove legacy comms_service and comm_db_client code (#3641)
teo24a5f8108d86
diff --git a/flake.nix b/flake.nixindex 988019a13f..65ed3eb6b2 100644--- a/flake.nix+++ b/flake.nix@@ -142,7 +142,6 @@"--locked""--all-features""--bin document_storage_service_openapi"- "--bin comms_service_openapi""--bin properties_service_openapi""--bin document_cognition_service_openapi""--bin authentication_service_openapi"@@ -430,7 +429,6 @@};crateToDir = {document_storage_service = "service-storage";- comms_service = "service-comms";properties_service = "service-properties";document_cognition_service = "service-cognition";authentication_service = "service-auth";diff --git a/infra/packages/shared/src/service_urls.ts b/infra/packages/shared/src/service_urls.tsindex 1b56c7ba8d..bb4c167fbb 100644--- a/infra/packages/shared/src/service_urls.ts+++ b/infra/packages/shared/src/service_urls.ts@@ -5,7 +5,6 @@ import { stack } from '.';*/export enum ServiceUrl {SYNC_SERVICE_URL = 'SYNC_SERVICE_URL',- COMMS_SERVICE_URL = 'COMMS_SERVICE_URL',EMAIL_SERVICE_URL = 'EMAIL_SERVICE_URL',STATIC_FILE_SERVICE_URL = 'STATIC_FILE_SERVICE_URL',NOTIFICATION_SERVICE_URL = 'NOTIFICATION_SERVICE_URL',@@ -29,7 +28,6 @@ type ServiceUrlMap = {const DEV_SERVICE_URLS: ServiceUrlMap = {[ServiceUrl.SYNC_SERVICE_URL]:'https://sync-service-dev3.macroverse.workers.dev',- [ServiceUrl.COMMS_SERVICE_URL]: 'https://comms-service-dev.macro.com',[ServiceUrl.EMAIL_SERVICE_URL]: 'https://email-service-dev.macro.com',[ServiceUrl.STATIC_FILE_SERVICE_URL]:'https://static-file-service-dev.macro.com',@@ -51,7 +49,6 @@ const DEV_SERVICE_URLS: ServiceUrlMap = {const PROD_SERVICE_URLS: ServiceUrlMap = {[ServiceUrl.SYNC_SERVICE_URL]:'https://sync-service-prod2.macroverse.workers.dev',- [ServiceUrl.COMMS_SERVICE_URL]: 'https://comms-service.macro.com',[ServiceUrl.EMAIL_SERVICE_URL]: 'https://email-service.macro.com',[ServiceUrl.STATIC_FILE_SERVICE_URL]: 'https://static-file-service.macro.com',[ServiceUrl.NOTIFICATION_SERVICE_URL]: 'https://notifications.macro.com',diff --git a/js/app/packages/block-call/component/CallTranscript.tsx b/js/app/packages/block-call/component/CallTranscript.tsxindex b18df28c02..53d149602f 100644--- a/js/app/packages/block-call/component/CallTranscript.tsx+++ b/js/app/packages/block-call/component/CallTranscript.tsx@@ -4,7 +4,7 @@ import { CustomScrollbar } from '@core/component/CustomScrollbar';import { formatVideoTimestamp } from '@core/util/duration';import Subtitles from '@phosphor/subtitles.svg';import { senderFromStorageId } from '@queries/channel/message-sender';-import type { ApiChannelMessage } from '@service-comms/client';+import type { ApiChannelMessage } from '@service-storage/generated/schemas/apiChannelMessage';import type { CallRecordTranscriptSegment } from '@service-storage/generated/schemas/callRecordTranscriptSegment';import {createEffect,diff --git a/js/app/packages/block-channel/component/NewChannelBlockAdapter.tsx b/js/app/packages/block-channel/component/NewChannelBlockAdapter.tsxindex 585f4102de..2edfef7015 100644--- a/js/app/packages/block-channel/component/NewChannelBlockAdapter.tsx+++ b/js/app/packages/block-channel/component/NewChannelBlockAdapter.tsx@@ -40,7 +40,7 @@ import { useChannelName, useChannelType } from '@core/context/channels';import { createMethodRegistration } from '@core/orchestrator';import { blockHandleSignal } from '@core/signal/load';import { useChannelParticipantsQuery } from '@queries/channel/channel-participants';-import { ChannelTypeEnum } from '@service-comms/client';+import { ChannelTypeEnum } from '@service-storage/client';import { useSearchParams } from '@solidjs/router';import {createComputed,diff --git a/js/app/packages/block-channel/component/Top.tsx b/js/app/packages/block-channel/component/Top.tsxindex 839108540d..fe7000a6c1 100644--- a/js/app/packages/block-channel/component/Top.tsx+++ b/js/app/packages/block-channel/component/Top.tsx@@ -15,8 +15,8 @@ import HashIcon from '@phosphor/hash.svg';import PaperclipIcon from '@phosphor/paperclip.svg';import UsersIcon from '@phosphor/users.svg';import type { ChannelParticipant } from '@queries/channel/types';-import { ChannelTypeEnum } from '@service-comms/client';-import type { ChannelType } from '@service-comms/generated/models/channelType';+import { ChannelTypeEnum } from '@service-storage/client';+import type { ChannelType } from '@service-storage/generated/schemas/channelType';import { type Component, type JSX, Show } from 'solid-js';const CHANNEL_TAB_ICONS: Record<diff --git a/js/app/packages/channel/Attachments/ChannelAttachmentEntitySection.tsx b/js/app/packages/channel/Attachments/ChannelAttachmentEntitySection.tsxindex e994eb920f..09bdc6c651 100644--- a/js/app/packages/channel/Attachments/ChannelAttachmentEntitySection.tsx+++ b/js/app/packages/channel/Attachments/ChannelAttachmentEntitySection.tsx@@ -6,7 +6,7 @@ import {useChannelDocumentAttachmentsQuery,} from '@queries/channel/channel-attachments';import { useSoupItemsQuery } from '@queries/soup/items';-import type { ApiChannelAttachment } from '@service-comms/client';+import type { ApiChannelAttachment } from '@service-storage/generated/schemas/apiChannelAttachment';import { createMemo } from 'solid-js';import {AttachmentEntityList,diff --git a/js/app/packages/channel/Attachments/attachment-utils.ts b/js/app/packages/channel/Attachments/attachment-utils.tsindex db0b85e1b5..b23effd545 100644--- a/js/app/packages/channel/Attachments/attachment-utils.ts+++ b/js/app/packages/channel/Attachments/attachment-utils.ts@@ -2,8 +2,8 @@ import type { SplitContent } from '@app/component/split-layout/layoutManager';import { getChannelParams } from '@channel/Channel/link';import { fileTypeToBlockName } from '@core/constant/allBlocks';import type { EntityData } from '@entity';-import type { ApiChannelAttachment } from '@service-comms/client';import { stringToItemType } from '@service-storage/client';+import type { ApiChannelAttachment } from '@service-storage/generated/schemas/apiChannelAttachment';import { match } from 'ts-pattern';/** size-23 = 92px */diff --git a/js/app/packages/channel/Channel/create-channel-hotkeys.ts b/js/app/packages/channel/Channel/create-channel-hotkeys.tsindex ea9f1f5a47..ede4ed736d 100644--- a/js/app/packages/channel/Channel/create-channel-hotkeys.ts+++ b/js/app/packages/channel/Channel/create-channel-hotkeys.ts@@ -1,6 +1,6 @@import { registerHotkey, useHotkeyDOMScope } from '@core/hotkey/hotkeys';import { TOKENS } from '@core/hotkey/tokens';-import type { ApiChannelMessage } from '@service-comms/client';+import type { ApiChannelMessage } from '@service-storage/generated/schemas/apiChannelMessage';import type { Accessor } from 'solid-js';import type { MessageActions, MessageData } from '../Message';import type { MessageSelection } from './create-message-selection';diff --git a/js/app/packages/channel/Channel/create-message-editor.ts b/js/app/packages/channel/Channel/create-message-editor.tsindex 96f5ff1af6..f9c5de2119 100644--- a/js/app/packages/channel/Channel/create-message-editor.ts+++ b/js/app/packages/channel/Channel/create-message-editor.ts@@ -1,7 +1,7 @@import type { InputSnapshot } from '@channel/Input';import { toast } from '@core/component/Toast/Toast';-import type { NewAttachment } from '@service-comms/generated/models/newAttachment';-import type { SimpleMention } from '@service-comms/generated/models/simpleMention';+import type { NewChannelAttachment as NewAttachment } from '@service-storage/generated/schemas/newChannelAttachment';+import type { SimpleMention } from '@service-storage/generated/schemas/simpleMention';import { type Accessor, createSignal } from 'solid-js';import { expandMentions } from '../Input/message-payload';import type { MessageData } from '../Message';diff --git a/js/app/packages/channel/Channel/message-editing.ts b/js/app/packages/channel/Channel/message-editing.tsindex ece198b582..1a9813bb9d 100644--- a/js/app/packages/channel/Channel/message-editing.ts+++ b/js/app/packages/channel/Channel/message-editing.ts@@ -4,8 +4,8 @@ import {STATIC_IMAGE,STATIC_VIDEO,} from '@core/store/cacheChannelInput';-import type { NewAttachment } from '@service-comms/generated/models/newAttachment';import type { ApiMessageAttachment } from '@service-storage/generated/schemas/apiMessageAttachment';+import type { NewChannelAttachment as NewAttachment } from '@service-storage/generated/schemas/newChannelAttachment';import { attachmentEntityType } from '../Input/message-payload';import type { InputAttachmentData, InputSnapshot } from '../Input/types';import type { MessageData } from '../Message';diff --git a/js/app/packages/channel/Channel/message-grouping-meta.ts b/js/app/packages/channel/Channel/message-grouping-meta.tsindex 8f5747e8e4..28db8af47d 100644--- a/js/app/packages/channel/Channel/message-grouping-meta.ts+++ b/js/app/packages/channel/Channel/message-grouping-meta.ts@@ -1,4 +1,4 @@-import type { ApiChannelMessage } from '@service-comms/client';+import type { ApiChannelMessage } from '@service-storage/generated/schemas/apiChannelMessage';export type GroupableMessage = Pick<ApiChannelMessage,diff --git a/js/app/packages/channel/Channel/message-list-meta.ts b/js/app/packages/channel/Channel/message-list-meta.tsindex 2383c8cc9f..f46a6efbfb 100644--- a/js/app/packages/channel/Channel/message-list-meta.ts+++ b/js/app/packages/channel/Channel/message-list-meta.ts@@ -1,4 +1,4 @@-import type { ApiChannelMessage } from '@service-comms/client';+import type { ApiChannelMessage } from '@service-storage/generated/schemas/apiChannelMessage';import type { ChannelMessageListMeta } from '../Message/list-meta';import { shouldGroupWithPreviousMessage } from './message-grouping-meta';diff --git a/js/app/packages/channel/Channel/sticky-scroll.tsx b/js/app/packages/channel/Channel/sticky-scroll.tsxindex 6c44113935..51aabeafa2 100644--- a/js/app/packages/channel/Channel/sticky-scroll.tsx+++ b/js/app/packages/channel/Channel/sticky-scroll.tsx@@ -1,4 +1,4 @@-import type { ApiChannelMessage } from '@service-comms/client';+import type { ApiChannelMessage } from '@service-storage/generated/schemas/apiChannelMessage';import { type Accessor, createEffect, on } from 'solid-js';function isNearTrueBottom(diff --git a/js/app/packages/channel/Channel/tests/message-grouping-meta.test.ts b/js/app/packages/channel/Channel/tests/message-grouping-meta.test.tsindex c82d67aeb9..7a07902655 100644--- a/js/app/packages/channel/Channel/tests/message-grouping-meta.test.ts+++ b/js/app/packages/channel/Channel/tests/message-grouping-meta.test.ts@@ -1,5 +1,5 @@import { senderFromStorageId } from '@queries/channel/message-sender';-import type { ApiChannelMessage } from '@service-comms/client';+import type { ApiChannelMessage } from '@service-storage/generated/schemas/apiChannelMessage';import { describe, expect, it } from 'vitest';import {MESSAGE_GROUPING_WINDOW_MS,diff --git a/js/app/packages/channel/Channel/tests/message-list-meta.test.ts b/js/app/packages/channel/Channel/tests/message-list-meta.test.tsindex 15337f5334..d643ef22a7 100644--- a/js/app/packages/channel/Channel/tests/message-list-meta.test.ts+++ b/js/app/packages/channel/Channel/tests/message-list-meta.test.ts@@ -1,5 +1,5 @@import { senderFromStorageId } from '@queries/channel/message-sender';-import type { ApiChannelMessage } from '@service-comms/client';+import type { ApiChannelMessage } from '@service-storage/generated/schemas/apiChannelMessage';import { describe, expect, it } from 'vitest';import { buildChannelMessageListMeta } from '../message-list-meta';diff --git a/js/app/packages/channel/Channel/util.ts b/js/app/packages/channel/Channel/util.tsindex ec8e949ab6..69717e730a 100644--- a/js/app/packages/channel/Channel/util.ts+++ b/js/app/packages/channel/Channel/util.ts@@ -1,6 +1,6 @@import type { DateValue } from '@core/util/date';import type { ChannelMessagesData } from '@queries/channel/channel-messages';-import type { ApiChannelMessage } from '@service-comms/client';+import type { ApiChannelMessage } from '@service-storage/generated/schemas/apiChannelMessage';/** Minimal shape needed by isNewMessage — satisfied by both ApiChannelMessage and ApiThreadReply. */export type NewMessageCheckable = { created_at: string; sender_id: string };diff --git a/js/app/packages/channel/Input/message-payload.ts b/js/app/packages/channel/Input/message-payload.tsindex 4d17cff9ff..d999013be8 100644--- a/js/app/packages/channel/Input/message-payload.ts+++ b/js/app/packages/channel/Input/message-payload.ts@@ -1,8 +1,8 @@import type { ItemMention } from '@core/component/LexicalMarkdown/plugins';import { STATIC_IMAGE, STATIC_VIDEO } from '@core/store/cacheChannelInput';-import type { PostMessageRequest } from '@service-comms/generated/models';-import type { NewAttachment } from '@service-comms/generated/models/newAttachment';-import type { SimpleMention } from '@service-comms/generated/models/simpleMention';+import type { NewChannelAttachment as NewAttachment } from '@service-storage/generated/schemas/newChannelAttachment';+import type { PostMessageRequest } from '@service-storage/generated/schemas/postMessageRequest';+import type { SimpleMention } from '@service-storage/generated/schemas/simpleMention';import { match } from 'ts-pattern';import type { InputAttachmentData, InputSnapshot } from './types';diff --git a/js/app/packages/channel/Participants/ChannelParticipantsTab.tsx b/js/app/packages/channel/Participants/ChannelParticipantsTab.tsxindex 6460783805..4916e79ca0 100644--- a/js/app/packages/channel/Participants/ChannelParticipantsTab.tsx+++ b/js/app/packages/channel/Participants/ChannelParticipantsTab.tsx@@ -9,7 +9,7 @@ import {useAddParticipantsMutation,useRemoveParticipantsMutation,} from '@queries/channel/participants';-import { ChannelType } from '@service-comms/generated/models/channelType';+import { ChannelType } from '@service-storage/generated/schemas/channelType';import { Panel } from '@ui';import { createSignal, Show } from 'solid-js';import { ParticipantsAddPanel } from './ParticipantsAddPanel';diff --git a/js/app/packages/channel/StandaloneThread/EditableThread.tsx b/js/app/packages/channel/StandaloneThread/EditableThread.tsxindex d912ea9862..99e6e0e4ba 100644--- a/js/app/packages/channel/StandaloneThread/EditableThread.tsx+++ b/js/app/packages/channel/StandaloneThread/EditableThread.tsx@@ -4,7 +4,7 @@ import {useAddReactionMutation,useRemoveReactionMutation,} from '@queries/channel/reaction';-import type { ApiChannelMessage } from '@service-comms/client';+import type { ApiChannelMessage } from '@service-storage/generated/schemas/apiChannelMessage';import { createSignal, Show } from 'solid-js';import { createChannelMessageActions } from '../Channel/create-channel-message-actions';import type { InputHandle, InputSnapshot } from '../Input';diff --git a/js/app/packages/channel/StandaloneThread/ReadonlyThread.tsx b/js/app/packages/channel/StandaloneThread/ReadonlyThread.tsxindex 3c5eda9449..be1dab243a 100644--- a/js/app/packages/channel/StandaloneThread/ReadonlyThread.tsx+++ b/js/app/packages/channel/StandaloneThread/ReadonlyThread.tsx@@ -1,4 +1,4 @@-import type { ApiChannelMessage } from '@service-comms/client';+import type { ApiChannelMessage } from '@service-storage/generated/schemas/apiChannelMessage';import { StandaloneThread } from './StandaloneThread';type ReadonlyThreadProps = {diff --git a/js/app/packages/channel/StandaloneThread/Root.tsx b/js/app/packages/channel/StandaloneThread/Root.tsxindex b0fb46d40a..ca783ed402 100644--- a/js/app/packages/channel/StandaloneThread/Root.tsx+++ b/js/app/packages/channel/StandaloneThread/Root.tsx@@ -1,7 +1,8 @@import { DebugSuspense } from '@channel/DebugSuspense';import { useChannelMessagesByIdsQuery } from '@queries/channel/channel-messages';import { useThreadRepliesQuery } from '@queries/channel/thread-replies';-import type { ApiChannelMessage, ApiThreadReply } from '@service-comms/client';+import type { ApiChannelMessage } from '@service-storage/generated/schemas/apiChannelMessage';+import type { ApiThreadReply } from '@service-storage/generated/schemas/apiThreadReply';import { createSignal, type ParentProps, Show } from 'solid-js';import { ThreadRail } from '../Thread/ThreadRail';import { DEFAULT_VISIBLE_REPLY_COUNT } from '../Thread/utils/thread-reply-indicator-helpers';diff --git a/js/app/packages/channel/StandaloneThread/context.ts b/js/app/packages/channel/StandaloneThread/context.tsindex fe52ee8530..08daa50270 100644--- a/js/app/packages/channel/StandaloneThread/context.ts+++ b/js/app/packages/channel/StandaloneThread/context.ts@@ -1,4 +1,5 @@-import type { ApiChannelMessage, ApiThreadReply } from '@service-comms/client';+import type { ApiChannelMessage } from '@service-storage/generated/schemas/apiChannelMessage';+import type { ApiThreadReply } from '@service-storage/generated/schemas/apiThreadReply';import {type Accessor,createContext,diff --git a/js/app/packages/channel/Thread/ChannelThread.tsx b/js/app/packages/channel/Thread/ChannelThread.tsxindex 9945ca8452..19a7cb26ee 100644--- a/js/app/packages/channel/Thread/ChannelThread.tsx+++ b/js/app/packages/channel/Thread/ChannelThread.tsx@@ -3,7 +3,7 @@ import { useUserId } from '@core/context/user';import { tryMacroId, useDisplayName } from '@core/user';import { MarkMessageNotifications } from '@notifications/components/MarkMessageNotifications';import { useThreadRepliesQuery } from '@queries/channel/thread-replies';-import type { ApiThreadReply } from '@service-comms/client';+import type { ApiThreadReply } from '@service-storage/generated/schemas/apiThreadReply';import { createEffect, createSignal, on, Show, untrack } from 'solid-js';import { createMessageSelection } from '../Channel/create-message-selection';import { ChannelMessage } from '../Message';diff --git a/js/app/packages/channel/Thread/ThreadReplyList.tsx b/js/app/packages/channel/Thread/ThreadReplyList.tsxindex e0b1ae61f4..160dabdb27 100644--- a/js/app/packages/channel/Thread/ThreadReplyList.tsx+++ b/js/app/packages/channel/Thread/ThreadReplyList.tsx@@ -1,5 +1,5 @@import { MarkMessageNotifications } from '@notifications/components/MarkMessageNotifications';-import type { ApiThreadReply } from '@service-comms/client';+import type { ApiThreadReply } from '@service-storage/generated/schemas/apiThreadReply';import { type Accessor, createMemo, For, onMount } from 'solid-js';import type { MessageEditor } from '../Channel/create-message-editor';import type { NewMessageCheckable } from '../Channel/util';diff --git a/js/app/packages/channel/Thread/ThreadRow.tsx b/js/app/packages/channel/Thread/ThreadRow.tsxindex 8bab2f3ead..b5c5923bb6 100644--- a/js/app/packages/channel/Thread/ThreadRow.tsx+++ b/js/app/packages/channel/Thread/ThreadRow.tsx@@ -1,4 +1,4 @@-import type { ApiChannelMessage } from '@service-comms/client';+import type { ApiChannelMessage } from '@service-storage/generated/schemas/apiChannelMessage';import type { ParentProps } from 'solid-js';import {type ChannelMessageListMeta,diff --git a/js/app/packages/channel/Thread/create-thread-hotkeys.ts b/js/app/packages/channel/Thread/create-thread-hotkeys.tsindex 0a393831fd..0166a34a70 100644--- a/js/app/packages/channel/Thread/create-thread-hotkeys.ts+++ b/js/app/packages/channel/Thread/create-thread-hotkeys.ts@@ -5,7 +5,8 @@ import {} from '@core/hotkey/hotkeys';import { TOKENS } from '@core/hotkey/tokens';import { HOTKEY_PRIORITY_HIGH } from '@core/hotkey/types';-import type { ApiChannelMessage, ApiThreadReply } from '@service-comms/client';+import type { ApiChannelMessage } from '@service-storage/generated/schemas/apiChannelMessage';+import type { ApiThreadReply } from '@service-storage/generated/schemas/apiThreadReply';import { type Accessor, onCleanup } from 'solid-js';import type { MessageSelection } from '../Channel/create-message-selection';import type { MessageActions, MessageData } from '../Message';diff --git a/js/app/packages/channel/Thread/reply-list-meta.ts b/js/app/packages/channel/Thread/reply-list-meta.tsindex ca63abd393..c34c5167ee 100644--- a/js/app/packages/channel/Thread/reply-list-meta.ts+++ b/js/app/packages/channel/Thread/reply-list-meta.ts@@ -1,4 +1,4 @@-import type { ApiThreadReply } from '@service-comms/client';+import type { ApiThreadReply } from '@service-storage/generated/schemas/apiThreadReply';import { shouldGroupWithPreviousMessage } from '../Channel/message-grouping-meta';import type { NewMessageCheckable } from '../Channel/util';import type { ChannelMessageListMeta } from '../Message';diff --git a/js/app/packages/channel/Thread/tests/reply-list-meta.test.ts b/js/app/packages/channel/Thread/tests/reply-list-meta.test.tsindex 40a29445ad..03cbd71569 100644--- a/js/app/packages/channel/Thread/tests/reply-list-meta.test.ts+++ b/js/app/packages/channel/Thread/tests/reply-list-meta.test.ts@@ -1,5 +1,5 @@import { senderFromStorageId } from '@queries/channel/message-sender';-import type { ApiThreadReply } from '@service-comms/client';+import type { ApiThreadReply } from '@service-storage/generated/schemas/apiThreadReply';import { describe, expect, it } from 'vitest';import { buildThreadReplyListMeta } from '../reply-list-meta';diff --git a/js/app/packages/channel/Thread/types.ts b/js/app/packages/channel/Thread/types.tsindex 60469d7db2..ba96b2f1ed 100644--- a/js/app/packages/channel/Thread/types.ts+++ b/js/app/packages/channel/Thread/types.ts@@ -1,7 +1,7 @@import type { MessageEditor } from '@channel/Channel/create-message-editor';import type { NewMessageCheckable } from '@channel/Channel/util';import type { InputHandle, InputSnapshot } from '@channel/Input';-import type { ApiChannelMessage } from '@service-comms/client';+import type { ApiChannelMessage } from '@service-storage/generated/schemas/apiChannelMessage';import type { Accessor, Setter } from 'solid-js';import type {ChannelMessageListMeta,diff --git a/js/app/packages/core/context/channels.ts b/js/app/packages/core/context/channels.tsindex 027503b463..b933e717d2 100644--- a/js/app/packages/core/context/channels.ts+++ b/js/app/packages/core/context/channels.ts@@ -2,8 +2,8 @@ import type { DateValue } from '@core/util/date';import { useChannelsActivityQuery } from '@queries/channel/activity';import { useListChannelsQuery } from '@queries/channel/channels';import { queryReadyGate } from '@queries/gate';-import { ChannelTypeEnum } from '@service-comms/client';-import type { ApiChannelWithLatest } from '@service-comms/generated/models';+import type { ApiChannelWithLatest } from '@service-storage/channel-list-types';+import { ChannelTypeEnum } from '@service-storage/client';import type { ApiActivity as ChannelsActivity } from '@service-storage/generated/schemas/apiActivity';import { type Accessor, createMemo } from 'solid-js';import { createAssertedContextProvider } from './createContext';diff --git a/js/app/packages/core/context/quickAccess/QuickAccessProvider.tsx b/js/app/packages/core/context/quickAccess/QuickAccessProvider.tsxindex 4740dcc22d..4eb500b274 100644--- a/js/app/packages/core/context/quickAccess/QuickAccessProvider.tsx+++ b/js/app/packages/core/context/quickAccess/QuickAccessProvider.tsx@@ -11,7 +11,7 @@ import { queryReadyGate } from '@queries/gate';import { type HistoryItem, useHistoryQuery } from '@queries/history/history';import { useRecentlyViewedSoupQuery } from '@queries/soup/recently-viewed';import { useInstructionsMdIdQuery } from '@queries/storage/instructions-md';-import type { ApiChannelWithLatest } from '@service-comms/generated/models';+import type { ApiChannelWithLatest } from '@service-storage/channel-list-types';import { formatDocumentName } from '@service-storage/util/filename';import { createLazyMemo } from '@solid-primitives/memo';import { toDate } from 'date-fns';diff --git a/js/app/packages/core/user/types.ts b/js/app/packages/core/user/types.tsindex 164433139f..20d193cd4a 100644--- a/js/app/packages/core/user/types.ts+++ b/js/app/packages/core/user/types.ts@@ -1,8 +1,8 @@import type { DateValue } from '@core/util/date';import type { Accessor } from 'solid-js';-export type { ChannelWithParticipants } from '@service-comms/generated/models';export type { ContactInfo } from '@service-email/generated/schemas';+export type { ChannelWithParticipants } from '@service-storage/channel-list-types';export type IUser = {id: string;diff --git a/js/app/packages/core/util/channels.ts b/js/app/packages/core/util/channels.tsindex 34c4e0b3be..83f7a72a5e 100644--- a/js/app/packages/core/util/channels.ts+++ b/js/app/packages/core/util/channels.ts@@ -9,11 +9,9 @@ import {useGetOrCreateDirectMessageMutation,useGetOrCreatePrivateChannelMutation,} from '@queries/channel/get-or-create-dm';-import type {- NewAttachment,- SimpleMention,-} from '@service-comms/generated/models';import { storageServiceClient } from '@service-storage/client';+import type { NewChannelAttachment as NewAttachment } from '@service-storage/generated/schemas/newChannelAttachment';+import type { SimpleMention } from '@service-storage/generated/schemas/simpleMention';import { createCallback } from '@solid-primitives/rootless';type SendContent = {diff --git a/js/app/packages/macro-entity/src/queries/rename.ts b/js/app/packages/macro-entity/src/queries/rename.tsindex 487f42e18e..a8d214395c 100644--- a/js/app/packages/macro-entity/src/queries/rename.ts+++ b/js/app/packages/macro-entity/src/queries/rename.ts@@ -12,9 +12,9 @@ import {} from '@queries/soup/cache';import { type MutationCallbacks, withCallbacks } from '@queries/utils';import type { CallRecord } from '@service-call/client';-import { ChannelTypeEnum } from '@service-comms/client';-import type { ApiChannelWithLatest } from '@service-comms/generated/models';+import type { ApiChannelWithLatest } from '@service-storage/channel-list-types';import type { ItemType } from '@service-storage/client';+import { ChannelTypeEnum } from '@service-storage/client';import { useMutation } from '@tanstack/solid-query';type RenamableEntity = Pick<EntityData, 'id' | 'type' | 'name'> &diff --git a/js/app/packages/queries/channel/message.ts b/js/app/packages/queries/channel/message.tsindex ed4f8e9e5a..c8b0a37c2b 100644--- a/js/app/packages/queries/channel/message.ts+++ b/js/app/packages/queries/channel/message.ts@@ -4,12 +4,6 @@ import { toast } from '@core/component/Toast/Toast';import type { DateValue } from '@core/util/date';import { throwOnErr } from '@core/util/result';import { type MutationCallbacks, withCallbacks } from '@queries/utils';-import type {- Attachment,- ChannelMessage,- CountedReaction,- Message,-} from '@service-comms/generated/models';import {type ApiChannelMessage,type ApiThreadReply,@@ -17,7 +11,10 @@ import {type MessageResponse,storageServiceClient,} from '@service-storage/client';+import type { ApiChannelContextMessage as Message } from '@service-storage/generated/schemas/apiChannelContextMessage';+import type { ApiCountedReaction as CountedReaction } from '@service-storage/generated/schemas/apiCountedReaction';import type { ApiMessageAttachment } from '@service-storage/generated/schemas/apiMessageAttachment';+import type { ChannelMessage } from '@service-storage/generated/schemas/channelMessage';import type { NewChannelAttachment as NewAttachment } from '@service-storage/generated/schemas/newChannelAttachment';import type { PostMessageRequest } from '@service-storage/generated/schemas/postMessageRequest';import type { SimpleMention } from '@service-storage/generated/schemas/simpleMention';@@ -43,6 +40,15 @@ import {topLevelMessageHasReplies,} from './reconcile';+/**+ * A message attachment carrying its channel/message ids — the legacy comms `Attachment`+ * shape (a message attachment plus channel_id/message_id; no sender_id).+ */+type Attachment = ApiMessageAttachment & {+ channel_id: string;+ message_id: string;+};+/*** Register nonces for both message and attachment deduplication.* The server echoes the same nonce for both message and attachment WebSocket events.diff --git a/js/app/packages/queries/channel/reconcile.ts b/js/app/packages/queries/channel/reconcile.tsindex 9d9f4b284b..537a56112c 100644--- a/js/app/packages/queries/channel/reconcile.ts+++ b/js/app/packages/queries/channel/reconcile.ts@@ -1,12 +1,12 @@-import type {- Attachment as ApiAttachment,- CountedReaction,-} from '@service-comms/generated/models';import type {ApiChannelMessage,ApiThreadReply,} from '@service-storage/client';-import type { ApiMessageAttachment } from '@service-storage/generated/schemas/apiMessageAttachment';+import type { ApiCountedReaction as CountedReaction } from '@service-storage/generated/schemas/apiCountedReaction';+import type {+ ApiMessageAttachment as ApiAttachment,+ ApiMessageAttachment,+} from '@service-storage/generated/schemas/apiMessageAttachment';import { queryClient } from '../client';import {findThreadIdInChannelMessages,diff --git a/js/app/packages/queries/channel/sync.ts b/js/app/packages/queries/channel/sync.tsindex 45f02883d4..6cbe93da30 100644--- a/js/app/packages/queries/channel/sync.ts+++ b/js/app/packages/queries/channel/sync.ts@@ -1,9 +1,7 @@-import type {- Attachment as ApiAttachment,- Message as ApiMessage,- CountedReaction,-} from '@service-comms/generated/models';import type { ApiThreadReply } from '@service-storage/client';+import type { ApiChannelContextMessage as ApiMessage } from '@service-storage/generated/schemas/apiChannelContextMessage';+import type { ApiCountedReaction as CountedReaction } from '@service-storage/generated/schemas/apiCountedReaction';+import type { ApiMessageAttachment as ApiAttachment } from '@service-storage/generated/schemas/apiMessageAttachment';import type { ApiMessageSender } from '@service-storage/generated/schemas/apiMessageSender';import { consumeNonce } from '../nonce';import { ChannelNonceKeys } from './keys';diff --git a/js/app/packages/queries/channel/tests/sync.test.ts b/js/app/packages/queries/channel/tests/sync.test.tsindex 9e6801cf66..85770f70dc 100644--- a/js/app/packages/queries/channel/tests/sync.test.ts+++ b/js/app/packages/queries/channel/tests/sync.test.ts@@ -2,11 +2,11 @@* @vitest-environment jsdom*/-import type { Attachment as ApiAttachment } from '@service-comms/generated/models';import type {ApiChannelMessage,ApiThreadReply,} from '@service-storage/client';+import type { ApiMessageAttachment as ApiAttachment } from '@service-storage/generated/schemas/apiMessageAttachment';import { QueryClient } from '@tanstack/solid-query';import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest';diff --git a/js/app/packages/queries/soup/transform-utils.ts b/js/app/packages/queries/soup/transform-utils.tsindex 9ab40e0a1f..3a26a9223b 100644--- a/js/app/packages/queries/soup/transform-utils.ts+++ b/js/app/packages/queries/soup/transform-utils.ts@@ -22,7 +22,6 @@ import type {SearchData,WithSearch,} from '@entity';-import type { ChannelType } from '@service-comms/generated/models';import type {CallRecordSearchResult,ChannelSearchResult,@@ -36,6 +35,7 @@ import type {SoupDocument,SoupPage,} from '@service-storage/generated/schemas';+import type { ChannelType } from '@service-storage/generated/schemas/channelType';import type { UseQueryResult } from '@tanstack/solid-query';import { differenceInMilliseconds } from 'date-fns';diff --git a/js/app/packages/service-clients/orval.config.ts b/js/app/packages/service-clients/orval.config.tsindex e2b5b2c9c6..a69e8812b7 100644--- a/js/app/packages/service-clients/orval.config.ts+++ b/js/app/packages/service-clients/orval.config.ts@@ -27,19 +27,6 @@ export default defineConfig({target: './service-cognition/openapi.json',},},- commsService: {- output: {- client: 'fetch',- target: './service-comms/generated/client.ts',- schemas: './service-comms/generated/models',- override: {- useDates: false,- },- },- input: {- target: './service-comms/openapi.json',- },- },connectionGateway: {output: {client: 'fetch',diff --git a/js/app/packages/service-clients/service-comms/.gitignore b/js/app/packages/service-clients/service-comms/.gitignoredeleted file mode 100644index 9b1ee42e84..0000000000--- a/js/app/packages/service-clients/service-comms/.gitignore+++ /dev/null@@ -1,175 +0,0 @@-# Based on https://raw.githubusercontent.com/github/gitignore/main/Node.gitignore--# Logs--logs-_.log-npm-debug.log_-yarn-debug.log*-yarn-error.log*-lerna-debug.log*-.pnpm-debug.log*--# Caches--.cache--# Diagnostic reports (https://nodejs.org/api/report.html)--report.[0-9]_.[0-9]_.[0-9]_.[0-9]_.json--# Runtime data--pids-_.pid-_.seed-*.pid.lock--# Directory for instrumented libs generated by jscoverage/JSCover--lib-cov--# Coverage directory used by tools like istanbul--coverage-*.lcov--# nyc test coverage--.nyc_output--# Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files)--.grunt--# Bower dependency directory (https://bower.io/)--bower_components--# node-waf configuration--.lock-wscript--# Compiled binary addons (https://nodejs.org/api/addons.html)--build/Release--# Dependency directories--node_modules/-jspm_packages/--# Snowpack dependency directory (https://snowpack.dev/)--web_modules/--# TypeScript cache--*.tsbuildinfo--# Optional npm cache directory--.npm--# Optional eslint cache--.eslintcache--# Optional stylelint cache--.stylelintcache--# Microbundle cache--.rpt2_cache/-.rts2_cache_cjs/-.rts2_cache_es/-.rts2_cache_umd/--# Optional REPL history--.node_repl_history--# Output of 'npm pack'--*.tgz--# Yarn Integrity file--.yarn-integrity--# dotenv environment variable files--.env-.env.development.local-.env.test.local-.env.production.local-.env.local--# parcel-bundler cache (https://parceljs.org/)--.parcel-cache--# Next.js build output--.next-out--# Nuxt.js build / generate output--.nuxt-dist--# Gatsby files--# Comment in the public line in if your project uses Gatsby and not Next.js--# https://nextjs.org/blog/next-9-1#public-directory-support--# public--# vuepress build output--.vuepress/dist--# vuepress v2.x temp and cache directory--.temp--# Docusaurus cache and generated files--.docusaurus--# Serverless directories--.serverless/--# FuseBox cache--.fusebox/--# DynamoDB Local files--.dynamodb/--# TernJS port file--.tern-port--# Stores VSCode versions used for testing VSCode extensions--.vscode-test--# yarn v2--.yarn/cache-.yarn/unplugged-.yarn/build-state.yml-.yarn/install-state.gz-.pnp.*--# IntelliJ based IDEs-.idea--# Finder (MacOS) folder config-.DS_Storediff --git a/js/app/packages/service-clients/service-comms/README.md b/js/app/packages/service-clients/service-comms/README.mddeleted file mode 100644index d6e6e9517c..0000000000--- a/js/app/packages/service-clients/service-comms/README.md+++ /dev/null@@ -1,15 +0,0 @@-# cognition-service--To install dependencies:--```bash-bun install-```--To run:--```bash-bun run index.ts-```--This project was created using `bun init` in bun v1.1.23. [Bun](https://bun.sh) is a fast all-in-one JavaScript runtime.diff --git a/js/app/packages/service-clients/service-comms/client.ts b/js/app/packages/service-clients/service-comms/client.tsdeleted file mode 100644index e61530abba..0000000000--- a/js/app/packages/service-clients/service-comms/client.ts+++ /dev/null@@ -1,445 +0,0 @@-import { SERVER_HOSTS } from '@core/constant/servers';-import {- type FetchWithTokenErrorCode,- fetchWithToken,-} from '@core/util/fetchWithToken';-import type { ObjectLike, ResultError } from '@core/util/result';-import type { SafeFetchInit } from '@core/util/safeFetch';-import type { ApiThreadReply } from '@service-storage/generated/schemas';-import type { ApiChannelAttachmentsPage } from '@service-storage/generated/schemas/apiChannelAttachmentsPage';-import type { ApiChannelMessagesPage } from '@service-storage/generated/schemas/apiChannelMessagesPage';-import type { ApiChannelParticipant } from '@service-storage/generated/schemas/apiChannelParticipant';-import type { ChannelMessageFilters } from '@service-storage/generated/schemas/channelMessageFilters';-import type { Result } from 'neverthrow';-import type {- ApiActivity,- ApiChannelWithLatest,- GetMentionsResponse,-} from './generated/models';-import type { Activity } from './generated/models/activity';-import type { AddParticipantsRequest } from './generated/models/addParticipantsRequest';-import { ChannelType } from './generated/models/channelType';-import type { CreateChannelRequest } from './generated/models/createChannelRequest';-import type { CreateChannelResponse } from './generated/models/createChannelResponse';-import type { CreateEntityMentionRequest } from './generated/models/createEntityMentionRequest';-import type { CreateEntityMentionResponse } from './generated/models/createEntityMentionResponse';-import type { DeleteEntityMentionResponse } from './generated/models/deleteEntityMentionResponse';-import type { GetAttachmentReferencesResponse } from './generated/models/getAttachmentReferencesResponse';-import type { GetBatchChannelPreviewRequest } from './generated/models/getBatchChannelPreviewRequest';-import type { GetBatchChannelPreviewResponse } from './generated/models/getBatchChannelPreviewResponse';-import type { GetChannelResponse } from './generated/models/getChannelResponse';-import type { GetMessageWithContextParams } from './generated/models/getMessageWithContextParams';-import type { GetMessageWithContextResponse } from './generated/models/getMessageWithContextResponse';-import type { GetOrCreateDmRequest } from './generated/models/getOrCreateDmRequest';-import type { GetOrCreateDmResponse } from './generated/models/getOrCreateDmResponse';-import type { GetOrCreatePrivateRequest } from './generated/models/getOrCreatePrivateRequest';-import type { GetOrCreatePrivateResponse } from './generated/models/getOrCreatePrivateResponse';-import type { PatchMessageRequest } from './generated/models/patchMessageRequest';-import type { PostActivityRequest } from './generated/models/postActivityRequest';-import type { PostMessageRequest } from './generated/models/postMessageRequest';-import type { PostReactionRequest } from './generated/models/postReactionRequest';-import type { PostTypingRequest } from './generated/models/postTypingRequest';-import type { RemoveParticipantsRequest } from './generated/models/removeParticipantsRequest';--export type { ApiChannelAttachment } from '@service-storage/generated/schemas/apiChannelAttachment';-export type { ApiChannelAttachmentsPage as ChannelAttachmentsPage } from '@service-storage/generated/schemas/apiChannelAttachmentsPage';-export type { ApiChannelMessage } from '@service-storage/generated/schemas/apiChannelMessage';-export type { ApiChannelMessagesPage as ChannelMessagesPage } from '@service-storage/generated/schemas/apiChannelMessagesPage';-export type { ApiChannelParticipant } from '@service-storage/generated/schemas/apiChannelParticipant';-export type { ApiThreadReply } from '@service-storage/generated/schemas/apiThreadReply';--const commsHost: string = SERVER_HOSTS['document-storage-service'];--function commsFetch(- url: string,- init?: SafeFetchInit-): Promise<Result<void, ResultError<FetchWithTokenErrorCode>[]>>;-function commsFetch<T extends ObjectLike>(- url: string,- init?: SafeFetchInit-): Promise<Result<T, ResultError<FetchWithTokenErrorCode>[]>>;-function commsFetch<T extends ObjectLike = never>(- url: string,- init?: SafeFetchInit-):- | Promise<Result<T, ResultError<FetchWithTokenErrorCode>[]>>- | Promise<Result<void, ResultError<FetchWithTokenErrorCode>[]>> {- return fetchWithToken<T>(`${commsHost}${url}`, init);-}--export type IdResponse = { id: string };--export type MessageResponse = { message: string };--type WithChannelId = { channel_id: string };-type WithMessageId = { message_id: string };-type WithMentionId = { mention_id: string };-type WithEntity = { entity_type: string; entity_id: string };-export type ChannelAttachmentType = 'static' | 'dss';--export const ChannelTypeEnum = {- Public: ChannelType.public,- Organization: ChannelType.organization,- Private: ChannelType.private,- DirectMessage: ChannelType.direct_message,-} as const satisfies Record<string, ChannelType>;--export const commsServiceClient = {- async getChannel(args: WithChannelId) {- const { channel_id } = args;- return (- await commsFetch<GetChannelResponse>(`/comms/channels/${channel_id}`, {- method: 'GET',- })- ).map((result) => result);- },- async getChannels() {- return (- await commsFetch<ApiChannelWithLatest[]>(`/comms/channels`, {- method: 'GET',- })- ).map((result) => result);- },- async getMessageWithContext(args: GetMessageWithContextParams) {- const { message_id, before, after } = args;- const params = new URLSearchParams();- params.append('message_id', message_id);- if (before !== undefined) params.append('before', before.toString());- if (after !== undefined) params.append('after', after.toString());- return await commsFetch<GetMessageWithContextResponse>(- `/comms/channels/messages/context?${params.toString()}`- );- },- async postMessage(- args: WithChannelId & { message: PostMessageRequest; nonce?: string }- ) {- const { channel_id, message, nonce } = args;- const uniqueMentions = Array.from(new Set(message.mentions));- const sendMessage = { ...message, mentions: uniqueMentions, nonce };- return (- await commsFetch<IdResponse & { nonce?: string }>(- `/comms/channels/${channel_id}/message`,- {- method: 'POST',- body: JSON.stringify(sendMessage),- }- )- ).map((result) => result ?? {});- },- async createChannel(args: CreateChannelRequest) {- return (- await commsFetch<CreateChannelResponse>(`/comms/channels`, {- method: 'POST',- body: JSON.stringify(args),- })- ).map((result) => result);- },- async postTypingUpdate(- args: PostTypingRequest & WithChannelId & { nonce?: string }- ) {- const { channel_id, action, thread_id, nonce } = args;- return (- await commsFetch<MessageResponse>(- `/comms/channels/${channel_id}/typing`,- {- method: 'POST',- body: JSON.stringify({ action, thread_id, nonce }),- }- )- ).map((result) => result);- },- async postReaction(- args: PostReactionRequest & WithChannelId & { nonce?: string }- ) {- const { channel_id, action, emoji, message_id, nonce } = args;- return (- await commsFetch<MessageResponse>(- `/comms/channels/${channel_id}/reaction`,- {- method: 'POST',- body: JSON.stringify({ action, emoji, message_id, nonce }),- }- )- ).map((result) => result);- },- async patchMessage(- args: PatchMessageRequest &- WithChannelId &- WithMessageId & { nonce?: string }- ) {- const {- channel_id,- content,- message_id,- attachment_ids_to_delete,- attachments_to_add,- nonce,- } = args;- return (- await commsFetch<MessageResponse>(- `/comms/channels/${channel_id}/message/${message_id}`,- {- method: 'PATCH',- body: JSON.stringify({- content,- attachment_ids_to_delete,- attachments_to_add,- nonce,- }),- }- )- ).map((result) => result);- },- async deleteMessage(- args: WithChannelId & WithMessageId & { nonce?: string }- ) {- const { channel_id, message_id, nonce } = args;- const url = nonce- ? `/comms/channels/${channel_id}/message/${message_id}?nonce=${encodeURIComponent(nonce)}`- : `/comms/channels/${channel_id}/message/${message_id}`;- return (- await commsFetch<MessageResponse>(url, {- method: 'DELETE',- })- ).map((result) => result);- },- async postActivity(args: PostActivityRequest) {- const { activity_type, channel_id } = args;- return (- await commsFetch<Activity>(`/comms/activity`, {- method: 'POST',- body: JSON.stringify({ activity_type, channel_id }),- })- ).map((result) => result);- },- async getActivity() {- return (- await commsFetch<ApiActivity[]>(`/comms/activity`, {- method: 'GET',- })- ).map((result) => result);- },- async joinChannel(args: WithChannelId) {- const { channel_id } = args;- return (- await commsFetch<MessageResponse>(`/comms/channels/${channel_id}/join`, {- method: 'POST',- })- ).map((result) => result);- },- async leaveChannel(args: WithChannelId) {- const { channel_id } = args;- return (- await commsFetch<MessageResponse>(`/comms/channels/${channel_id}/leave`, {- method: 'POST',- })- ).map((result) => result);- },- async getBatchChannelPreviews(args: GetBatchChannelPreviewRequest) {- const { channel_ids } = args;- return (- await commsFetch<GetBatchChannelPreviewResponse>(`/comms/preview`, {- body: JSON.stringify({ channel_ids }),- method: 'POST',- })- ).map((result) => result);- },- async addParticipantsToChanenl(args: AddParticipantsRequest & WithChannelId) {- const { channel_id, participants } = args;- return (- await commsFetch<MessageResponse>(- `/comms/channels/${channel_id}/participants`,- {- method: 'POST',- body: JSON.stringify({ participants }),- }- )- ).map((result) => result);- },- async getOrCreateDirectMessage(args: GetOrCreateDmRequest) {- const { recipient_id } = args;- return (- await commsFetch<GetOrCreateDmResponse>(- `/comms/channels/get_or_create_dm`,- {- method: 'POST',- body: JSON.stringify({ recipient_id }),- }- )- ).map((result) => result);- },- async getOrCreatePrivateChannel(args: GetOrCreatePrivateRequest) {- const { recipients } = args;- return (- await commsFetch<GetOrCreatePrivateResponse>(- `/comms/channels/get_or_create_private`,- {- method: 'POST',- body: JSON.stringify({ recipients }),- }- )- ).map((result) => result);- },- async removeParticipantsFromChannel(- args: RemoveParticipantsRequest & WithChannelId- ) {- const { channel_id, participants } = args;- return (- await commsFetch<MessageResponse>(- `/comms/channels/${channel_id}/participants`,- {- method: 'DELETE',- body: JSON.stringify({ participants }),- }- )- ).map((result) => result);- },- async deleteChannel(args: WithChannelId) {- const { channel_id } = args;- return (- await commsFetch<MessageResponse>(`/comms/channels/${channel_id}`, {- method: 'DELETE',- })- ).map((result) => result);- },- async patchChannel(args: WithChannelId & { channel_name: string }) {- const { channel_id, channel_name } = args;- return (- await commsFetch<MessageResponse>(`/comms/channels/${channel_id}`, {- method: 'PATCH',- body: JSON.stringify({ channel_name }),- })- ).map((result) => result);- },- async attachmentReferences(args: WithEntity) {- const { entity_type, entity_id } = args;- return (- await commsFetch<GetAttachmentReferencesResponse>(- `/comms/attachments/${entity_type}/${entity_id}/references`,- {- method: 'GET',- }- )- ).map((result) => result);- },- async createEntityMention(args: CreateEntityMentionRequest, token?: string) {- return (- await commsFetch<CreateEntityMentionResponse>('/comms/mentions', {- method: 'POST',- body: JSON.stringify(args),- headers: token- ? {- 'x-permissions-token': `${token}`,- }- : undefined,- })- ).map((result) => result);- },- async deleteEntityMention(args: WithMentionId, token?: string) {- return (- await commsFetch<DeleteEntityMentionResponse>(- `/comms/mentions/${args.mention_id}`,- {- method: 'DELETE',- headers: token ? { 'x-permissions-token': `${token}` } : undefined,- }- )- ).map((result) => result);- },- async getMentions(args: WithChannelId) {- return (- await commsFetch<GetMentionsResponse>(- `/comms/channels/${args.channel_id}/mentions`,- {- method: 'GET',- }- )- ).map((result) => result);- },- async getChannelMessages(- args: WithChannelId & {- limit: number;- next_cursor: string | null;- previous_cursor: string | null;- load_around_message_id: string | null;- }- ) {- const {- channel_id,- limit,- next_cursor,- previous_cursor,- load_around_message_id,- } = args;- const params = new URLSearchParams();- params.append('limit', limit.toString());- if (load_around_message_id) {- params.append('load_around_message_id', load_around_message_id);- } else if (next_cursor) {- params.append('cursor', next_cursor);- } else if (previous_cursor) {- params.append('previous_cursor', previous_cursor);- }- return (- await commsFetch<ApiChannelMessagesPage>(- `/channels/${channel_id}/messages?${params.toString()}`,- { method: 'GET' }- )- ).map((result) => result);- },- async postChannelMessages(- args: WithChannelId & { filters: ChannelMessageFilters; limit?: number }- ) {- const { channel_id, filters, limit } = args;- const params = new URLSearchParams();- if (limit !== undefined) params.append('limit', limit.toString());- const query = params.toString();- return (- await commsFetch<ApiChannelMessagesPage>(- `/channels/${channel_id}/messages${query ? `?${query}` : ''}`,- {- method: 'POST',- body: JSON.stringify(filters),- }- )- ).map((result) => result);- },- async getChannelAttachments(- args: WithChannelId & {- limit: number;- cursor: string | null;- attachment_type?: ChannelAttachmentType;- signal?: AbortSignal;- }- ) {- const { channel_id, limit, cursor, attachment_type, signal } = args;- const params = new URLSearchParams();- params.append('limit', limit.toString());- if (cursor) params.append('cursor', cursor);- if (attachment_type) params.append('attachment_type', attachment_type);- return (- await commsFetch<ApiChannelAttachmentsPage>(- `/channels/${channel_id}/attachments?${params.toString()}`,- { method: 'GET', signal }- )- ).map((result) => result);- },- async getThreadReplies(args: WithChannelId & WithMessageId) {- const { channel_id, message_id } = args;- return (- await commsFetch<Array<ApiThreadReply>>(- `/channels/${channel_id}/messages/${message_id}/replies`,- { method: 'GET' }- )- ).map((result) => result);- },- async getChannelParticipants(args: WithChannelId) {- const { channel_id } = args;- return (- await commsFetch<ApiChannelParticipant[]>(- `/channels/${channel_id}/participants`,- { method: 'GET' }- )- ).map((result) => result);- },-};diff --git a/js/app/packages/service-clients/service-comms/generated/client.ts b/js/app/packages/service-clients/service-comms/generated/client.tsdeleted file mode 100644index f141054ea1..0000000000--- a/js/app/packages/service-clients/service-comms/generated/client.ts+++ /dev/null@@ -1,1545 +0,0 @@-/**- * Generated by orval v7.21.0 🍺- * Do not edit manually.- * comms_service- * OpenAPI spec version: 0.1.0- */-import type {- Activity,- AddParticipantsRequest,- ApiActivity,- ApiChannelWithLatest,- CreateChannelRequest,- CreateChannelResponse,- CreateEntityMentionRequest,- CreateEntityMentionResponse,- DeleteEntityMentionResponse,- GenericErrorResponse,- GetAttachmentReferencesResponse,- GetBatchChannelPreviewRequest,- GetBatchChannelPreviewResponse,- GetChannelParams,- GetChannelResponse,- GetMentionsResponse,- GetMessageWithContextParams,- GetMessageWithContextResponse,- GetOrCreateDmRequest,- GetOrCreateDmResponse,- GetOrCreatePrivateRequest,- GetOrCreatePrivateResponse,- PatchChannelOptions,- PatchMessageRequest,- PostActivityRequest,- PostMessageRequest,- PostMessageResponse,- PostReactionRequest,- PostTypingRequest,- RemoveParticipantsRequest,-} from './models';--export type getActivityResponse200 = {- data: ApiActivity[];- status: 200;-};--export type getActivityResponse401 = {- data: string;- status: 401;-};--export type getActivityResponse404 = {- data: string;- status: 404;-};--export type getActivityResponse500 = {- data: string;- status: 500;-};--export type getActivityResponseSuccess = getActivityResponse200 & {- headers: Headers;-};-export type getActivityResponseError = (- | getActivityResponse401- | getActivityResponse404- | getActivityResponse500-) & {- headers: Headers;-};--export type getActivityResponse =- | getActivityResponseSuccess- | getActivityResponseError;--export const getGetActivityUrl = () => {- return `/activity`;-};--export const getActivity = async (- options?: RequestInit-): Promise<getActivityResponse> => {- const res = await fetch(getGetActivityUrl(), {- ...options,- method: 'GET',- });-- const body = [204, 205, 304].includes(res.status) ? null : await res.text();-- const data: getActivityResponse['data'] = body ? JSON.parse(body) : {};- return {- data,- status: res.status,- headers: res.headers,- } as getActivityResponse;-};--export type getChannelsResponse200 = {- data: ApiChannelWithLatest[];- status: 200;-};--export type getChannelsResponse401 = {- data: string;- status: 401;-};--export type getChannelsResponse404 = {- data: string;- status: 404;-};--export type getChannelsResponse500 = {- data: string;- status: 500;-};--export type getChannelsResponseSuccess = getChannelsResponse200 & {- headers: Headers;-};-export type getChannelsResponseError = (- | getChannelsResponse401- | getChannelsResponse404- | getChannelsResponse500-) & {- headers: Headers;-};--export type getChannelsResponse =- | getChannelsResponseSuccess- | getChannelsResponseError;--export const getGetChannelsUrl = () => {- return `/channels`;-};--export const getChannels = async (- options?: RequestInit-): Promise<getChannelsResponse> => {- const res = await fetch(getGetChannelsUrl(), {- ...options,- method: 'GET',- });-- const body = [204, 205, 304].includes(res.status) ? null : await res.text();-- const data: getChannelsResponse['data'] = body ? JSON.parse(body) : {};- return {- data,- status: res.status,- headers: res.headers,- } as getChannelsResponse;-};--export type postActivityResponse200 = {- data: Activity;- status: 200;-};--export type postActivityResponse401 = {- data: string;- status: 401;-};--export type postActivityResponse404 = {- data: string;- status: 404;-};--export type postActivityResponse500 = {- data: string;- status: 500;-};--export type postActivityResponseSuccess = postActivityResponse200 & {- headers: Headers;-};-export type postActivityResponseError = (- | postActivityResponse401- | postActivityResponse404- | postActivityResponse500-) & {- headers: Headers;-};--export type postActivityResponse =- | postActivityResponseSuccess- | postActivityResponseError;--export const getPostActivityUrl = () => {- return `/comms/activity`;-};--export const postActivity = async (- postActivityRequest: PostActivityRequest,- options?: RequestInit-): Promise<postActivityResponse> => {- const res = await fetch(getPostActivityUrl(), {- ...options,- method: 'POST',- headers: { 'Content-Type': 'application/json', ...options?.headers },- body: JSON.stringify(postActivityRequest),- });-- const body = [204, 205, 304].includes(res.status) ? null : await res.text();-- const data: postActivityResponse['data'] = body ? JSON.parse(body) : {};- return {- data,- status: res.status,- headers: res.headers,- } as postActivityResponse;-};--export type getAttachmentReferencesResponse200 = {- data: GetAttachmentReferencesResponse;- status: 200;-};--export type getAttachmentReferencesResponse401 = {- data: string;- status: 401;-};--export type getAttachmentReferencesResponse404 = {- data: string;- status: 404;-};--export type getAttachmentReferencesResponse500 = {- data: string;- status: 500;-};--export type getAttachmentReferencesResponseSuccess =- getAttachmentReferencesResponse200 & {- headers: Headers;- };-export type getAttachmentReferencesResponseError = (- | getAttachmentReferencesResponse401- | getAttachmentReferencesResponse404- | getAttachmentReferencesResponse500-) & {- headers: Headers;-};--export type getAttachmentReferencesResponse =- | getAttachmentReferencesResponseSuccess- | getAttachmentReferencesResponseError;--export const getGetAttachmentReferencesUrl = (- entityType: string,- entityId: string-) => {- return `/comms/attachments/${entityType}/${entityId}/references`;-};--export const getAttachmentReferences = async (- entityType: string,- entityId: string,- options?: RequestInit-): Promise<getAttachmentReferencesResponse> => {- const res = await fetch(getGetAttachmentReferencesUrl(entityType, entityId), {- ...options,- method: 'GET',- });-- const body = [204, 205, 304].includes(res.status) ? null : await res.text();-- const data: getAttachmentReferencesResponse['data'] = body- ? JSON.parse(body)- : {};- return {- data,- status: res.status,- headers: res.headers,- } as getAttachmentReferencesResponse;-};--export type createChannelResponse201 = {- data: CreateChannelResponse;- status: 201;-};--export type createChannelResponse400 = {- data: string;- status: 400;-};--export type createChannelResponse401 = {- data: string;- status: 401;-};--export type createChannelResponse403 = {- data: string;- status: 403;-};--export type createChannelResponse404 = {- data: string;- status: 404;-};--export type createChannelResponse500 = {- data: string;- status: 500;-};--export type createChannelResponseSuccess = createChannelResponse201 & {- headers: Headers;-};-export type createChannelResponseError = (- | createChannelResponse400- | createChannelResponse401- | createChannelResponse403- | createChannelResponse404- | createChannelResponse500-) & {- headers: Headers;-};--export type createChannelResponse =- | createChannelResponseSuccess- | createChannelResponseError;--export const getCreateChannelUrl = () => {- return `/comms/channels`;-};--export const createChannel = async (- createChannelRequest: CreateChannelRequest,- options?: RequestInit-): Promise<createChannelResponse> => {- const res = await fetch(getCreateChannelUrl(), {- ...options,- method: 'POST',- headers: { 'Content-Type': 'application/json', ...options?.headers },- body: JSON.stringify(createChannelRequest),- });-- const body = [204, 205, 304].includes(res.status) ? null : await res.text();-- const data: createChannelResponse['data'] = body ? JSON.parse(body) : {};- return {- data,- status: res.status,- headers: res.headers,- } as createChannelResponse;-};--/**- * given a user and a recipient, either finds or creates a direct message channel- */-export type getOrCreateDmResponse200 = {- data: GetOrCreateDmResponse;- status: 200;-};--export type getOrCreateDmResponse400 = {- data: string;- status: 400;-};--export type getOrCreateDmResponse401 = {- data: string;- status: 401;-};--export type getOrCreateDmResponse404 = {- data: string;- status: 404;-};--export type getOrCreateDmResponse500 = {- data: string;- status: 500;-};--export type getOrCreateDmResponseSuccess = getOrCreateDmResponse200 & {- headers: Headers;-};-export type getOrCreateDmResponseError = (- | getOrCreateDmResponse400- | getOrCreateDmResponse401- | getOrCreateDmResponse404- | getOrCreateDmResponse500-) & {- headers: Headers;-};--export type getOrCreateDmResponse =- | getOrCreateDmResponseSuccess- | getOrCreateDmResponseError;--export const getGetOrCreateDmUrl = () => {- return `/comms/channels/get_or_create_dm`;-};--export const getOrCreateDm = async (- getOrCreateDmRequest: GetOrCreateDmRequest,- options?: RequestInit-): Promise<getOrCreateDmResponse> => {- const res = await fetch(getGetOrCreateDmUrl(), {- ...options,- method: 'POST',- headers: { 'Content-Type': 'application/json', ...options?.headers },- body: JSON.stringify(getOrCreateDmRequest),- });-- const body = [204, 205, 304].includes(res.status) ? null : await res.text();-- const data: getOrCreateDmResponse['data'] = body ? JSON.parse(body) : {};- return {- data,- status: res.status,- headers: res.headers,- } as getOrCreateDmResponse;-};--/**- * given a list of partiicpants, either fetch an existing private channel with the permtation or create a new one- */-export type getOrCreatePrivateResponse200 = {- data: GetOrCreatePrivateResponse;- status: 200;-};--export type getOrCreatePrivateResponse400 = {- data: string;- status: 400;-};--export type getOrCreatePrivateResponse401 = {- data: string;- status: 401;-};--export type getOrCreatePrivateResponse404 = {- data: string;- status: 404;-};--export type getOrCreatePrivateResponse500 = {- data: string;- status: 500;-};--export type getOrCreatePrivateResponseSuccess =- getOrCreatePrivateResponse200 & {- headers: Headers;- };-export type getOrCreatePrivateResponseError = (- | getOrCreatePrivateResponse400- | getOrCreatePrivateResponse401- | getOrCreatePrivateResponse404- | getOrCreatePrivateResponse500-) & {- headers: Headers;-};--export type getOrCreatePrivateResponse =- | getOrCreatePrivateResponseSuccess- | getOrCreatePrivateResponseError;--export const getGetOrCreatePrivateUrl = () => {- return `/comms/channels/get_or_create_private`;-};--export const getOrCreatePrivate = async (- getOrCreatePrivateRequest: GetOrCreatePrivateRequest,- options?: RequestInit-): Promise<getOrCreatePrivateResponse> => {- const res = await fetch(getGetOrCreatePrivateUrl(), {- ...options,- method: 'POST',- headers: { 'Content-Type': 'application/json', ...options?.headers },- body: JSON.stringify(getOrCreatePrivateRequest),- });-- const body = [204, 205, 304].includes(res.status) ? null : await res.text();-- const data: getOrCreatePrivateResponse['data'] = body ? JSON.parse(body) : {};- return {- data,- status: res.status,- headers: res.headers,- } as getOrCreatePrivateResponse;-};--export type getMessageWithContextResponse200 = {- data: GetMessageWithContextResponse;- status: 200;-};--export type getMessageWithContextResponse400 = {- data: string;- status: 400;-};--export type getMessageWithContextResponse401 = {- data: string;- status: 401;-};--export type getMessageWithContextResponse500 = {- data: string;- status: 500;-};--export type getMessageWithContextResponseSuccess =- getMessageWithContextResponse200 & {- headers: Headers;- };-export type getMessageWithContextResponseError = (- | getMessageWithContextResponse400- | getMessageWithContextResponse401- | getMessageWithContextResponse500-) & {- headers: Headers;-};--export type getMessageWithContextResponse =- | getMessageWithContextResponseSuccess- | getMessageWithContextResponseError;--export const getGetMessageWithContextUrl = (- params: GetMessageWithContextParams-) => {- const normalizedParams = new URLSearchParams();-- Object.entries(params || {}).forEach(([key, value]) => {- if (value !== undefined) {- normalizedParams.append(key, value === null ? 'null' : value.toString());- }- });-- const stringifiedParams = normalizedParams.toString();-- return stringifiedParams.length > 0- ? `/comms/channels/messages/context?${stringifiedParams}`- : `/comms/channels/messages/context`;-};--export const getMessageWithContext = async (- params: GetMessageWithContextParams,- options?: RequestInit-): Promise<getMessageWithContextResponse> => {- const res = await fetch(getGetMessageWithContextUrl(params), {- ...options,- method: 'GET',- });-- const body = [204, 205, 304].includes(res.status) ? null : await res.text();-- const data: getMessageWithContextResponse['data'] = body- ? JSON.parse(body)- : {};- return {- data,- status: res.status,- headers: res.headers,- } as getMessageWithContextResponse;-};--export type getChannelResponse200 = {- data: GetChannelResponse;- status: 200;-};--export type getChannelResponse401 = {- data: string;- status: 401;-};--export type getChannelResponse404 = {- data: string;- status: 404;-};--export type getChannelResponse500 = {- data: string;- status: 500;-};--export type getChannelResponseSuccess = getChannelResponse200 & {- headers: Headers;-};-export type getChannelResponseError = (- | getChannelResponse401- | getChannelResponse404- | getChannelResponse500-) & {- headers: Headers;-};--export type getChannelResponse =- | getChannelResponseSuccess- | getChannelResponseError;--export const getGetChannelUrl = (- channelId: string,- params?: GetChannelParams-) => {- const normalizedParams = new URLSearchParams();-- Object.entries(params || {}).forEach(([key, value]) => {- if (value !== undefined) {- normalizedParams.append(key, value === null ? 'null' : value.toString());- }- });-- const stringifiedParams = normalizedParams.toString();-- return stringifiedParams.length > 0- ? `/comms/channels/${channelId}?${stringifiedParams}`- : `/comms/channels/${channelId}`;-};--export const getChannel = async (- channelId: string,- params?: GetChannelParams,- options?: RequestInit-): Promise<getChannelResponse> => {- const res = await fetch(getGetChannelUrl(channelId, params), {- ...options,- method: 'GET',- });-- const body = [204, 205, 304].includes(res.status) ? null : await res.text();-- const data: getChannelResponse['data'] = body ? JSON.parse(body) : {};- return {- data,- status: res.status,- headers: res.headers,- } as getChannelResponse;-};--export type deleteChannelResponse204 = {- data: string;- status: 204;-};--export type deleteChannelResponse400 = {- data: string;- status: 400;-};--export type deleteChannelResponse404 = {- data: string;- status: 404;-};--export type deleteChannelResponse500 = {- data: string;- status: 500;-};--export type deleteChannelResponseSuccess = deleteChannelResponse204 & {- headers: Headers;-};-export type deleteChannelResponseError = (- | deleteChannelResponse400- | deleteChannelResponse404- | deleteChannelResponse500-) & {- headers: Headers;-};--export type deleteChannelResponse =- | deleteChannelResponseSuccess- | deleteChannelResponseError;--export const getDeleteChannelUrl = (channelId: string) => {- return `/comms/channels/${channelId}`;-};--export const deleteChannel = async (- channelId: string,- options?: RequestInit-): Promise<deleteChannelResponse> => {- const res = await fetch(getDeleteChannelUrl(channelId), {- ...options,- method: 'DELETE',- });-- const body = [204, 205, 304].includes(res.status) ? null : await res.text();-- const data: deleteChannelResponse['data'] = body ? JSON.parse(body) : {};- return {- data,- status: res.status,- headers: res.headers,- } as deleteChannelResponse;-};--export type patchChannelResponse200 = {- data: string;- status: 200;-};--export type patchChannelResponse500 = {- data: string;- status: 500;-};--export type patchChannelResponseSuccess = patchChannelResponse200 & {- headers: Headers;-};-export type patchChannelResponseError = patchChannelResponse500 & {- headers: Headers;-};--export type patchChannelResponse =- | patchChannelResponseSuccess- | patchChannelResponseError;--export const getPatchChannelUrl = (channelId: string) => {- return `/comms/channels/${channelId}`;-};--export const patchChannel = async (- channelId: string,- patchChannelOptions: PatchChannelOptions,- options?: RequestInit-): Promise<patchChannelResponse> => {- const res = await fetch(getPatchChannelUrl(channelId), {- ...options,- method: 'PATCH',- headers: { 'Content-Type': 'application/json', ...options?.headers },- body: JSON.stringify(patchChannelOptions),- });-- const body = [204, 205, 304].includes(res.status) ? null : await res.text();-- const data: patchChannelResponse['data'] = body ? JSON.parse(body) : {};- return {- data,- status: res.status,- headers: res.headers,- } as patchChannelResponse;-};--/**- * allows a user to attempt to join a channel- */-export type joinChannelResponse200 = {- data: void;- status: 200;-};--export type joinChannelResponse401 = {- data: string;- status: 401;-};--export type joinChannelResponse404 = {- data: string;- status: 404;-};--export type joinChannelResponse500 = {- data: string;- status: 500;-};--export type joinChannelResponseSuccess = joinChannelResponse200 & {- headers: Headers;-};-export type joinChannelResponseError = (- | joinChannelResponse401- | joinChannelResponse404- | joinChannelResponse500-) & {- headers: Headers;-};--export type joinChannelResponse =- | joinChannelResponseSuccess- | joinChannelResponseError;--export const getJoinChannelUrl = (channelId: string) => {- return `/comms/channels/${channelId}/join`;-};--export const joinChannel = async (- channelId: string,- options?: RequestInit-): Promise<joinChannelResponse> => {- const res = await fetch(getJoinChannelUrl(channelId), {- ...options,- method: 'POST',- });-- const body = [204, 205, 304].includes(res.status) ? null : await res.text();-- const data: joinChannelResponse['data'] = body ? JSON.parse(body) : {};- return {- data,- status: res.status,- headers: res.headers,- } as joinChannelResponse;-};--/**- * allows a user to attempt to leave a channel- */-export type leaveChannelResponse200 = {- data: void;- status: 200;-};--export type leaveChannelResponse401 = {- data: string;- status: 401;-};--export type leaveChannelResponse404 = {- data: string;- status: 404;-};--export type leaveChannelResponse500 = {- data: string;- status: 500;-};--export type leaveChannelResponseSuccess = leaveChannelResponse200 & {- headers: Headers;-};-export type leaveChannelResponseError = (- | leaveChannelResponse401- | leaveChannelResponse404- | leaveChannelResponse500-) & {- headers: Headers;-};--export type leaveChannelResponse =- | leaveChannelResponseSuccess- | leaveChannelResponseError;--export const getLeaveChannelUrl = (channelId: string) => {- return `/comms/channels/${channelId}/leave`;-};--export const leaveChannel = async (- channelId: string,- options?: RequestInit-): Promise<leaveChannelResponse> => {- const res = await fetch(getLeaveChannelUrl(channelId), {- ...options,- method: 'POST',- });-- const body = [204, 205, 304].includes(res.status) ? null : await res.text();-- const data: leaveChannelResponse['data'] = body ? JSON.parse(body) : {};- return {- data,- status: res.status,- headers: res.headers,- } as leaveChannelResponse;-};--export type getMentionsForChannelResponse200 = {- data: GetMentionsResponse;- status: 200;-};--export type getMentionsForChannelResponse401 = {- data: string;- status: 401;-};--export type getMentionsForChannelResponse404 = {- data: string;- status: 404;-};--export type getMentionsForChannelResponse500 = {- data: string;- status: 500;-};--export type getMentionsForChannelResponseSuccess =- getMentionsForChannelResponse200 & {- headers: Headers;- };-export type getMentionsForChannelResponseError = (- | getMentionsForChannelResponse401- | getMentionsForChannelResponse404- | getMentionsForChannelResponse500-) & {- headers: Headers;-};--export type getMentionsForChannelResponse =- | getMentionsForChannelResponseSuccess- | getMentionsForChannelResponseError;--export const getGetMentionsForChannelUrl = (channelId: string) => {- return `/comms/channels/${channelId}/mentions`;-};--export const getMentionsForChannel = async (- channelId: string,- options?: RequestInit-): Promise<getMentionsForChannelResponse> => {- const res = await fetch(getGetMentionsForChannelUrl(channelId), {- ...options,- method: 'GET',- });-- const body = [204, 205, 304].includes(res.status) ? null : await res.text();-- const data: getMentionsForChannelResponse['data'] = body- ? JSON.parse(body)- : {};- return {- data,- status: res.status,- headers: res.headers,- } as getMentionsForChannelResponse;-};--export type postMessageResponse201 = {- data: PostMessageResponse;- status: 201;-};--export type postMessageResponse401 = {- data: string;- status: 401;-};--export type postMessageResponse404 = {- data: string;- status: 404;-};--export type postMessageResponse500 = {- data: string;- status: 500;-};--export type postMessageResponseSuccess = postMessageResponse201 & {- headers: Headers;-};-export type postMessageResponseError = (- | postMessageResponse401- | postMessageResponse404- | postMessageResponse500-) & {- headers: Headers;-};--export type postMessageResponse =- | postMessageResponseSuccess- | postMessageResponseError;--export const getPostMessageUrl = (channelId: string) => {- return `/comms/channels/${channelId}/message`;-};--export const postMessage = async (- channelId: string,- postMessageRequest: PostMessageRequest,- options?: RequestInit-): Promise<postMessageResponse> => {- const res = await fetch(getPostMessageUrl(channelId), {- ...options,- method: 'POST',- headers: { 'Content-Type': 'application/json', ...options?.headers },- body: JSON.stringify(postMessageRequest),- });-- const body = [204, 205, 304].includes(res.status) ? null : await res.text();-- const data: postMessageResponse['data'] = body ? JSON.parse(body) : {};- return {- data,- status: res.status,- headers: res.headers,- } as postMessageResponse;-};--export type deleteMessageResponse201 = {- data: string;- status: 201;-};--export type deleteMessageResponse401 = {- data: string;- status: 401;-};--export type deleteMessageResponse404 = {- data: string;- status: 404;-};--export type deleteMessageResponse500 = {- data: string;- status: 500;-};--export type deleteMessageResponseSuccess = deleteMessageResponse201 & {- headers: Headers;-};-export type deleteMessageResponseError = (- | deleteMessageResponse401- | deleteMessageResponse404- | deleteMessageResponse500-) & {- headers: Headers;-};--export type deleteMessageResponse =- | deleteMessageResponseSuccess- | deleteMessageResponseError;--export const getDeleteMessageUrl = (channelId: string, messageId: string) => {- return `/comms/channels/${channelId}/message/${messageId}`;-};--export const deleteMessage = async (- channelId: string,- messageId: string,- options?: RequestInit-): Promise<deleteMessageResponse> => {- const res = await fetch(getDeleteMessageUrl(channelId, messageId), {- ...options,- method: 'DELETE',- });-- const body = [204, 205, 304].includes(res.status) ? null : await res.text();-- const data: deleteMessageResponse['data'] = body ? JSON.parse(body) : {};- return {- data,- status: res.status,- headers: res.headers,- } as deleteMessageResponse;-};--export type patchMessageResponse201 = {- data: string;- status: 201;-};--export type patchMessageResponse401 = {- data: string;- status: 401;-};--export type patchMessageResponse404 = {- data: string;- status: 404;-};--export type patchMessageResponse500 = {- data: string;- status: 500;-};--export type patchMessageResponseSuccess = patchMessageResponse201 & {- headers: Headers;-};-export type patchMessageResponseError = (- | patchMessageResponse401- | patchMessageResponse404- | patchMessageResponse500-) & {- headers: Headers;-};--export type patchMessageResponse =- | patchMessageResponseSuccess- | patchMessageResponseError;--export const getPatchMessageUrl = (channelId: string, messageId: string) => {- return `/comms/channels/${channelId}/message/${messageId}`;-};--export const patchMessage = async (- channelId: string,- messageId: string,- patchMessageRequest: PatchMessageRequest,- options?: RequestInit-): Promise<patchMessageResponse> => {- const res = await fetch(getPatchMessageUrl(channelId, messageId), {- ...options,- method: 'PATCH',- headers: { 'Content-Type': 'application/json', ...options?.headers },- body: JSON.stringify(patchMessageRequest),- });-- const body = [204, 205, 304].includes(res.status) ? null : await res.text();-- const data: patchMessageResponse['data'] = body ? JSON.parse(body) : {};- return {- data,- status: res.status,- headers: res.headers,- } as patchMessageResponse;-};--/**- * adds a list of participants to the channel, user must be a participant- */-export type addParticipantsResponse200 = {- data: void;- status: 200;-};--export type addParticipantsResponse401 = {- data: string;- status: 401;-};--export type addParticipantsResponse404 = {- data: string;- status: 404;-};--export type addParticipantsResponse500 = {- data: string;- status: 500;-};--export type addParticipantsResponseSuccess = addParticipantsResponse200 & {- headers: Headers;-};-export type addParticipantsResponseError = (- | addParticipantsResponse401- | addParticipantsResponse404- | addParticipantsResponse500-) & {- headers: Headers;-};--export type addParticipantsResponse =- | addParticipantsResponseSuccess- | addParticipantsResponseError;--export const getAddParticipantsUrl = (channelId: string) => {- return `/comms/channels/${channelId}/participants`;-};--export const addParticipants = async (- channelId: string,- addParticipantsRequest: AddParticipantsRequest,- options?: RequestInit-): Promise<addParticipantsResponse> => {- const res = await fetch(getAddParticipantsUrl(channelId), {- ...options,- method: 'POST',- headers: { 'Content-Type': 'application/json', ...options?.headers },- body: JSON.stringify(addParticipantsRequest),- });-- const body = [204, 205, 304].includes(res.status) ? null : await res.text();-- const data: addParticipantsResponse['data'] = body ? JSON.parse(body) : {};- return {- data,- status: res.status,- headers: res.headers,- } as addParticipantsResponse;-};--/**- * removes a list of participants from the channel, user must be a participant- */-export type removeParticipantsResponse200 = {- data: void;- status: 200;-};--export type removeParticipantsResponse401 = {- data: string;- status: 401;-};--export type removeParticipantsResponse404 = {- data: string;- status: 404;-};--export type removeParticipantsResponse500 = {- data: string;- status: 500;-};--export type removeParticipantsResponseSuccess =- removeParticipantsResponse200 & {- headers: Headers;- };-export type removeParticipantsResponseError = (- | removeParticipantsResponse401- | removeParticipantsResponse404- | removeParticipantsResponse500-) & {- headers: Headers;-};--export type removeParticipantsResponse =- | removeParticipantsResponseSuccess- | removeParticipantsResponseError;--export const getRemoveParticipantsUrl = (channelId: string) => {- return `/comms/channels/${channelId}/participants`;-};--export const removeParticipants = async (- channelId: string,- removeParticipantsRequest: RemoveParticipantsRequest,- options?: RequestInit-): Promise<removeParticipantsResponse> => {- const res = await fetch(getRemoveParticipantsUrl(channelId), {- ...options,- method: 'DELETE',- headers: { 'Content-Type': 'application/json', ...options?.headers },- body: JSON.stringify(removeParticipantsRequest),- });-- const body = [204, 205, 304].includes(res.status) ? null : await res.text();-- const data: removeParticipantsResponse['data'] = body ? JSON.parse(body) : {};- return {- data,- status: res.status,- headers: res.headers,- } as removeParticipantsResponse;-};--export type postReactionResponse201 = {- data: string;- status: 201;-};--export type postReactionResponse401 = {- data: string;- status: 401;-};--export type postReactionResponse404 = {- data: string;- status: 404;-};--export type postReactionResponse500 = {- data: string;- status: 500;-};--export type postReactionResponseSuccess = postReactionResponse201 & {- headers: Headers;-};-export type postReactionResponseError = (- | postReactionResponse401- | postReactionResponse404- | postReactionResponse500-) & {- headers: Headers;-};--export type postReactionResponse =- | postReactionResponseSuccess- | postReactionResponseError;--export const getPostReactionUrl = (channelId: string) => {- return `/comms/channels/${channelId}/reaction`;-};--export const postReaction = async (- channelId: string,- postReactionRequest: PostReactionRequest,- options?: RequestInit-): Promise<postReactionResponse> => {- const res = await fetch(getPostReactionUrl(channelId), {- ...options,- method: 'POST',- headers: { 'Content-Type': 'application/json', ...options?.headers },- body: JSON.stringify(postReactionRequest),- });-- const body = [204, 205, 304].includes(res.status) ? null : await res.text();-- const data: postReactionResponse['data'] = body ? JSON.parse(body) : {};- return {- data,- status: res.status,- headers: res.headers,- } as postReactionResponse;-};--export type postTypingResponse201 = {- data: string;- status: 201;-};--export type postTypingResponse401 = {- data: string;- status: 401;-};--export type postTypingResponse404 = {- data: string;- status: 404;-};--export type postTypingResponse500 = {- data: string;- status: 500;-};--export type postTypingResponseSuccess = postTypingResponse201 & {- headers: Headers;-};-export type postTypingResponseError = (- | postTypingResponse401- | postTypingResponse404- | postTypingResponse500-) & {- headers: Headers;-};--export type postTypingResponse =- | postTypingResponseSuccess- | postTypingResponseError;--export const getPostTypingUrl = (channelId: string) => {- return `/comms/channels/${channelId}/typing`;-};--export const postTyping = async (- channelId: string,- postTypingRequest: PostTypingRequest,- options?: RequestInit-): Promise<postTypingResponse> => {- const res = await fetch(getPostTypingUrl(channelId), {- ...options,- method: 'POST',- headers: { 'Content-Type': 'application/json', ...options?.headers },- body: JSON.stringify(postTypingRequest),- });-- const body = [204, 205, 304].includes(res.status) ? null : await res.text();-- const data: postTypingResponse['data'] = body ? JSON.parse(body) : {};- return {- data,- status: res.status,- headers: res.headers,- } as postTypingResponse;-};--export type createMentionHandlerResponse201 = {- data: CreateEntityMentionResponse;- status: 201;-};--export type createMentionHandlerResponse400 = {- data: void;- status: 400;-};--export type createMentionHandlerResponse500 = {- data: void;- status: 500;-};--export type createMentionHandlerResponseSuccess =- createMentionHandlerResponse201 & {- headers: Headers;- };-export type createMentionHandlerResponseError = (- | createMentionHandlerResponse400- | createMentionHandlerResponse500-) & {- headers: Headers;-};--export type createMentionHandlerResponse =- | createMentionHandlerResponseSuccess- | createMentionHandlerResponseError;--export const getCreateMentionHandlerUrl = () => {- return `/comms/mentions`;-};--export const createMentionHandler = async (- createEntityMentionRequest: CreateEntityMentionRequest,- options?: RequestInit-): Promise<createMentionHandlerResponse> => {- const res = await fetch(getCreateMentionHandlerUrl(), {- ...options,- method: 'POST',- headers: { 'Content-Type': 'application/json', ...options?.headers },- body: JSON.stringify(createEntityMentionRequest),- });-- const body = [204, 205, 304].includes(res.status) ? null : await res.text();-- const data: createMentionHandlerResponse['data'] = body- ? JSON.parse(body)- : {};- return {- data,- status: res.status,- headers: res.headers,- } as createMentionHandlerResponse;-};--export type deleteMentionHandlerResponse200 = {- data: DeleteEntityMentionResponse;- status: 200;-};--export type deleteMentionHandlerResponse400 = {- data: void;- status: 400;-};--export type deleteMentionHandlerResponse403 = {- data: void;- status: 403;-};--export type deleteMentionHandlerResponse404 = {- data: void;- status: 404;-};--export type deleteMentionHandlerResponse500 = {- data: void;- status: 500;-};--export type deleteMentionHandlerResponseSuccess =- deleteMentionHandlerResponse200 & {- headers: Headers;- };-export type deleteMentionHandlerResponseError = (- | deleteMentionHandlerResponse400- | deleteMentionHandlerResponse403- | deleteMentionHandlerResponse404- | deleteMentionHandlerResponse500-) & {- headers: Headers;-};--export type deleteMentionHandlerResponse =- | deleteMentionHandlerResponseSuccess- | deleteMentionHandlerResponseError;--export const getDeleteMentionHandlerUrl = (mentionId: string) => {- return `/comms/mentions/${mentionId}`;-};--export const deleteMentionHandler = async (- mentionId: string,- options?: RequestInit-): Promise<deleteMentionHandlerResponse> => {- const res = await fetch(getDeleteMentionHandlerUrl(mentionId), {- ...options,- method: 'DELETE',- });-- const body = [204, 205, 304].includes(res.status) ? null : await res.text();-- const data: deleteMentionHandlerResponse['data'] = body- ? JSON.parse(body)- : {};- return {- data,- status: res.status,- headers: res.headers,- } as deleteMentionHandlerResponse;-};--export type getBatchChannelPreviewResponse200 = {- data: GetBatchChannelPreviewResponse;- status: 200;-};--export type getBatchChannelPreviewResponse401 = {- data: GenericErrorResponse;- status: 401;-};--export type getBatchChannelPreviewResponse404 = {- data: GenericErrorResponse;- status: 404;-};--export type getBatchChannelPreviewResponse500 = {- data: GenericErrorResponse;- status: 500;-};--export type getBatchChannelPreviewResponseSuccess =- getBatchChannelPreviewResponse200 & {- headers: Headers;- };-export type getBatchChannelPreviewResponseError = (- | getBatchChannelPreviewResponse401- | getBatchChannelPreviewResponse404- | getBatchChannelPreviewResponse500-) & {- headers: Headers;-};--export type getBatchChannelPreviewResponse =- | getBatchChannelPreviewResponseSuccess- | getBatchChannelPreviewResponseError;--export const getGetBatchChannelPreviewUrl = () => {- return `/comms/preview`;-};--export const getBatchChannelPreview = async (- getBatchChannelPreviewRequest: GetBatchChannelPreviewRequest,- options?: RequestInit-): Promise<getBatchChannelPreviewResponse> => {- const res = await fetch(getGetBatchChannelPreviewUrl(), {- ...options,- method: 'POST',- headers: { 'Content-Type': 'application/json', ...options?.headers },- body: JSON.stringify(getBatchChannelPreviewRequest),- });-- const body = [204, 205, 304].includes(res.status) ? null : await res.text();-- const data: getBatchChannelPreviewResponse['data'] = body- ? JSON.parse(body)- : {};- return {- data,- status: res.status,- headers: res.headers,- } as getBatchChannelPreviewResponse;-};diff --git a/js/app/packages/service-clients/service-comms/generated/models/activity.ts b/js/app/packages/service-clients/service-comms/generated/models/activity.tsdeleted file mode 100644index 28cb0cf99f..0000000000--- a/js/app/packages/service-clients/service-comms/generated/models/activity.ts+++ /dev/null@@ -1,24 +0,0 @@-/**- * Generated by orval v7.21.0 🍺- * Do not edit manually.- * comms_service- * OpenAPI spec version: 0.1.0- */-import type { ActivityInteractedAt } from './activityInteractedAt';-import type { ActivityViewedAt } from './activityViewedAt';--/**- * Represents a user's activity in a channel- */-export interface Activity {- channel_id: string;- created_at: string;- id: string;- /** the last time the user intereacted with the channel-eg. reacting, replying, sending a message */- interacted_at?: ActivityInteractedAt;- updated_at: string;- user_id: string;- /** the last time the user viewed the channel */- viewed_at?: ActivityViewedAt;-}diff --git a/js/app/packages/service-clients/service-comms/generated/models/activityInteractedAt.ts b/js/app/packages/service-clients/service-comms/generated/models/activityInteractedAt.tsdeleted file mode 100644index c4b7ea499d..0000000000--- a/js/app/packages/service-clients/service-comms/generated/models/activityInteractedAt.ts+++ /dev/null@@ -1,12 +0,0 @@-/**- * Generated by orval v7.21.0 🍺- * Do not edit manually.- * comms_service- * OpenAPI spec version: 0.1.0- */--/**- * the last time the user intereacted with the channel-eg. reacting, replying, sending a message- */-export type ActivityInteractedAt = string | null;diff --git a/js/app/packages/service-clients/service-comms/generated/models/activityType.ts b/js/app/packages/service-clients/service-comms/generated/models/activityType.tsdeleted file mode 100644index de0981d87c..0000000000--- a/js/app/packages/service-clients/service-comms/generated/models/activityType.ts+++ /dev/null@@ -1,14 +0,0 @@-/**- * Generated by orval v7.21.0 🍺- * Do not edit manually.- * comms_service- * OpenAPI spec version: 0.1.0- */--export type ActivityType = (typeof ActivityType)[keyof typeof ActivityType];--// eslint-disable-next-line @typescript-eslint/no-redeclare-export const ActivityType = {- view: 'view',- interact: 'interact',-} as const;diff --git a/js/app/packages/service-clients/service-comms/generated/models/activityViewedAt.ts b/js/app/packages/service-clients/service-comms/generated/models/activityViewedAt.tsdeleted file mode 100644index 884ac2c03b..0000000000--- a/js/app/packages/service-clients/service-comms/generated/models/activityViewedAt.ts+++ /dev/null@@ -1,11 +0,0 @@-/**- * Generated by orval v7.21.0 🍺- * Do not edit manually.- * comms_service- * OpenAPI spec version: 0.1.0- */--/**- * the last time the user viewed the channel- */-export type ActivityViewedAt = string | null;diff --git a/js/app/packages/service-clients/service-comms/generated/models/addParticipantsRequest.ts b/js/app/packages/service-clients/service-comms/generated/models/addParticipantsRequest.tsdeleted file mode 100644index 8b49d47684..0000000000--- a/js/app/packages/service-clients/service-comms/generated/models/addParticipantsRequest.ts+++ /dev/null@@ -1,10 +0,0 @@-/**- * Generated by orval v7.21.0 🍺- * Do not edit manually.- * comms_service- * OpenAPI spec version: 0.1.0- */--export interface AddParticipantsRequest {- participants: string[];-}diff --git a/js/app/packages/service-clients/service-comms/generated/models/apiActivity.ts b/js/app/packages/service-clients/service-comms/generated/models/apiActivity.tsdeleted file mode 100644index 00e297cf4b..0000000000--- a/js/app/packages/service-clients/service-comms/generated/models/apiActivity.ts+++ /dev/null@@ -1,21 +0,0 @@-/**- * Generated by orval v7.21.0 🍺- * Do not edit manually.- * comms_service- * OpenAPI spec version: 0.1.0- */-import type { ApiActivityInteractedAt } from './apiActivityInteractedAt';-import type { ApiActivityViewedAt } from './apiActivityViewedAt';--export interface ApiActivity {- channel_id: string;- created_at: string;- id: string;- /** the last time the user intereacted with the channel-eg. reacting, replying, sending a message */- interacted_at?: ApiActivityInteractedAt;- updated_at: string;- user_id: string;- /** the last time the user viewed the channel */- viewed_at?: ApiActivityViewedAt;-}diff --git a/js/app/packages/service-clients/service-comms/generated/models/apiActivityInteractedAt.ts b/js/app/packages/service-clients/service-comms/generated/models/apiActivityInteractedAt.tsdeleted file mode 100644index 07b6401cb7..0000000000--- a/js/app/packages/service-clients/service-comms/generated/models/apiActivityInteractedAt.ts+++ /dev/null@@ -1,12 +0,0 @@-/**- * Generated by orval v7.21.0 🍺- * Do not edit manually.- * comms_service- * OpenAPI spec version: 0.1.0- */--/**- * the last time the user intereacted with the channel-eg. reacting, replying, sending a message- */-export type ApiActivityInteractedAt = string | null;diff --git a/js/app/packages/service-clients/service-comms/generated/models/apiActivityViewedAt.ts b/js/app/packages/service-clients/service-comms/generated/models/apiActivityViewedAt.tsdeleted file mode 100644index 076c2e60be..0000000000--- a/js/app/packages/service-clients/service-comms/generated/models/apiActivityViewedAt.ts+++ /dev/null@@ -1,11 +0,0 @@-/**- * Generated by orval v7.21.0 🍺- * Do not edit manually.- * comms_service- * OpenAPI spec version: 0.1.0- */--/**- * the last time the user viewed the channel- */-export type ApiActivityViewedAt = string | null;diff --git a/js/app/packages/service-clients/service-comms/generated/models/apiChannelWithLatest.ts b/js/app/packages/service-clients/service-comms/generated/models/apiChannelWithLatest.tsdeleted file mode 100644index 24762b08b0..0000000000--- a/js/app/packages/service-clients/service-comms/generated/models/apiChannelWithLatest.ts+++ /dev/null@@ -1,14 +0,0 @@-/**- * Generated by orval v7.21.0 🍺- * Do not edit manually.- * comms_service- * OpenAPI spec version: 0.1.0- */--import type { ApiChannelWithLatestAllOf } from './apiChannelWithLatestAllOf';-import type { ChannelWithParticipants } from './channelWithParticipants';-import type { LatestMessage } from './latestMessage';--export type ApiChannelWithLatest = ChannelWithParticipants &- LatestMessage &- ApiChannelWithLatestAllOf;diff --git a/js/app/packages/service-clients/service-comms/generated/models/apiChannelWithLatestAllOf.ts b/js/app/packages/service-clients/service-comms/generated/models/apiChannelWithLatestAllOf.tsdeleted file mode 100644index 8754cdf55a..0000000000--- a/js/app/packages/service-clients/service-comms/generated/models/apiChannelWithLatestAllOf.ts+++ /dev/null@@ -1,15 +0,0 @@-/**- * Generated by orval v7.21.0 🍺- * Do not edit manually.- * comms_service- * OpenAPI spec version: 0.1.0- */-import type { ApiChannelWithLatestAllOfFrecencyScore } from './apiChannelWithLatestAllOfFrecencyScore';-import type { ApiChannelWithLatestAllOfInteractedAt } from './apiChannelWithLatestAllOfInteractedAt';-import type { ApiChannelWithLatestAllOfViewedAt } from './apiChannelWithLatestAllOfViewedAt';--export type ApiChannelWithLatestAllOf = {- frecency_score?: ApiChannelWithLatestAllOfFrecencyScore;- interacted_at?: ApiChannelWithLatestAllOfInteractedAt;- viewed_at?: ApiChannelWithLatestAllOfViewedAt;-};diff --git a/js/app/packages/service-clients/service-comms/generated/models/apiChannelWithLatestAllOfFrecencyScore.ts b/js/app/packages/service-clients/service-comms/generated/models/apiChannelWithLatestAllOfFrecencyScore.tsdeleted file mode 100644index d87ae63af0..0000000000--- a/js/app/packages/service-clients/service-comms/generated/models/apiChannelWithLatestAllOfFrecencyScore.ts+++ /dev/null@@ -1,8 +0,0 @@-/**- * Generated by orval v7.21.0 🍺- * Do not edit manually.- * comms_service- * OpenAPI spec version: 0.1.0- */--export type ApiChannelWithLatestAllOfFrecencyScore = number | null;diff --git a/js/app/packages/service-clients/service-comms/generated/models/apiChannelWithLatestAllOfInteractedAt.ts b/js/app/packages/service-clients/service-comms/generated/models/apiChannelWithLatestAllOfInteractedAt.tsdeleted file mode 100644index 78153490fb..0000000000--- a/js/app/packages/service-clients/service-comms/generated/models/apiChannelWithLatestAllOfInteractedAt.ts+++ /dev/null@@ -1,8 +0,0 @@-/**- * Generated by orval v7.21.0 🍺- * Do not edit manually.- * comms_service- * OpenAPI spec version: 0.1.0- */--export type ApiChannelWithLatestAllOfInteractedAt = string | null;diff --git a/js/app/packages/service-clients/service-comms/generated/models/apiChannelWithLatestAllOfViewedAt.ts b/js/app/packages/service-clients/service-comms/generated/models/apiChannelWithLatestAllOfViewedAt.tsdeleted file mode 100644index f207e77eae..0000000000--- a/js/app/packages/service-clients/service-comms/generated/models/apiChannelWithLatestAllOfViewedAt.ts+++ /dev/null@@ -1,8 +0,0 @@-/**- * Generated by orval v7.21.0 🍺- * Do not edit manually.- * comms_service- * OpenAPI spec version: 0.1.0- */--export type ApiChannelWithLatestAllOfViewedAt = string | null;diff --git a/js/app/packages/service-clients/service-comms/generated/models/attachment.ts b/js/app/packages/service-clients/service-comms/generated/models/attachment.tsdeleted file mode 100644index f026f0c149..0000000000--- a/js/app/packages/service-clients/service-comms/generated/models/attachment.ts+++ /dev/null@@ -1,20 +0,0 @@-/**- * Generated by orval v7.21.0 🍺- * Do not edit manually.- * comms_service- * OpenAPI spec version: 0.1.0- */-import type { AttachmentHeight } from './attachmentHeight';-import type { AttachmentWidth } from './attachmentWidth';--export interface Attachment {- channel_id: string;- created_at: string;- entity_id: string;- entity_type: string;- height?: AttachmentHeight;- id: string;- message_id: string;- /** dimensions of image/video */- width?: AttachmentWidth;-}diff --git a/js/app/packages/service-clients/service-comms/generated/models/attachmentHeight.ts b/js/app/packages/service-clients/service-comms/generated/models/attachmentHeight.tsdeleted file mode 100644index ec6786c311..0000000000--- a/js/app/packages/service-clients/service-comms/generated/models/attachmentHeight.ts+++ /dev/null@@ -1,8 +0,0 @@-/**- * Generated by orval v7.21.0 🍺- * Do not edit manually.- * comms_service- * OpenAPI spec version: 0.1.0- */--export type AttachmentHeight = number | null;diff --git a/js/app/packages/service-clients/service-comms/generated/models/attachmentWidth.ts b/js/app/packages/service-clients/service-comms/generated/models/attachmentWidth.tsdeleted file mode 100644index 88883f103b..0000000000--- a/js/app/packages/service-clients/service-comms/generated/models/attachmentWidth.ts+++ /dev/null@@ -1,11 +0,0 @@-/**- * Generated by orval v7.21.0 🍺- * Do not edit manually.- * comms_service- * OpenAPI spec version: 0.1.0- */--/**- * dimensions of image/video- */-export type AttachmentWidth = number | null;diff --git a/js/app/packages/service-clients/service-comms/generated/models/channel.ts b/js/app/packages/service-clients/service-comms/generated/models/channel.tsdeleted file mode 100644index 1082e906d7..0000000000--- a/js/app/packages/service-clients/service-comms/generated/models/channel.ts+++ /dev/null@@ -1,30 +0,0 @@-/**- * Generated by orval v7.21.0 🍺- * Do not edit manually.- * comms_service- * OpenAPI spec version: 0.1.0- */--import type { ChannelName } from './channelName';-import type { ChannelOrgId } from './channelOrgId';-import type { ChannelType } from './channelType';--export interface Channel {- /** type of the channel */- channel_type: ChannelType;- /** timestamp of when the channel was created */- created_at: string;- /** uuid of the channel */- id: string;- /** string name of the channel */- name?: ChannelName;- /**- * id of the organization this channel belongs too- * @minimum 0- */- org_id?: ChannelOrgId;- /** id of the user who created the channel */- owner_id: string;- /** timestamp of when the channel was last updated */- updated_at: string;-}diff --git a/js/app/packages/service-clients/service-comms/generated/models/channelMessage.ts b/js/app/packages/service-clients/service-comms/generated/models/channelMessage.tsdeleted file mode 100644index 4ef1a48daa..0000000000--- a/js/app/packages/service-clients/service-comms/generated/models/channelMessage.ts+++ /dev/null@@ -1,20 +0,0 @@-/**- * Generated by orval v7.21.0 🍺- * Do not edit manually.- * comms_service- * OpenAPI spec version: 0.1.0- */-import type { ChannelMessageDeletedAt } from './channelMessageDeletedAt';-import type { ChannelMessageThreadId } from './channelMessageThreadId';--export interface ChannelMessage {- content: string;- created_at: string;- deleted_at?: ChannelMessageDeletedAt;- /** message mentions formatted as `{ENTITY_TYPE}:{ENTITY_ID}` */- mentions: string[];- message_id: string;- sender_id: string;- thread_id?: ChannelMessageThreadId;- updated_at: string;-}diff --git a/js/app/packages/service-clients/service-comms/generated/models/channelMessageDeletedAt.ts b/js/app/packages/service-clients/service-comms/generated/models/channelMessageDeletedAt.tsdeleted file mode 100644index 0e147a324b..0000000000--- a/js/app/packages/service-clients/service-comms/generated/models/channelMessageDeletedAt.ts+++ /dev/null@@ -1,8 +0,0 @@-/**- * Generated by orval v7.21.0 🍺- * Do not edit manually.- * comms_service- * OpenAPI spec version: 0.1.0- */--export type ChannelMessageDeletedAt = string | null;diff --git a/js/app/packages/service-clients/service-comms/generated/models/channelMessageThreadId.ts b/js/app/packages/service-clients/service-comms/generated/models/channelMessageThreadId.tsdeleted file mode 100644index 4ffb444358..0000000000--- a/js/app/packages/service-clients/service-comms/generated/models/channelMessageThreadId.ts+++ /dev/null@@ -1,8 +0,0 @@-/**- * Generated by orval v7.21.0 🍺- * Do not edit manually.- * comms_service- * OpenAPI spec version: 0.1.0- */--export type ChannelMessageThreadId = string | null;diff --git a/js/app/packages/service-clients/service-comms/generated/models/channelName.ts b/js/app/packages/service-clients/service-comms/generated/models/channelName.tsdeleted file mode 100644index 03f66a0ab9..0000000000--- a/js/app/packages/service-clients/service-comms/generated/models/channelName.ts+++ /dev/null@@ -1,11 +0,0 @@-/**- * Generated by orval v7.21.0 🍺- * Do not edit manually.- * comms_service- * OpenAPI spec version: 0.1.0- */--/**- * string name of the channel- */-export type ChannelName = string | null;diff --git a/js/app/packages/service-clients/service-comms/generated/models/channelOrgId.ts b/js/app/packages/service-clients/service-comms/generated/models/channelOrgId.tsdeleted file mode 100644index b1c2383002..0000000000--- a/js/app/packages/service-clients/service-comms/generated/models/channelOrgId.ts+++ /dev/null@@ -1,12 +0,0 @@-/**- * Generated by orval v7.21.0 🍺- * Do not edit manually.- * comms_service- * OpenAPI spec version: 0.1.0- */--/**- * id of the organization this channel belongs too- * @minimum 0- */-export type ChannelOrgId = number | null;diff --git a/js/app/packages/service-clients/service-comms/generated/models/channelParticipant.ts b/js/app/packages/service-clients/service-comms/generated/models/channelParticipant.tsdeleted file mode 100644index 3e8acfb01c..0000000000--- a/js/app/packages/service-clients/service-comms/generated/models/channelParticipant.ts+++ /dev/null@@ -1,21 +0,0 @@-/**- * Generated by orval v7.21.0 🍺- * Do not edit manually.- * comms_service- * OpenAPI spec version: 0.1.0- */-import type { ChannelParticipantLeftAt } from './channelParticipantLeftAt';-import type { ParticipantRole } from './participantRole';--export interface ChannelParticipant {- /** id of the channel */- channel_id: string;- /** timestamp of when the user joined the channel */- joined_at: string;- /** timestamp of when the user left the channel */- left_at?: ChannelParticipantLeftAt;- /** type of the participant */- role: ParticipantRole;- /** id of the user */- user_id: string;-}diff --git a/js/app/packages/service-clients/service-comms/generated/models/channelParticipantLeftAt.ts b/js/app/packages/service-clients/service-comms/generated/models/channelParticipantLeftAt.tsdeleted file mode 100644index abc767f166..0000000000--- a/js/app/packages/service-clients/service-comms/generated/models/channelParticipantLeftAt.ts+++ /dev/null@@ -1,11 +0,0 @@-/**- * Generated by orval v7.21.0 🍺- * Do not edit manually.- * comms_service- * OpenAPI spec version: 0.1.0- */--/**- * timestamp of when the user left the channel- */-export type ChannelParticipantLeftAt = string | null;diff --git a/js/app/packages/service-clients/service-comms/generated/models/channelPreview.ts b/js/app/packages/service-clients/service-comms/generated/models/channelPreview.tsdeleted file mode 100644index e4f1883ab6..0000000000--- a/js/app/packages/service-clients/service-comms/generated/models/channelPreview.ts+++ /dev/null@@ -1,14 +0,0 @@-/**- * Generated by orval v7.21.0 🍺- * Do not edit manually.- * comms_service- * OpenAPI spec version: 0.1.0- */-import type { ChannelPreviewOneOf } from './channelPreviewOneOf';-import type { ChannelPreviewOneOfFour } from './channelPreviewOneOfFour';-import type { ChannelPreviewOneOfSeven } from './channelPreviewOneOfSeven';--export type ChannelPreview =- | ChannelPreviewOneOf- | ChannelPreviewOneOfFour- | ChannelPreviewOneOfSeven;diff --git a/js/app/packages/service-clients/service-comms/generated/models/channelPreviewData.ts b/js/app/packages/service-clients/service-comms/generated/models/channelPreviewData.tsdeleted file mode 100644index b0def26fbf..0000000000--- a/js/app/packages/service-clients/service-comms/generated/models/channelPreviewData.ts+++ /dev/null@@ -1,13 +0,0 @@-/**- * Generated by orval v7.21.0 🍺- * Do not edit manually.- * comms_service- * OpenAPI spec version: 0.1.0- */-import type { ChannelType } from './channelType';--export interface ChannelPreviewData {- channel_id: string;- channel_name: string;- channel_type: ChannelType;-}diff --git a/js/app/packages/service-clients/service-comms/generated/models/channelPreviewOneOf.ts b/js/app/packages/service-clients/service-comms/generated/models/channelPreviewOneOf.tsdeleted file mode 100644index 706237e21c..0000000000--- a/js/app/packages/service-clients/service-comms/generated/models/channelPreviewOneOf.ts+++ /dev/null@@ -1,10 +0,0 @@-/**- * Generated by orval v7.21.0 🍺- * Do not edit manually.- * comms_service- * OpenAPI spec version: 0.1.0- */-import type { ChannelPreviewData } from './channelPreviewData';-import type { ChannelPreviewOneOfAllOf } from './channelPreviewOneOfAllOf';--export type ChannelPreviewOneOf = ChannelPreviewData & ChannelPreviewOneOfAllOf;diff --git a/js/app/packages/service-clients/service-comms/generated/models/channelPreviewOneOfAllOf.ts b/js/app/packages/service-clients/service-comms/generated/models/channelPreviewOneOfAllOf.tsdeleted file mode 100644index f49e2546fd..0000000000--- a/js/app/packages/service-clients/service-comms/generated/models/channelPreviewOneOfAllOf.ts+++ /dev/null@@ -1,11 +0,0 @@-/**- * Generated by orval v7.21.0 🍺- * Do not edit manually.- * comms_service- * OpenAPI spec version: 0.1.0- */-import type { ChannelPreviewOneOfAllOfType } from './channelPreviewOneOfAllOfType';--export type ChannelPreviewOneOfAllOf = {- type: ChannelPreviewOneOfAllOfType;-};diff --git a/js/app/packages/service-clients/service-comms/generated/models/channelPreviewOneOfAllOfType.ts b/js/app/packages/service-clients/service-comms/generated/models/channelPreviewOneOfAllOfType.tsdeleted file mode 100644index 3b90bf3263..0000000000--- a/js/app/packages/service-clients/service-comms/generated/models/channelPreviewOneOfAllOfType.ts+++ /dev/null@@ -1,14 +0,0 @@-/**- * Generated by orval v7.21.0 🍺- * Do not edit manually.- * comms_service- * OpenAPI spec version: 0.1.0- */--export type ChannelPreviewOneOfAllOfType =- (typeof ChannelPreviewOneOfAllOfType)[keyof typeof ChannelPreviewOneOfAllOfType];--// eslint-disable-next-line @typescript-eslint/no-redeclare-export const ChannelPreviewOneOfAllOfType = {- access: 'access',-} as const;diff --git a/js/app/packages/service-clients/service-comms/generated/models/channelPreviewOneOfFour.ts b/js/app/packages/service-clients/service-comms/generated/models/channelPreviewOneOfFour.tsdeleted file mode 100644index 77fd9e4f1b..0000000000--- a/js/app/packages/service-clients/service-comms/generated/models/channelPreviewOneOfFour.ts+++ /dev/null@@ -1,12 +0,0 @@-/**- * Generated by orval v7.21.0 🍺- * Do not edit manually.- * comms_service- * OpenAPI spec version: 0.1.0- */--import type { ChannelPreviewOneOfFourAllOf } from './channelPreviewOneOfFourAllOf';-import type { WithChannelId } from './withChannelId';--export type ChannelPreviewOneOfFour = WithChannelId &- ChannelPreviewOneOfFourAllOf;diff --git a/js/app/packages/service-clients/service-comms/generated/models/channelPreviewOneOfFourAllOf.ts b/js/app/packages/service-clients/service-comms/generated/models/channelPreviewOneOfFourAllOf.tsdeleted file mode 100644index dd9f677759..0000000000--- a/js/app/packages/service-clients/service-comms/generated/models/channelPreviewOneOfFourAllOf.ts+++ /dev/null@@ -1,11 +0,0 @@-/**- * Generated by orval v7.21.0 🍺- * Do not edit manually.- * comms_service- * OpenAPI spec version: 0.1.0- */-import type { ChannelPreviewOneOfFourAllOfType } from './channelPreviewOneOfFourAllOfType';--export type ChannelPreviewOneOfFourAllOf = {- type: ChannelPreviewOneOfFourAllOfType;-};diff --git a/js/app/packages/service-clients/service-comms/generated/models/channelPreviewOneOfFourAllOfType.ts b/js/app/packages/service-clients/service-comms/generated/models/channelPreviewOneOfFourAllOfType.tsdeleted file mode 100644index 933f9e8875..0000000000--- a/js/app/packages/service-clients/service-comms/generated/models/channelPreviewOneOfFourAllOfType.ts+++ /dev/null@@ -1,14 +0,0 @@-/**- * Generated by orval v7.21.0 🍺- * Do not edit manually.- * comms_service- * OpenAPI spec version: 0.1.0- */--export type ChannelPreviewOneOfFourAllOfType =- (typeof ChannelPreviewOneOfFourAllOfType)[keyof typeof ChannelPreviewOneOfFourAllOfType];--// eslint-disable-next-line @typescript-eslint/no-redeclare-export const ChannelPreviewOneOfFourAllOfType = {- no_access: 'no_access',-} as const;diff --git a/js/app/packages/service-clients/service-comms/generated/models/channelPreviewOneOfSeven.ts b/js/app/packages/service-clients/service-comms/generated/models/channelPreviewOneOfSeven.tsdeleted file mode 100644index 1ab319fe4a..0000000000--- a/js/app/packages/service-clients/service-comms/generated/models/channelPreviewOneOfSeven.ts+++ /dev/null@@ -1,12 +0,0 @@-/**- * Generated by orval v7.21.0 🍺- * Do not edit manually.- * comms_service- * OpenAPI spec version: 0.1.0- */--import type { ChannelPreviewOneOfSevenAllOf } from './channelPreviewOneOfSevenAllOf';-import type { WithChannelId } from './withChannelId';--export type ChannelPreviewOneOfSeven = WithChannelId &- ChannelPreviewOneOfSevenAllOf;diff --git a/js/app/packages/service-clients/service-comms/generated/models/channelPreviewOneOfSevenAllOf.ts b/js/app/packages/service-clients/service-comms/generated/models/channelPreviewOneOfSevenAllOf.tsdeleted file mode 100644index c4b61cab41..0000000000--- a/js/app/packages/service-clients/service-comms/generated/models/channelPreviewOneOfSevenAllOf.ts+++ /dev/null@@ -1,11 +0,0 @@-/**- * Generated by orval v7.21.0 🍺- * Do not edit manually.- * comms_service- * OpenAPI spec version: 0.1.0- */-import type { ChannelPreviewOneOfSevenAllOfType } from './channelPreviewOneOfSevenAllOfType';--export type ChannelPreviewOneOfSevenAllOf = {- type: ChannelPreviewOneOfSevenAllOfType;-};diff --git a/js/app/packages/service-clients/service-comms/generated/models/channelPreviewOneOfSevenAllOfType.ts b/js/app/packages/service-clients/service-comms/generated/models/channelPreviewOneOfSevenAllOfType.tsdeleted file mode 100644index f40968bb49..0000000000--- a/js/app/packages/service-clients/service-comms/generated/models/channelPreviewOneOfSevenAllOfType.ts+++ /dev/null@@ -1,14 +0,0 @@-/**- * Generated by orval v7.21.0 🍺- * Do not edit manually.- * comms_service- * OpenAPI spec version: 0.1.0- */--export type ChannelPreviewOneOfSevenAllOfType =- (typeof ChannelPreviewOneOfSevenAllOfType)[keyof typeof ChannelPreviewOneOfSevenAllOfType];--// eslint-disable-next-line @typescript-eslint/no-redeclare-export const ChannelPreviewOneOfSevenAllOfType = {- does_not_exist: 'does_not_exist',-} as const;diff --git a/js/app/packages/service-clients/service-comms/generated/models/channelReference.ts b/js/app/packages/service-clients/service-comms/generated/models/channelReference.tsdeleted file mode 100644index fd13961b00..0000000000--- a/js/app/packages/service-clients/service-comms/generated/models/channelReference.ts+++ /dev/null@@ -1,31 +0,0 @@-/**- * Generated by orval v7.21.0 🍺- * Do not edit manually.- * comms_service- * OpenAPI spec version: 0.1.0- */-import type { ChannelReferenceChannelName } from './channelReferenceChannelName';-import type { ChannelReferenceThreadId } from './channelReferenceThreadId';--/**- * Representation of a reference from a channel/message- */-export interface ChannelReference {- /** When the attachment row was created (normally identical to message-creation, but stored separately just in case) */- attachment_created_at: string;- /** Channel that contains the message */- channel_id: string;- /** Optional channel name (DMs do not have a name) */- channel_name?: ChannelReferenceChannelName;- /** Full message content (might be used for preview/snippet) */- message_content: string;- /** When the message itself was created */- message_created_at: string;- /** Message that contains the attachment reference */- message_id: string;- /** Sender of the message */- sender_id: string;- /** If the message belongs to a thread this is the parent id */- thread_id?: ChannelReferenceThreadId;-}diff --git a/js/app/packages/service-clients/service-comms/generated/models/channelReferenceChannelName.ts b/js/app/packages/service-clients/service-comms/generated/models/channelReferenceChannelName.tsdeleted file mode 100644index d99c83bae8..0000000000--- a/js/app/packages/service-clients/service-comms/generated/models/channelReferenceChannelName.ts+++ /dev/null@@ -1,11 +0,0 @@-/**- * Generated by orval v7.21.0 🍺- * Do not edit manually.- * comms_service- * OpenAPI spec version: 0.1.0- */--/**- * Optional channel name (DMs do not have a name)- */-export type ChannelReferenceChannelName = string | null;diff --git a/js/app/packages/service-clients/service-comms/generated/models/channelReferenceThreadId.ts b/js/app/packages/service-clients/service-comms/generated/models/channelReferenceThreadId.tsdeleted file mode 100644index 16fb3467b1..0000000000--- a/js/app/packages/service-clients/service-comms/generated/models/channelReferenceThreadId.ts+++ /dev/null@@ -1,11 +0,0 @@-/**- * Generated by orval v7.21.0 🍺- * Do not edit manually.- * comms_service- * OpenAPI spec version: 0.1.0- */--/**- * If the message belongs to a thread this is the parent id- */-export type ChannelReferenceThreadId = string | null;diff --git a/js/app/packages/service-clients/service-comms/generated/models/channelType.ts b/js/app/packages/service-clients/service-comms/generated/models/channelType.tsdeleted file mode 100644index 24941a645d..0000000000--- a/js/app/packages/service-clients/service-comms/generated/models/channelType.ts+++ /dev/null@@ -1,17 +0,0 @@-/**- * Generated by orval v7.21.0 🍺- * Do not edit manually.- * comms_service- * OpenAPI spec version: 0.1.0- */--export type ChannelType = (typeof ChannelType)[keyof typeof ChannelType];--// eslint-disable-next-line @typescript-eslint/no-redeclare-export const ChannelType = {- public: 'public',- organization: 'organization',- private: 'private',- direct_message: 'direct_message',- team: 'team',-} as const;diff --git a/js/app/packages/service-clients/service-comms/generated/models/channelWithParticipants.ts b/js/app/packages/service-clients/service-comms/generated/models/channelWithParticipants.tsdeleted file mode 100644index 53b57dae15..0000000000--- a/js/app/packages/service-clients/service-comms/generated/models/channelWithParticipants.ts+++ /dev/null@@ -1,10 +0,0 @@-/**- * Generated by orval v7.21.0 🍺- * Do not edit manually.- * comms_service- * OpenAPI spec version: 0.1.0- */-import type { Channel } from './channel';-import type { ChannelWithParticipantsAllOf } from './channelWithParticipantsAllOf';--export type ChannelWithParticipants = Channel & ChannelWithParticipantsAllOf;diff --git a/js/app/packages/service-clients/service-comms/generated/models/channelWithParticipantsAllOf.ts b/js/app/packages/service-clients/service-comms/generated/models/channelWithParticipantsAllOf.tsdeleted file mode 100644index 2b68c7a9e1..0000000000--- a/js/app/packages/service-clients/service-comms/generated/models/channelWithParticipantsAllOf.ts+++ /dev/null@@ -1,11 +0,0 @@-/**- * Generated by orval v7.21.0 🍺- * Do not edit manually.- * comms_service- * OpenAPI spec version: 0.1.0- */-import type { ChannelParticipant } from './channelParticipant';--export type ChannelWithParticipantsAllOf = {- participants: ChannelParticipant[];-};diff --git a/js/app/packages/service-clients/service-comms/generated/models/communicationServiceApiVersion.ts b/js/app/packages/service-clients/service-comms/generated/models/communicationServiceApiVersion.tsdeleted file mode 100644index 662de4d0d4..0000000000--- a/js/app/packages/service-clients/service-comms/generated/models/communicationServiceApiVersion.ts+++ /dev/null@@ -1,14 +0,0 @@-/**- * Generated by orval v7.21.0 🍺- * Do not edit manually.- * comms_service- * OpenAPI spec version: 0.1.0- */--export type CommunicationServiceApiVersion =- (typeof CommunicationServiceApiVersion)[keyof typeof CommunicationServiceApiVersion];--// eslint-disable-next-line @typescript-eslint/no-redeclare-export const CommunicationServiceApiVersion = {- v1: 'v1',-} as const;diff --git a/js/app/packages/service-clients/service-comms/generated/models/countedReaction.ts b/js/app/packages/service-clients/service-comms/generated/models/countedReaction.tsdeleted file mode 100644index 8c95aa364e..0000000000--- a/js/app/packages/service-clients/service-comms/generated/models/countedReaction.ts+++ /dev/null@@ -1,11 +0,0 @@-/**- * Generated by orval v7.21.0 🍺- * Do not edit manually.- * comms_service- * OpenAPI spec version: 0.1.0- */--export interface CountedReaction {- emoji: string;- users: string[];-}diff --git a/js/app/packages/service-clients/service-comms/generated/models/createChannelRequest.ts b/js/app/packages/service-clients/service-comms/generated/models/createChannelRequest.tsdeleted file mode 100644index 5a3811da4c..0000000000--- a/js/app/packages/service-clients/service-comms/generated/models/createChannelRequest.ts+++ /dev/null@@ -1,20 +0,0 @@-/**- * Generated by orval v7.21.0 🍺- * Do not edit manually.- * comms_service- * OpenAPI spec version: 0.1.0- */-import type { ChannelType } from './channelType';-import type { CreateChannelRequestName } from './createChannelRequestName';-import type { CreateChannelRequestTeamId } from './createChannelRequestTeamId';--export interface CreateChannelRequest {- /** The type of channel */- channel_type: ChannelType;- /** Optionally a name for the channel */- name?: CreateChannelRequestName;- /** list of participants not including the owner */- participants: string[];- /** If the channel_type is team, provide the id of the team you are creating the channel for */- team_id?: CreateChannelRequestTeamId;-}diff --git a/js/app/packages/service-clients/service-comms/generated/models/createChannelRequestName.ts b/js/app/packages/service-clients/service-comms/generated/models/createChannelRequestName.tsdeleted file mode 100644index ccd8c55370..0000000000--- a/js/app/packages/service-clients/service-comms/generated/models/createChannelRequestName.ts+++ /dev/null@@ -1,11 +0,0 @@-/**- * Generated by orval v7.21.0 🍺- * Do not edit manually.- * comms_service- * OpenAPI spec version: 0.1.0- */--/**- * Optionally a name for the channel- */-export type CreateChannelRequestName = string | null;diff --git a/js/app/packages/service-clients/service-comms/generated/models/createChannelRequestTeamId.ts b/js/app/packages/service-clients/service-comms/generated/models/createChannelRequestTeamId.tsdeleted file mode 100644index f5981d36e3..0000000000--- a/js/app/packages/service-clients/service-comms/generated/models/createChannelRequestTeamId.ts+++ /dev/null@@ -1,11 +0,0 @@-/**- * Generated by orval v7.21.0 🍺- * Do not edit manually.- * comms_service- * OpenAPI spec version: 0.1.0- */--/**- * If the channel_type is team, provide the id of the team you are creating the channel for- */-export type CreateChannelRequestTeamId = string | null;diff --git a/js/app/packages/service-clients/service-comms/generated/models/createChannelResponse.ts b/js/app/packages/service-clients/service-comms/generated/models/createChannelResponse.tsdeleted file mode 100644index a5fd3155f0..0000000000--- a/js/app/packages/service-clients/service-comms/generated/models/createChannelResponse.ts+++ /dev/null@@ -1,10 +0,0 @@-/**- * Generated by orval v7.21.0 🍺- * Do not edit manually.- * comms_service- * OpenAPI spec version: 0.1.0- */--export interface CreateChannelResponse {- id: string;-}diff --git a/js/app/packages/service-clients/service-comms/generated/models/createEntityMentionRequest.ts b/js/app/packages/service-clients/service-comms/generated/models/createEntityMentionRequest.tsdeleted file mode 100644index e971dc54fd..0000000000--- a/js/app/packages/service-clients/service-comms/generated/models/createEntityMentionRequest.ts+++ /dev/null@@ -1,13 +0,0 @@-/**- * Generated by orval v7.21.0 🍺- * Do not edit manually.- * comms_service- * OpenAPI spec version: 0.1.0- */--export interface CreateEntityMentionRequest {- entity_id: string;- entity_type: string;- source_entity_id: string;- source_entity_type: string;-}diff --git a/js/app/packages/service-clients/service-comms/generated/models/createEntityMentionResponse.ts b/js/app/packages/service-clients/service-comms/generated/models/createEntityMentionResponse.tsdeleted file mode 100644index 0efac8c663..0000000000--- a/js/app/packages/service-clients/service-comms/generated/models/createEntityMentionResponse.ts+++ /dev/null@@ -1,17 +0,0 @@-/**- * Generated by orval v7.21.0 🍺- * Do not edit manually.- * comms_service- * OpenAPI spec version: 0.1.0- */-import type { CreateEntityMentionResponseUserId } from './createEntityMentionResponseUserId';--export interface CreateEntityMentionResponse {- created_at: string;- entity_id: string;- entity_type: string;- id: string;- source_entity_id: string;- source_entity_type: string;- user_id?: CreateEntityMentionResponseUserId;-}diff --git a/js/app/packages/service-clients/service-comms/generated/models/createEntityMentionResponseUserId.ts b/js/app/packages/service-clients/service-comms/generated/models/createEntityMentionResponseUserId.tsdeleted file mode 100644index e634b34e83..0000000000--- a/js/app/packages/service-clients/service-comms/generated/models/createEntityMentionResponseUserId.ts+++ /dev/null@@ -1,8 +0,0 @@-/**- * Generated by orval v7.21.0 🍺- * Do not edit manually.- * comms_service- * OpenAPI spec version: 0.1.0- */--export type CreateEntityMentionResponseUserId = string | null;diff --git a/js/app/packages/service-clients/service-comms/generated/models/deleteEntityMentionRequest.ts b/js/app/packages/service-clients/service-comms/generated/models/deleteEntityMentionRequest.tsdeleted file mode 100644index 3d6dcea7c0..0000000000--- a/js/app/packages/service-clients/service-comms/generated/models/deleteEntityMentionRequest.ts+++ /dev/null@@ -1,10 +0,0 @@-/**- * Generated by orval v7.21.0 🍺- * Do not edit manually.- * comms_service- * OpenAPI spec version: 0.1.0- */--export interface DeleteEntityMentionRequest {- entity_mention_id: string;-}diff --git a/js/app/packages/service-clients/service-comms/generated/models/deleteEntityMentionResponse.ts b/js/app/packages/service-clients/service-comms/generated/models/deleteEntityMentionResponse.tsdeleted file mode 100644index 20534cb057..0000000000--- a/js/app/packages/service-clients/service-comms/generated/models/deleteEntityMentionResponse.ts+++ /dev/null@@ -1,10 +0,0 @@-/**- * Generated by orval v7.21.0 🍺- * Do not edit manually.- * comms_service- * OpenAPI spec version: 0.1.0- */--export interface DeleteEntityMentionResponse {- deleted: boolean;-}diff --git a/js/app/packages/service-clients/service-comms/generated/models/deleteMessageParams.ts b/js/app/packages/service-clients/service-comms/generated/models/deleteMessageParams.tsdeleted file mode 100644index 4051446cff..0000000000--- a/js/app/packages/service-clients/service-comms/generated/models/deleteMessageParams.ts+++ /dev/null@@ -1,11 +0,0 @@-/**- * Generated by orval v7.21.0 🍺- * Do not edit manually.- * comms_service- * OpenAPI spec version: 0.1.0- */--export interface DeleteMessageParams {- channel_id: string;- message_id: string;-}diff --git a/js/app/packages/service-clients/service-comms/generated/models/entityMention.ts b/js/app/packages/service-clients/service-comms/generated/models/entityMention.tsdeleted file mode 100644index bfb3336669..0000000000--- a/js/app/packages/service-clients/service-comms/generated/models/entityMention.ts+++ /dev/null@@ -1,17 +0,0 @@-/**- * Generated by orval v7.21.0 🍺- * Do not edit manually.- * comms_service- * OpenAPI spec version: 0.1.0- */-import type { EntityMentionUserId } from './entityMentionUserId';--export interface EntityMention {- created_at: string;- entity_id: string;- entity_type: string;- id: string;- source_entity_id: string;- source_entity_type: string;- user_id?: EntityMentionUserId;-}diff --git a/js/app/packages/service-clients/service-comms/generated/models/entityMentionUserId.ts b/js/app/packages/service-clients/service-comms/generated/models/entityMentionUserId.tsdeleted file mode 100644index 9ea486006e..0000000000--- a/js/app/packages/service-clients/service-comms/generated/models/entityMentionUserId.ts+++ /dev/null@@ -1,8 +0,0 @@-/**- * Generated by orval v7.21.0 🍺- * Do not edit manually.- * comms_service- * OpenAPI spec version: 0.1.0- */--export type EntityMentionUserId = string | null;diff --git a/js/app/packages/service-clients/service-comms/generated/models/entityReference.ts b/js/app/packages/service-clients/service-comms/generated/models/entityReference.tsdeleted file mode 100644index fb4deaf4f8..0000000000--- a/js/app/packages/service-clients/service-comms/generated/models/entityReference.ts+++ /dev/null@@ -1,10 +0,0 @@-/**- * Generated by orval v7.21.0 🍺- * Do not edit manually.- * comms_service- * OpenAPI spec version: 0.1.0- */-import type { EntityReferenceOneOf } from './entityReferenceOneOf';-import type { EntityReferenceOneOfFour } from './entityReferenceOneOfFour';--export type EntityReference = EntityReferenceOneOf | EntityReferenceOneOfFour;diff --git a/js/app/packages/service-clients/service-comms/generated/models/entityReferenceOneOf.ts b/js/app/packages/service-clients/service-comms/generated/models/entityReferenceOneOf.tsdeleted file mode 100644index 74c0cdbec3..0000000000--- a/js/app/packages/service-clients/service-comms/generated/models/entityReferenceOneOf.ts+++ /dev/null@@ -1,13 +0,0 @@-/**- * Generated by orval v7.21.0 🍺- * Do not edit manually.- * comms_service- * OpenAPI spec version: 0.1.0- */-import type { ChannelReference } from './channelReference';-import type { EntityReferenceOneOfAllOf } from './entityReferenceOneOfAllOf';--/**- * An entity was referenced from a channel- */-export type EntityReferenceOneOf = ChannelReference & EntityReferenceOneOfAllOf;diff --git a/js/app/packages/service-clients/service-comms/generated/models/entityReferenceOneOfAllOf.ts b/js/app/packages/service-clients/service-comms/generated/models/entityReferenceOneOfAllOf.tsdeleted file mode 100644index 5dfe3f4eb6..0000000000--- a/js/app/packages/service-clients/service-comms/generated/models/entityReferenceOneOfAllOf.ts+++ /dev/null@@ -1,11 +0,0 @@-/**- * Generated by orval v7.21.0 🍺- * Do not edit manually.- * comms_service- * OpenAPI spec version: 0.1.0- */-import type { EntityReferenceOneOfAllOfReferenceType } from './entityReferenceOneOfAllOfReferenceType';--export type EntityReferenceOneOfAllOf = {- reference_type: EntityReferenceOneOfAllOfReferenceType;-};diff --git a/js/app/packages/service-clients/service-comms/generated/models/entityReferenceOneOfAllOfReferenceType.ts b/js/app/packages/service-clients/service-comms/generated/models/entityReferenceOneOfAllOfReferenceType.tsdeleted file mode 100644index 72880e0cd2..0000000000--- a/js/app/packages/service-clients/service-comms/generated/models/entityReferenceOneOfAllOfReferenceType.ts+++ /dev/null@@ -1,14 +0,0 @@-/**- * Generated by orval v7.21.0 🍺- * Do not edit manually.- * comms_service- * OpenAPI spec version: 0.1.0- */--export type EntityReferenceOneOfAllOfReferenceType =- (typeof EntityReferenceOneOfAllOfReferenceType)[keyof typeof EntityReferenceOneOfAllOfReferenceType];--// eslint-disable-next-line @typescript-eslint/no-redeclare-export const EntityReferenceOneOfAllOfReferenceType = {- channel: 'channel',-} as const;diff --git a/js/app/packages/service-clients/service-comms/generated/models/entityReferenceOneOfFour.ts b/js/app/packages/service-clients/service-comms/generated/models/entityReferenceOneOfFour.tsdeleted file mode 100644index c3d1cefccc..0000000000--- a/js/app/packages/service-clients/service-comms/generated/models/entityReferenceOneOfFour.ts+++ /dev/null@@ -1,15 +0,0 @@-/**- * Generated by orval v7.21.0 🍺- * Do not edit manually.- * comms_service- * OpenAPI spec version: 0.1.0- */--import type { EntityReferenceOneOfFourAllOf } from './entityReferenceOneOfFourAllOf';-import type { GenericReference } from './genericReference';--/**- * An entity was referenced from anything but a channel- */-export type EntityReferenceOneOfFour = GenericReference &- EntityReferenceOneOfFourAllOf;diff --git a/js/app/packages/service-clients/service-comms/generated/models/entityReferenceOneOfFourAllOf.ts b/js/app/packages/service-clients/service-comms/generated/models/entityReferenceOneOfFourAllOf.tsdeleted file mode 100644index 80b3fcba10..0000000000--- a/js/app/packages/service-clients/service-comms/generated/models/entityReferenceOneOfFourAllOf.ts+++ /dev/null@@ -1,11 +0,0 @@-/**- * Generated by orval v7.21.0 🍺- * Do not edit manually.- * comms_service- * OpenAPI spec version: 0.1.0- */-import type { EntityReferenceOneOfFourAllOfReferenceType } from './entityReferenceOneOfFourAllOfReferenceType';--export type EntityReferenceOneOfFourAllOf = {- reference_type: EntityReferenceOneOfFourAllOfReferenceType;-};diff --git a/js/app/packages/service-clients/service-comms/generated/models/entityReferenceOneOfFourAllOfReferenceType.ts b/js/app/packages/service-clients/service-comms/generated/models/entityReferenceOneOfFourAllOfReferenceType.tsdeleted file mode 100644index f6590e1bcf..0000000000--- a/js/app/packages/service-clients/service-comms/generated/models/entityReferenceOneOfFourAllOfReferenceType.ts+++ /dev/null@@ -1,14 +0,0 @@-/**- * Generated by orval v7.21.0 🍺- * Do not edit manually.- * comms_service- * OpenAPI spec version: 0.1.0- */--export type EntityReferenceOneOfFourAllOfReferenceType =- (typeof EntityReferenceOneOfFourAllOfReferenceType)[keyof typeof EntityReferenceOneOfFourAllOfReferenceType];--// eslint-disable-next-line @typescript-eslint/no-redeclare-export const EntityReferenceOneOfFourAllOfReferenceType = {- generic: 'generic',-} as const;diff --git a/js/app/packages/service-clients/service-comms/generated/models/genericErrorResponse.ts b/js/app/packages/service-clients/service-comms/generated/models/genericErrorResponse.tsdeleted file mode 100644index 46d20e84bc..0000000000--- a/js/app/packages/service-clients/service-comms/generated/models/genericErrorResponse.ts+++ /dev/null@@ -1,13 +0,0 @@-/**- * Generated by orval v7.21.0 🍺- * Do not edit manually.- * comms_service- * OpenAPI spec version: 0.1.0- */--export interface GenericErrorResponse {- /** Indicates if an error occurred */- error: boolean;- /** Message to explain failure */- message: string;-}diff --git a/js/app/packages/service-clients/service-comms/generated/models/genericReference.ts b/js/app/packages/service-clients/service-comms/generated/models/genericReference.tsdeleted file mode 100644index e0e398aebb..0000000000--- a/js/app/packages/service-clients/service-comms/generated/models/genericReference.ts+++ /dev/null@@ -1,27 +0,0 @@-/**- * Generated by orval v7.21.0 🍺- * Do not edit manually.- * comms_service- * OpenAPI spec version: 0.1.0- */-import type { GenericReferenceUserId } from './genericReferenceUserId';--/**- * Representation of a reference from any entity type- */-export interface GenericReference {- /** When this reference was created */- created_at: string;- /** ID of the referenced entity */- entity_id: string;- /** Type of the referenced entity */- entity_type: string;- /** Optional metadata specific to the source type */- metadata?: unknown;- /** ID of the source entity */- source_entity_id: string;- /** Type of the source entity (e.g., "document", "chat", etc.) */- source_entity_type: string;- /** User who created this reference (optional for non-user sources like channels) */- user_id?: GenericReferenceUserId;-}diff --git a/js/app/packages/service-clients/service-comms/generated/models/genericReferenceUserId.ts b/js/app/packages/service-clients/service-comms/generated/models/genericReferenceUserId.tsdeleted file mode 100644index cb3694ab03..0000000000--- a/js/app/packages/service-clients/service-comms/generated/models/genericReferenceUserId.ts+++ /dev/null@@ -1,11 +0,0 @@-/**- * Generated by orval v7.21.0 🍺- * Do not edit manually.- * comms_service- * OpenAPI spec version: 0.1.0- */--/**- * User who created this reference (optional for non-user sources like channels)- */-export type GenericReferenceUserId = string | null;diff --git a/js/app/packages/service-clients/service-comms/generated/models/getAttachmentReferencesResponse.ts b/js/app/packages/service-clients/service-comms/generated/models/getAttachmentReferencesResponse.tsdeleted file mode 100644index 9eecfa805c..0000000000--- a/js/app/packages/service-clients/service-comms/generated/models/getAttachmentReferencesResponse.ts+++ /dev/null@@ -1,11 +0,0 @@-/**- * Generated by orval v7.21.0 🍺- * Do not edit manually.- * comms_service- * OpenAPI spec version: 0.1.0- */-import type { EntityReference } from './entityReference';--export interface GetAttachmentReferencesResponse {- references: EntityReference[];-}diff --git a/js/app/packages/service-clients/service-comms/generated/models/getBatchChannelPreviewRequest.ts b/js/app/packages/service-clients/service-comms/generated/models/getBatchChannelPreviewRequest.tsdeleted file mode 100644index e40cabdab2..0000000000--- a/js/app/packages/service-clients/service-comms/generated/models/getBatchChannelPreviewRequest.ts+++ /dev/null@@ -1,10 +0,0 @@-/**- * Generated by orval v7.21.0 🍺- * Do not edit manually.- * comms_service- * OpenAPI spec version: 0.1.0- */--export interface GetBatchChannelPreviewRequest {- channel_ids: string[];-}diff --git a/js/app/packages/service-clients/service-comms/generated/models/getBatchChannelPreviewResponse.ts b/js/app/packages/service-clients/service-comms/generated/models/getBatchChannelPreviewResponse.tsdeleted file mode 100644index 917caa788f..0000000000--- a/js/app/packages/service-clients/service-comms/generated/models/getBatchChannelPreviewResponse.ts+++ /dev/null@@ -1,11 +0,0 @@-/**- * Generated by orval v7.21.0 🍺- * Do not edit manually.- * comms_service- * OpenAPI spec version: 0.1.0- */-import type { ChannelPreview } from './channelPreview';--export interface GetBatchChannelPreviewResponse {- previews: ChannelPreview[];-}diff --git a/js/app/packages/service-clients/service-comms/generated/models/getChannelResponse.ts b/js/app/packages/service-clients/service-comms/generated/models/getChannelResponse.tsdeleted file mode 100644index 6cbe21bde1..0000000000--- a/js/app/packages/service-clients/service-comms/generated/models/getChannelResponse.ts+++ /dev/null@@ -1,31 +0,0 @@-/**- * Generated by orval v7.21.0 🍺- * Do not edit manually.- * comms_service- * OpenAPI spec version: 0.1.0- */--import type { Attachment } from './attachment';-import type { Channel } from './channel';-import type { ChannelParticipant } from './channelParticipant';-import type { GetChannelResponseActivity } from './getChannelResponseActivity';-import type { GetChannelResponseReactions } from './getChannelResponseReactions';-import type { Message } from './message';-import type { ParticipantAccess } from './participantAccess';--export interface GetChannelResponse {- /** What kind of access the user has to the channel-almost always this should be [Access(ParticipantType)] */- access: ParticipantAccess;- activity?: GetChannelResponseActivity;- /** Attachments that are linked to messages in this channel */- attachments: Attachment[];- /** information about the channel */- channel: Channel;- /** messages */- messages: Message[];- /** list of participants */- participants: ChannelParticipant[];- /** reactions grouped by message */- reactions: GetChannelResponseReactions;-}diff --git a/js/app/packages/service-clients/service-comms/generated/models/getChannelResponseActivity.ts b/js/app/packages/service-clients/service-comms/generated/models/getChannelResponseActivity.tsdeleted file mode 100644index e23a2cdefd..0000000000--- a/js/app/packages/service-clients/service-comms/generated/models/getChannelResponseActivity.ts+++ /dev/null@@ -1,9 +0,0 @@-/**- * Generated by orval v7.21.0 🍺- * Do not edit manually.- * comms_service- * OpenAPI spec version: 0.1.0- */-import type { Activity } from './activity';--export type GetChannelResponseActivity = null | Activity;diff --git a/js/app/packages/service-clients/service-comms/generated/models/getChannelResponseReactions.ts b/js/app/packages/service-clients/service-comms/generated/models/getChannelResponseReactions.tsdeleted file mode 100644index 9a065da06d..0000000000--- a/js/app/packages/service-clients/service-comms/generated/models/getChannelResponseReactions.ts+++ /dev/null@@ -1,12 +0,0 @@-/**- * Generated by orval v7.21.0 🍺- * Do not edit manually.- * comms_service- * OpenAPI spec version: 0.1.0- */-import type { CountedReaction } from './countedReaction';--/**- * reactions grouped by message- */-export type GetChannelResponseReactions = { [key: string]: CountedReaction[] };diff --git a/js/app/packages/service-clients/service-comms/generated/models/getMentionsResponse.ts b/js/app/packages/service-clients/service-comms/generated/models/getMentionsResponse.tsdeleted file mode 100644index f8ab3d717e..0000000000--- a/js/app/packages/service-clients/service-comms/generated/models/getMentionsResponse.ts+++ /dev/null@@ -1,11 +0,0 @@-/**- * Generated by orval v7.21.0 🍺- * Do not edit manually.- * comms_service- * OpenAPI spec version: 0.1.0- */-import type { MessageMention } from './messageMention';--export interface GetMentionsResponse {- mentions: MessageMention[];-}diff --git a/js/app/packages/service-clients/service-comms/generated/models/getMessageWithContextParams.ts b/js/app/packages/service-clients/service-comms/generated/models/getMessageWithContextParams.tsdeleted file mode 100644index c3cc7d0e87..0000000000--- a/js/app/packages/service-clients/service-comms/generated/models/getMessageWithContextParams.ts+++ /dev/null@@ -1,21 +0,0 @@-/**- * Generated by orval v7.21.0 🍺- * Do not edit manually.- * comms_service- * OpenAPI spec version: 0.1.0- */--export type GetMessageWithContextParams = {- /**- * ID of the message to get context around- */- message_id: string;- /**- * Number of messages to fetch before the target message (defaults to 0)- */- before?: number;- /**- * Number of messages to fetch after the target message (defaults to 0)- */- after?: number;-};diff --git a/js/app/packages/service-clients/service-comms/generated/models/getMessageWithContextResponse.ts b/js/app/packages/service-clients/service-comms/generated/models/getMessageWithContextResponse.tsdeleted file mode 100644index 43cf677bc7..0000000000--- a/js/app/packages/service-clients/service-comms/generated/models/getMessageWithContextResponse.ts+++ /dev/null@@ -1,11 +0,0 @@-/**- * Generated by orval v7.21.0 🍺- * Do not edit manually.- * comms_service- * OpenAPI spec version: 0.1.0- */-import type { Message } from './message';--export interface GetMessageWithContextResponse {- messages: Message[];-}diff --git a/js/app/packages/service-clients/service-comms/generated/models/getOrCreateAction.ts b/js/app/packages/service-clients/service-comms/generated/models/getOrCreateAction.tsdeleted file mode 100644index f3ff384e82..0000000000--- a/js/app/packages/service-clients/service-comms/generated/models/getOrCreateAction.ts+++ /dev/null@@ -1,15 +0,0 @@-/**- * Generated by orval v7.21.0 🍺- * Do not edit manually.- * comms_service- * OpenAPI spec version: 0.1.0- */--export type GetOrCreateAction =- (typeof GetOrCreateAction)[keyof typeof GetOrCreateAction];--// eslint-disable-next-line @typescript-eslint/no-redeclare-export const GetOrCreateAction = {- get: 'get',- create: 'create',-} as const;diff --git a/js/app/packages/service-clients/service-comms/generated/models/getOrCreateDmRequest.ts b/js/app/packages/service-clients/service-comms/generated/models/getOrCreateDmRequest.tsdeleted file mode 100644index b3fdd0fbcf..0000000000--- a/js/app/packages/service-clients/service-comms/generated/models/getOrCreateDmRequest.ts+++ /dev/null@@ -1,10 +0,0 @@-/**- * Generated by orval v7.21.0 🍺- * Do not edit manually.- * comms_service- * OpenAPI spec version: 0.1.0- */--export interface GetOrCreateDmRequest {- recipient_id: string;-}diff --git a/js/app/packages/service-clients/service-comms/generated/models/getOrCreateDmResponse.ts b/js/app/packages/service-clients/service-comms/generated/models/getOrCreateDmResponse.tsdeleted file mode 100644index c9008fde6f..0000000000--- a/js/app/packages/service-clients/service-comms/generated/models/getOrCreateDmResponse.ts+++ /dev/null@@ -1,12 +0,0 @@-/**- * Generated by orval v7.21.0 🍺- * Do not edit manually.- * comms_service- * OpenAPI spec version: 0.1.0- */-import type { GetOrCreateAction } from './getOrCreateAction';--export interface GetOrCreateDmResponse {- action: GetOrCreateAction;- channel_id: string;-}diff --git a/js/app/packages/service-clients/service-comms/generated/models/getOrCreatePrivateRequest.ts b/js/app/packages/service-clients/service-comms/generated/models/getOrCreatePrivateRequest.tsdeleted file mode 100644index 88f53501e8..0000000000--- a/js/app/packages/service-clients/service-comms/generated/models/getOrCreatePrivateRequest.ts+++ /dev/null@@ -1,10 +0,0 @@-/**- * Generated by orval v7.21.0 🍺- * Do not edit manually.- * comms_service- * OpenAPI spec version: 0.1.0- */--export interface GetOrCreatePrivateRequest {- recipients: string[];-}diff --git a/js/app/packages/service-clients/service-comms/generated/models/getOrCreatePrivateResponse.ts b/js/app/packages/service-clients/service-comms/generated/models/getOrCreatePrivateResponse.tsdeleted file mode 100644index 3c5903a5fd..0000000000--- a/js/app/packages/service-clients/service-comms/generated/models/getOrCreatePrivateResponse.ts+++ /dev/null@@ -1,12 +0,0 @@-/**- * Generated by orval v7.21.0 🍺- * Do not edit manually.- * comms_service- * OpenAPI spec version: 0.1.0- */-import type { GetOrCreateAction } from './getOrCreateAction';--export interface GetOrCreatePrivateResponse {- action: GetOrCreateAction;- channel_id: string;-}diff --git a/js/app/packages/service-clients/service-comms/generated/models/index.ts b/js/app/packages/service-clients/service-comms/generated/models/index.tsdeleted file mode 100644index b1235f9ff0..0000000000--- a/js/app/packages/service-clients/service-comms/generated/models/index.ts+++ /dev/null@@ -1,129 +0,0 @@-/**- * Generated by orval v7.21.0 🍺- * Do not edit manually.- * comms_service- * OpenAPI spec version: 0.1.0- */--export * from './activity';-export * from './activityInteractedAt';-export * from './activityType';-export * from './activityViewedAt';-export * from './addParticipantsRequest';-export * from './apiActivity';-export * from './apiActivityInteractedAt';-export * from './apiActivityViewedAt';-export * from './apiChannelWithLatest';-export * from './apiChannelWithLatestAllOf';-export * from './apiChannelWithLatestAllOfFrecencyScore';-export * from './apiChannelWithLatestAllOfInteractedAt';-export * from './apiChannelWithLatestAllOfViewedAt';-export * from './attachment';-export * from './attachmentHeight';-export * from './attachmentWidth';-export * from './channel';-export * from './channelMessage';-export * from './channelMessageDeletedAt';-export * from './channelMessageThreadId';-export * from './channelName';-export * from './channelOrgId';-export * from './channelParticipant';-export * from './channelParticipantLeftAt';-export * from './channelPreview';-export * from './channelPreviewData';-export * from './channelPreviewOneOf';-export * from './channelPreviewOneOfAllOf';-export * from './channelPreviewOneOfAllOfType';-export * from './channelPreviewOneOfFour';-export * from './channelPreviewOneOfFourAllOf';-export * from './channelPreviewOneOfFourAllOfType';-export * from './channelPreviewOneOfSeven';-export * from './channelPreviewOneOfSevenAllOf';-export * from './channelPreviewOneOfSevenAllOfType';-export * from './channelReference';-export * from './channelReferenceChannelName';-export * from './channelReferenceThreadId';-export * from './channelType';-export * from './channelWithParticipants';-export * from './channelWithParticipantsAllOf';-export * from './communicationServiceApiVersion';-export * from './countedReaction';-export * from './createChannelRequest';-export * from './createChannelRequestName';-export * from './createChannelRequestTeamId';-export * from './createChannelResponse';-export * from './createEntityMentionRequest';-export * from './createEntityMentionResponse';-export * from './createEntityMentionResponseUserId';-export * from './deleteEntityMentionRequest';-export * from './deleteEntityMentionResponse';-export * from './deleteMessageParams';-export * from './entityMention';-export * from './entityMentionUserId';-export * from './entityReference';-export * from './entityReferenceOneOf';-export * from './entityReferenceOneOfAllOf';-export * from './entityReferenceOneOfAllOfReferenceType';-export * from './entityReferenceOneOfFour';-export * from './entityReferenceOneOfFourAllOf';-export * from './entityReferenceOneOfFourAllOfReferenceType';-export * from './genericErrorResponse';-export * from './genericReference';-export * from './genericReferenceUserId';-export * from './getAttachmentReferencesResponse';-export * from './getBatchChannelPreviewRequest';-export * from './getBatchChannelPreviewResponse';-export * from './getChannelParams';-export * from './getChannelResponse';-export * from './getChannelResponseActivity';-export * from './getChannelResponseReactions';-export * from './getMentionsResponse';-export * from './getMessageWithContextParams';-export * from './getMessageWithContextResponse';-export * from './getOrCreateAction';-export * from './getOrCreateDmRequest';-export * from './getOrCreateDmResponse';-export * from './getOrCreatePrivateRequest';-export * from './getOrCreatePrivateResponse';-export * from './latestMessage';-export * from './latestMessageLatestMessage';-export * from './latestMessageLatestNonThreadMessage';-export * from './message';-export * from './messageDeletedAt';-export * from './messageEditedAt';-export * from './messageMention';-export * from './messageThreadId';-export * from './newAttachment';-export * from './newAttachmentHeight';-export * from './newAttachmentWidth';-export * from './participantAccess';-export * from './participantAccessOneOf';-export * from './participantAccessOneOfAccess';-export * from './participantRole';-export * from './patchChannelOptions';-export * from './patchChannelOptionsChannelName';-export * from './patchMessageParams';-export * from './patchMessageRequest';-export * from './patchMessageRequestAttachmentIdsToDelete';-export * from './patchMessageRequestAttachmentsToAdd';-export * from './patchMessageRequestContent';-export * from './patchMessageRequestMentions';-export * from './patchMessageRequestNonce';-export * from './postActivityRequest';-export * from './postMessageRequest';-export * from './postMessageRequestNonce';-export * from './postMessageRequestThreadId';-export * from './postMessageResponse';-export * from './postMessageResponseNonce';-export * from './postReactionRequest';-export * from './postReactionRequestNonce';-export * from './postTypingRequest';-export * from './postTypingRequestNonce';-export * from './postTypingRequestThreadId';-export * from './reaction';-export * from './reactionAction';-export * from './removeParticipantsRequest';-export * from './simpleMention';-export * from './stringIDResponse';-export * from './typingAction';-export * from './withChannelId';diff --git a/js/app/packages/service-clients/service-comms/generated/models/latestMessage.ts b/js/app/packages/service-clients/service-comms/generated/models/latestMessage.tsdeleted file mode 100644index ea074fd445..0000000000--- a/js/app/packages/service-clients/service-comms/generated/models/latestMessage.ts+++ /dev/null@@ -1,13 +0,0 @@-/**- * Generated by orval v7.21.0 🍺- * Do not edit manually.- * comms_service- * OpenAPI spec version: 0.1.0- */-import type { LatestMessageLatestMessage } from './latestMessageLatestMessage';-import type { LatestMessageLatestNonThreadMessage } from './latestMessageLatestNonThreadMessage';--export interface LatestMessage {- latest_message?: LatestMessageLatestMessage;- latest_non_thread_message?: LatestMessageLatestNonThreadMessage;-}diff --git a/js/app/packages/service-clients/service-comms/generated/models/latestMessageLatestMessage.ts b/js/app/packages/service-clients/service-comms/generated/models/latestMessageLatestMessage.tsdeleted file mode 100644index 1b096e0aab..0000000000--- a/js/app/packages/service-clients/service-comms/generated/models/latestMessageLatestMessage.ts+++ /dev/null@@ -1,9 +0,0 @@-/**- * Generated by orval v7.21.0 🍺- * Do not edit manually.- * comms_service- * OpenAPI spec version: 0.1.0- */-import type { ChannelMessage } from './channelMessage';--export type LatestMessageLatestMessage = null | ChannelMessage;diff --git a/js/app/packages/service-clients/service-comms/generated/models/latestMessageLatestNonThreadMessage.ts b/js/app/packages/service-clients/service-comms/generated/models/latestMessageLatestNonThreadMessage.tsdeleted file mode 100644index a173b0b7b0..0000000000--- a/js/app/packages/service-clients/service-comms/generated/models/latestMessageLatestNonThreadMessage.ts+++ /dev/null@@ -1,9 +0,0 @@-/**- * Generated by orval v7.21.0 🍺- * Do not edit manually.- * comms_service- * OpenAPI spec version: 0.1.0- */-import type { ChannelMessage } from './channelMessage';--export type LatestMessageLatestNonThreadMessage = null | ChannelMessage;diff --git a/js/app/packages/service-clients/service-comms/generated/models/message.ts b/js/app/packages/service-clients/service-comms/generated/models/message.tsdeleted file mode 100644index 15fd2f2ba3..0000000000--- a/js/app/packages/service-clients/service-comms/generated/models/message.ts+++ /dev/null@@ -1,21 +0,0 @@-/**- * Generated by orval v7.21.0 🍺- * Do not edit manually.- * comms_service- * OpenAPI spec version: 0.1.0- */-import type { MessageDeletedAt } from './messageDeletedAt';-import type { MessageEditedAt } from './messageEditedAt';-import type { MessageThreadId } from './messageThreadId';--export interface Message {- channel_id: string;- content: string;- created_at: string;- deleted_at?: MessageDeletedAt;- edited_at?: MessageEditedAt;- id: string;- sender_id: string;- thread_id?: MessageThreadId;- updated_at: string;-}diff --git a/js/app/packages/service-clients/service-comms/generated/models/messageDeletedAt.ts b/js/app/packages/service-clients/service-comms/generated/models/messageDeletedAt.tsdeleted file mode 100644index 639879e5e8..0000000000--- a/js/app/packages/service-clients/service-comms/generated/models/messageDeletedAt.ts+++ /dev/null@@ -1,8 +0,0 @@-/**- * Generated by orval v7.21.0 🍺- * Do not edit manually.- * comms_service- * OpenAPI spec version: 0.1.0- */--export type MessageDeletedAt = string | null;diff --git a/js/app/packages/service-clients/service-comms/generated/models/messageEditedAt.ts b/js/app/packages/service-clients/service-comms/generated/models/messageEditedAt.tsdeleted file mode 100644index 9908ea3159..0000000000--- a/js/app/packages/service-clients/service-comms/generated/models/messageEditedAt.ts+++ /dev/null@@ -1,8 +0,0 @@-/**- * Generated by orval v7.21.0 🍺- * Do not edit manually.- * comms_service- * OpenAPI spec version: 0.1.0- */--export type MessageEditedAt = string | null;diff --git a/js/app/packages/service-clients/service-comms/generated/models/messageMention.ts b/js/app/packages/service-clients/service-comms/generated/models/messageMention.tsdeleted file mode 100644index 47358d9b6a..0000000000--- a/js/app/packages/service-clients/service-comms/generated/models/messageMention.ts+++ /dev/null@@ -1,13 +0,0 @@-/**- * Generated by orval v7.21.0 🍺- * Do not edit manually.- * comms_service- * OpenAPI spec version: 0.1.0- */--export interface MessageMention {- created_at: string;- entity_id: string;- entity_type: string;- message_id: string;-}diff --git a/js/app/packages/service-clients/service-comms/generated/models/messageThreadId.ts b/js/app/packages/service-clients/service-comms/generated/models/messageThreadId.tsdeleted file mode 100644index 14fd102588..0000000000--- a/js/app/packages/service-clients/service-comms/generated/models/messageThreadId.ts+++ /dev/null@@ -1,8 +0,0 @@-/**- * Generated by orval v7.21.0 🍺- * Do not edit manually.- * comms_service- * OpenAPI spec version: 0.1.0- */--export type MessageThreadId = string | null;diff --git a/js/app/packages/service-clients/service-comms/generated/models/newAttachment.ts b/js/app/packages/service-clients/service-comms/generated/models/newAttachment.tsdeleted file mode 100644index 31f62bd99a..0000000000--- a/js/app/packages/service-clients/service-comms/generated/models/newAttachment.ts+++ /dev/null@@ -1,16 +0,0 @@-/**- * Generated by orval v7.21.0 🍺- * Do not edit manually.- * comms_service- * OpenAPI spec version: 0.1.0- */-import type { NewAttachmentHeight } from './newAttachmentHeight';-import type { NewAttachmentWidth } from './newAttachmentWidth';--export interface NewAttachment {- entity_id: string;- entity_type: string;- /** dimensions of image/video */- height?: NewAttachmentHeight;- width?: NewAttachmentWidth;-}diff --git a/js/app/packages/service-clients/service-comms/generated/models/newAttachmentHeight.ts b/js/app/packages/service-clients/service-comms/generated/models/newAttachmentHeight.tsdeleted file mode 100644index e7d5330eb2..0000000000--- a/js/app/packages/service-clients/service-comms/generated/models/newAttachmentHeight.ts+++ /dev/null@@ -1,11 +0,0 @@-/**- * Generated by orval v7.21.0 🍺- * Do not edit manually.- * comms_service- * OpenAPI spec version: 0.1.0- */--/**- * dimensions of image/video- */-export type NewAttachmentHeight = number | null;diff --git a/js/app/packages/service-clients/service-comms/generated/models/newAttachmentWidth.ts b/js/app/packages/service-clients/service-comms/generated/models/newAttachmentWidth.tsdeleted file mode 100644index 09fb968d8d..0000000000--- a/js/app/packages/service-clients/service-comms/generated/models/newAttachmentWidth.ts+++ /dev/null@@ -1,8 +0,0 @@-/**- * Generated by orval v7.21.0 🍺- * Do not edit manually.- * comms_service- * OpenAPI spec version: 0.1.0- */--export type NewAttachmentWidth = number | null;diff --git a/js/app/packages/service-clients/service-comms/generated/models/participantAccess.ts b/js/app/packages/service-clients/service-comms/generated/models/participantAccess.tsdeleted file mode 100644index ee911d30b9..0000000000--- a/js/app/packages/service-clients/service-comms/generated/models/participantAccess.ts+++ /dev/null@@ -1,9 +0,0 @@-/**- * Generated by orval v7.21.0 🍺- * Do not edit manually.- * comms_service- * OpenAPI spec version: 0.1.0- */-import type { ParticipantAccessOneOf } from './participantAccessOneOf';--export type ParticipantAccess = ParticipantAccessOneOf | 'NoAccess';diff --git a/js/app/packages/service-clients/service-comms/generated/models/participantAccessOneOf.ts b/js/app/packages/service-clients/service-comms/generated/models/participantAccessOneOf.tsdeleted file mode 100644index 659d29a6b3..0000000000--- a/js/app/packages/service-clients/service-comms/generated/models/participantAccessOneOf.ts+++ /dev/null@@ -1,11 +0,0 @@-/**- * Generated by orval v7.21.0 🍺- * Do not edit manually.- * comms_service- * OpenAPI spec version: 0.1.0- */-import type { ParticipantAccessOneOfAccess } from './participantAccessOneOfAccess';--export type ParticipantAccessOneOf = {- Access: ParticipantAccessOneOfAccess;-};diff --git a/js/app/packages/service-clients/service-comms/generated/models/participantAccessOneOfAccess.ts b/js/app/packages/service-clients/service-comms/generated/models/participantAccessOneOfAccess.tsdeleted file mode 100644index 434ce81782..0000000000--- a/js/app/packages/service-clients/service-comms/generated/models/participantAccessOneOfAccess.ts+++ /dev/null@@ -1,11 +0,0 @@-/**- * Generated by orval v7.21.0 🍺- * Do not edit manually.- * comms_service- * OpenAPI spec version: 0.1.0- */-import type { ParticipantRole } from './participantRole';--export type ParticipantAccessOneOfAccess = {- role: ParticipantRole;-};diff --git a/js/app/packages/service-clients/service-comms/generated/models/participantRole.ts b/js/app/packages/service-clients/service-comms/generated/models/participantRole.tsdeleted file mode 100644index dbe6e70c6e..0000000000--- a/js/app/packages/service-clients/service-comms/generated/models/participantRole.ts+++ /dev/null@@ -1,16 +0,0 @@-/**- * Generated by orval v7.21.0 🍺- * Do not edit manually.- * comms_service- * OpenAPI spec version: 0.1.0- */--export type ParticipantRole =- (typeof ParticipantRole)[keyof typeof ParticipantRole];--// eslint-disable-next-line @typescript-eslint/no-redeclare-export const ParticipantRole = {- owner: 'owner',- admin: 'admin',- member: 'member',-} as const;diff --git a/js/app/packages/service-clients/service-comms/generated/models/patchChannelOptions.ts b/js/app/packages/service-clients/service-comms/generated/models/patchChannelOptions.tsdeleted file mode 100644index 37dffd5abb..0000000000--- a/js/app/packages/service-clients/service-comms/generated/models/patchChannelOptions.ts+++ /dev/null@@ -1,11 +0,0 @@-/**- * Generated by orval v7.21.0 🍺- * Do not edit manually.- * comms_service- * OpenAPI spec version: 0.1.0- */-import type { PatchChannelOptionsChannelName } from './patchChannelOptionsChannelName';--export interface PatchChannelOptions {- channel_name?: PatchChannelOptionsChannelName;-}diff --git a/js/app/packages/service-clients/service-comms/generated/models/patchChannelOptionsChannelName.ts b/js/app/packages/service-clients/service-comms/generated/models/patchChannelOptionsChannelName.tsdeleted file mode 100644index f5e4d460df..0000000000--- a/js/app/packages/service-clients/service-comms/generated/models/patchChannelOptionsChannelName.ts+++ /dev/null@@ -1,8 +0,0 @@-/**- * Generated by orval v7.21.0 🍺- * Do not edit manually.- * comms_service- * OpenAPI spec version: 0.1.0- */--export type PatchChannelOptionsChannelName = string | null;diff --git a/js/app/packages/service-clients/service-comms/generated/models/patchMessageParams.ts b/js/app/packages/service-clients/service-comms/generated/models/patchMessageParams.tsdeleted file mode 100644index ff4c109099..0000000000--- a/js/app/packages/service-clients/service-comms/generated/models/patchMessageParams.ts+++ /dev/null@@ -1,11 +0,0 @@-/**- * Generated by orval v7.21.0 🍺- * Do not edit manually.- * comms_service- * OpenAPI spec version: 0.1.0- */--export interface PatchMessageParams {- channel_id: string;- message_id: string;-}diff --git a/js/app/packages/service-clients/service-comms/generated/models/patchMessageRequest.ts b/js/app/packages/service-clients/service-comms/generated/models/patchMessageRequest.tsdeleted file mode 100644index e036fdb3ff..0000000000--- a/js/app/packages/service-clients/service-comms/generated/models/patchMessageRequest.ts+++ /dev/null@@ -1,19 +0,0 @@-/**- * Generated by orval v7.21.0 🍺- * Do not edit manually.- * comms_service- * OpenAPI spec version: 0.1.0- */-import type { PatchMessageRequestAttachmentIdsToDelete } from './patchMessageRequestAttachmentIdsToDelete';-import type { PatchMessageRequestAttachmentsToAdd } from './patchMessageRequestAttachmentsToAdd';-import type { PatchMessageRequestContent } from './patchMessageRequestContent';-import type { PatchMessageRequestMentions } from './patchMessageRequestMentions';-import type { PatchMessageRequestNonce } from './patchMessageRequestNonce';--export interface PatchMessageRequest {- attachment_ids_to_delete?: PatchMessageRequestAttachmentIdsToDelete;- attachments_to_add?: PatchMessageRequestAttachmentsToAdd;- content?: PatchMessageRequestContent;- mentions?: PatchMessageRequestMentions;- nonce?: PatchMessageRequestNonce;-}diff --git a/js/app/packages/service-clients/service-comms/generated/models/patchMessageRequestAttachmentIdsToDelete.ts b/js/app/packages/service-clients/service-comms/generated/models/patchMessageRequestAttachmentIdsToDelete.tsdeleted file mode 100644index b8ee0026b9..0000000000--- a/js/app/packages/service-clients/service-comms/generated/models/patchMessageRequestAttachmentIdsToDelete.ts+++ /dev/null@@ -1,8 +0,0 @@-/**- * Generated by orval v7.21.0 🍺- * Do not edit manually.- * comms_service- * OpenAPI spec version: 0.1.0- */--export type PatchMessageRequestAttachmentIdsToDelete = string[] | null;diff --git a/js/app/packages/service-clients/service-comms/generated/models/patchMessageRequestAttachmentsToAdd.ts b/js/app/packages/service-clients/service-comms/generated/models/patchMessageRequestAttachmentsToAdd.tsdeleted file mode 100644index 0cddb51a8d..0000000000--- a/js/app/packages/service-clients/service-comms/generated/models/patchMessageRequestAttachmentsToAdd.ts+++ /dev/null@@ -1,9 +0,0 @@-/**- * Generated by orval v7.21.0 🍺- * Do not edit manually.- * comms_service- * OpenAPI spec version: 0.1.0- */-import type { NewAttachment } from './newAttachment';--export type PatchMessageRequestAttachmentsToAdd = NewAttachment[] | null;diff --git a/js/app/packages/service-clients/service-comms/generated/models/patchMessageRequestContent.ts b/js/app/packages/service-clients/service-comms/generated/models/patchMessageRequestContent.tsdeleted file mode 100644index b2fa7ec7db..0000000000--- a/js/app/packages/service-clients/service-comms/generated/models/patchMessageRequestContent.ts+++ /dev/null@@ -1,8 +0,0 @@-/**- * Generated by orval v7.21.0 🍺- * Do not edit manually.- * comms_service- * OpenAPI spec version: 0.1.0- */--export type PatchMessageRequestContent = string | null;diff --git a/js/app/packages/service-clients/service-comms/generated/models/patchMessageRequestMentions.ts b/js/app/packages/service-clients/service-comms/generated/models/patchMessageRequestMentions.tsdeleted file mode 100644index 25db558b44..0000000000--- a/js/app/packages/service-clients/service-comms/generated/models/patchMessageRequestMentions.ts+++ /dev/null@@ -1,9 +0,0 @@-/**- * Generated by orval v7.21.0 🍺- * Do not edit manually.- * comms_service- * OpenAPI spec version: 0.1.0- */-import type { SimpleMention } from './simpleMention';--export type PatchMessageRequestMentions = SimpleMention[] | null;diff --git a/js/app/packages/service-clients/service-comms/generated/models/patchMessageRequestNonce.ts b/js/app/packages/service-clients/service-comms/generated/models/patchMessageRequestNonce.tsdeleted file mode 100644index eb3b5b1a28..0000000000--- a/js/app/packages/service-clients/service-comms/generated/models/patchMessageRequestNonce.ts+++ /dev/null@@ -1,8 +0,0 @@-/**- * Generated by orval v7.21.0 🍺- * Do not edit manually.- * comms_service- * OpenAPI spec version: 0.1.0- */--export type PatchMessageRequestNonce = string | null;diff --git a/js/app/packages/service-clients/service-comms/generated/models/postActivityRequest.ts b/js/app/packages/service-clients/service-comms/generated/models/postActivityRequest.tsdeleted file mode 100644index 7b2106487f..0000000000--- a/js/app/packages/service-clients/service-comms/generated/models/postActivityRequest.ts+++ /dev/null@@ -1,12 +0,0 @@-/**- * Generated by orval v7.21.0 🍺- * Do not edit manually.- * comms_service- * OpenAPI spec version: 0.1.0- */-import type { ActivityType } from './activityType';--export interface PostActivityRequest {- activity_type: ActivityType;- channel_id: string;-}diff --git a/js/app/packages/service-clients/service-comms/generated/models/postMessageRequest.ts b/js/app/packages/service-clients/service-comms/generated/models/postMessageRequest.tsdeleted file mode 100644index 5c03086de0..0000000000--- a/js/app/packages/service-clients/service-comms/generated/models/postMessageRequest.ts+++ /dev/null@@ -1,18 +0,0 @@-/**- * Generated by orval v7.21.0 🍺- * Do not edit manually.- * comms_service- * OpenAPI spec version: 0.1.0- */-import type { NewAttachment } from './newAttachment';-import type { PostMessageRequestNonce } from './postMessageRequestNonce';-import type { PostMessageRequestThreadId } from './postMessageRequestThreadId';-import type { SimpleMention } from './simpleMention';--export interface PostMessageRequest {- attachments: NewAttachment[];- content: string;- mentions: SimpleMention[];- nonce?: PostMessageRequestNonce;- thread_id?: PostMessageRequestThreadId;-}diff --git a/js/app/packages/service-clients/service-comms/generated/models/postMessageRequestNonce.ts b/js/app/packages/service-clients/service-comms/generated/models/postMessageRequestNonce.tsdeleted file mode 100644index 74ffa50f50..0000000000--- a/js/app/packages/service-clients/service-comms/generated/models/postMessageRequestNonce.ts+++ /dev/null@@ -1,8 +0,0 @@-/**- * Generated by orval v7.21.0 🍺- * Do not edit manually.- * comms_service- * OpenAPI spec version: 0.1.0- */--export type PostMessageRequestNonce = string | null;diff --git a/js/app/packages/service-clients/service-comms/generated/models/postMessageRequestThreadId.ts b/js/app/packages/service-clients/service-comms/generated/models/postMessageRequestThreadId.tsdeleted file mode 100644index 190af02288..0000000000--- a/js/app/packages/service-clients/service-comms/generated/models/postMessageRequestThreadId.ts+++ /dev/null@@ -1,8 +0,0 @@-/**- * Generated by orval v7.21.0 🍺- * Do not edit manually.- * comms_service- * OpenAPI spec version: 0.1.0- */--export type PostMessageRequestThreadId = string | null;diff --git a/js/app/packages/service-clients/service-comms/generated/models/postMessageResponse.ts b/js/app/packages/service-clients/service-comms/generated/models/postMessageResponse.tsdeleted file mode 100644index c737cddaa4..0000000000--- a/js/app/packages/service-clients/service-comms/generated/models/postMessageResponse.ts+++ /dev/null@@ -1,12 +0,0 @@-/**- * Generated by orval v7.21.0 🍺- * Do not edit manually.- * comms_service- * OpenAPI spec version: 0.1.0- */-import type { PostMessageResponseNonce } from './postMessageResponseNonce';--export interface PostMessageResponse {- id: string;- nonce?: PostMessageResponseNonce;-}diff --git a/js/app/packages/service-clients/service-comms/generated/models/postMessageResponseNonce.ts b/js/app/packages/service-clients/service-comms/generated/models/postMessageResponseNonce.tsdeleted file mode 100644index 7fd08eb736..0000000000--- a/js/app/packages/service-clients/service-comms/generated/models/postMessageResponseNonce.ts+++ /dev/null@@ -1,8 +0,0 @@-/**- * Generated by orval v7.21.0 🍺- * Do not edit manually.- * comms_service- * OpenAPI spec version: 0.1.0- */--export type PostMessageResponseNonce = string | null;diff --git a/js/app/packages/service-clients/service-comms/generated/models/postReactionRequest.ts b/js/app/packages/service-clients/service-comms/generated/models/postReactionRequest.tsdeleted file mode 100644index c760bbfc09..0000000000--- a/js/app/packages/service-clients/service-comms/generated/models/postReactionRequest.ts+++ /dev/null@@ -1,16 +0,0 @@-/**- * Generated by orval v7.21.0 🍺- * Do not edit manually.- * comms_service- * OpenAPI spec version: 0.1.0- */--import type { PostReactionRequestNonce } from './postReactionRequestNonce';-import type { ReactionAction } from './reactionAction';--export interface PostReactionRequest {- action: ReactionAction;- emoji: string;- message_id: string;- nonce?: PostReactionRequestNonce;-}diff --git a/js/app/packages/service-clients/service-comms/generated/models/postReactionRequestNonce.ts b/js/app/packages/service-clients/service-comms/generated/models/postReactionRequestNonce.tsdeleted file mode 100644index 1cf39c6e2d..0000000000--- a/js/app/packages/service-clients/service-comms/generated/models/postReactionRequestNonce.ts+++ /dev/null@@ -1,8 +0,0 @@-/**- * Generated by orval v7.21.0 🍺- * Do not edit manually.- * comms_service- * OpenAPI spec version: 0.1.0- */--export type PostReactionRequestNonce = string | null;diff --git a/js/app/packages/service-clients/service-comms/generated/models/postTypingRequest.ts b/js/app/packages/service-clients/service-comms/generated/models/postTypingRequest.tsdeleted file mode 100644index a3e4fbe78d..0000000000--- a/js/app/packages/service-clients/service-comms/generated/models/postTypingRequest.ts+++ /dev/null@@ -1,16 +0,0 @@-/**- * Generated by orval v7.21.0 🍺- * Do not edit manually.- * comms_service- * OpenAPI spec version: 0.1.0- */--import type { PostTypingRequestNonce } from './postTypingRequestNonce';-import type { PostTypingRequestThreadId } from './postTypingRequestThreadId';-import type { TypingAction } from './typingAction';--export interface PostTypingRequest {- action: TypingAction;- nonce?: PostTypingRequestNonce;- thread_id?: PostTypingRequestThreadId;-}diff --git a/js/app/packages/service-clients/service-comms/generated/models/postTypingRequestNonce.ts b/js/app/packages/service-clients/service-comms/generated/models/postTypingRequestNonce.tsdeleted file mode 100644index 3a0ce9450e..0000000000--- a/js/app/packages/service-clients/service-comms/generated/models/postTypingRequestNonce.ts+++ /dev/null@@ -1,8 +0,0 @@-/**- * Generated by orval v7.21.0 🍺- * Do not edit manually.- * comms_service- * OpenAPI spec version: 0.1.0- */--export type PostTypingRequestNonce = string | null;diff --git a/js/app/packages/service-clients/service-comms/generated/models/postTypingRequestThreadId.ts b/js/app/packages/service-clients/service-comms/generated/models/postTypingRequestThreadId.tsdeleted file mode 100644index b9adfe07fa..0000000000--- a/js/app/packages/service-clients/service-comms/generated/models/postTypingRequestThreadId.ts+++ /dev/null@@ -1,8 +0,0 @@-/**- * Generated by orval v7.21.0 🍺- * Do not edit manually.- * comms_service- * OpenAPI spec version: 0.1.0- */--export type PostTypingRequestThreadId = string | null;diff --git a/js/app/packages/service-clients/service-comms/generated/models/reaction.ts b/js/app/packages/service-clients/service-comms/generated/models/reaction.tsdeleted file mode 100644index e335b7ee03..0000000000--- a/js/app/packages/service-clients/service-comms/generated/models/reaction.ts+++ /dev/null@@ -1,13 +0,0 @@-/**- * Generated by orval v7.21.0 🍺- * Do not edit manually.- * comms_service- * OpenAPI spec version: 0.1.0- */--export interface Reaction {- created_at: string;- emoji: string;- message_id: string;- user_id: string;-}diff --git a/js/app/packages/service-clients/service-comms/generated/models/reactionAction.ts b/js/app/packages/service-clients/service-comms/generated/models/reactionAction.tsdeleted file mode 100644index c78cf8a5ff..0000000000--- a/js/app/packages/service-clients/service-comms/generated/models/reactionAction.ts+++ /dev/null@@ -1,15 +0,0 @@-/**- * Generated by orval v7.21.0 🍺- * Do not edit manually.- * comms_service- * OpenAPI spec version: 0.1.0- */--export type ReactionAction =- (typeof ReactionAction)[keyof typeof ReactionAction];--// eslint-disable-next-line @typescript-eslint/no-redeclare-export const ReactionAction = {- Add: 'Add',- Remove: 'Remove',-} as const;diff --git a/js/app/packages/service-clients/service-comms/generated/models/removeParticipantsRequest.ts b/js/app/packages/service-clients/service-comms/generated/models/removeParticipantsRequest.tsdeleted file mode 100644index e0a02fb4bf..0000000000--- a/js/app/packages/service-clients/service-comms/generated/models/removeParticipantsRequest.ts+++ /dev/null@@ -1,10 +0,0 @@-/**- * Generated by orval v7.21.0 🍺- * Do not edit manually.- * comms_service- * OpenAPI spec version: 0.1.0- */--export interface RemoveParticipantsRequest {- participants: string[];-}diff --git a/js/app/packages/service-clients/service-comms/generated/models/simpleMention.ts b/js/app/packages/service-clients/service-comms/generated/models/simpleMention.tsdeleted file mode 100644index 045edc7419..0000000000--- a/js/app/packages/service-clients/service-comms/generated/models/simpleMention.ts+++ /dev/null@@ -1,11 +0,0 @@-/**- * Generated by orval v7.21.0 🍺- * Do not edit manually.- * comms_service- * OpenAPI spec version: 0.1.0- */--export interface SimpleMention {- entity_id: string;- entity_type: string;-}diff --git a/js/app/packages/service-clients/service-comms/generated/models/stringIDResponse.ts b/js/app/packages/service-clients/service-comms/generated/models/stringIDResponse.tsdeleted file mode 100644index 80909e7f97..0000000000--- a/js/app/packages/service-clients/service-comms/generated/models/stringIDResponse.ts+++ /dev/null@@ -1,10 +0,0 @@-/**- * Generated by orval v7.21.0 🍺- * Do not edit manually.- * comms_service- * OpenAPI spec version: 0.1.0- */--export interface StringIDResponse {- id: string;-}diff --git a/js/app/packages/service-clients/service-comms/generated/models/typingAction.ts b/js/app/packages/service-clients/service-comms/generated/models/typingAction.tsdeleted file mode 100644index e6a805b1e4..0000000000--- a/js/app/packages/service-clients/service-comms/generated/models/typingAction.ts+++ /dev/null@@ -1,14 +0,0 @@-/**- * Generated by orval v7.21.0 🍺- * Do not edit manually.- * comms_service- * OpenAPI spec version: 0.1.0- */--export type TypingAction = (typeof TypingAction)[keyof typeof TypingAction];--// eslint-disable-next-line @typescript-eslint/no-redeclare-export const TypingAction = {- start: 'start',- stop: 'stop',-} as const;diff --git a/js/app/packages/service-clients/service-comms/generated/models/withChannelId.ts b/js/app/packages/service-clients/service-comms/generated/models/withChannelId.tsdeleted file mode 100644index d6618fa4f3..0000000000--- a/js/app/packages/service-clients/service-comms/generated/models/withChannelId.ts+++ /dev/null@@ -1,10 +0,0 @@-/**- * Generated by orval v7.21.0 🍺- * Do not edit manually.- * comms_service- * OpenAPI spec version: 0.1.0- */--export interface WithChannelId {- channel_id: string;-}diff --git a/js/app/packages/service-clients/service-comms/openapi.json b/js/app/packages/service-clients/service-comms/openapi.jsondeleted file mode 100644index 17540ea5ba..0000000000--- a/js/app/packages/service-clients/service-comms/openapi.json+++ /dev/null@@ -1,2718 +0,0 @@-{- "openapi": "3.1.0",- "info": {- "title": "comms_service",- "description": "",- "termsOfService": "https://macro.com/terms",- "license": {- "name": ""- },- "version": "0.1.0"- },- "paths": {- "/activity": {- "get": {- "tags": ["activity"],- "operationId": "get_activity",- "responses": {- "200": {- "description": "",- "content": {- "application/json": {- "schema": {- "type": "array",- "items": {- "$ref": "#/components/schemas/ApiActivity"- }- }- }- }- },- "401": {- "description": "",- "content": {- "text/plain": {- "schema": {- "type": "string"- }- }- }- },- "404": {- "description": "",- "content": {- "text/plain": {- "schema": {- "type": "string"- }- }- }- },- "500": {- "description": "",- "content": {- "text/plain": {- "schema": {- "type": "string"- }- }- }- }- }- }- },- "/channels": {- "get": {- "tags": ["channels"],- "operationId": "get_channels",- "responses": {- "200": {- "description": "",- "content": {- "application/json": {- "schema": {- "type": "array",- "items": {- "$ref": "#/components/schemas/ApiChannelWithLatest"- }- }- }- }- },- "401": {- "description": "",- "content": {- "text/plain": {- "schema": {- "type": "string"- }- }- }- },- "404": {- "description": "",- "content": {- "text/plain": {- "schema": {- "type": "string"- }- }- }- },- "500": {- "description": "",- "content": {- "text/plain": {- "schema": {- "type": "string"- }- }- }- }- }- }- },- "/comms/activity": {- "post": {- "tags": ["activity"],- "operationId": "post_activity",- "requestBody": {- "content": {- "application/json": {- "schema": {- "$ref": "#/components/schemas/PostActivityRequest"- }- }- },- "required": true- },- "responses": {- "200": {- "description": "",- "content": {- "application/json": {- "schema": {- "$ref": "#/components/schemas/Activity"- }- }- }- },- "401": {- "description": "",- "content": {- "text/plain": {- "schema": {- "type": "string"- }- }- }- },- "404": {- "description": "",- "content": {- "text/plain": {- "schema": {- "type": "string"- }- }- }- },- "500": {- "description": "",- "content": {- "text/plain": {- "schema": {- "type": "string"- }- }- }- }- }- }- },- "/comms/attachments/{entity_type}/{entity_id}/references": {- "get": {- "tags": ["attachments"],- "operationId": "get_attachment_references",- "parameters": [- {- "name": "entity_type",- "in": "path",- "description": "type of the attachment entity",- "required": true,- "schema": {- "type": "string"- }- },- {- "name": "entity_id",- "in": "path",- "description": "id of the attachment entity",- "required": true,- "schema": {- "type": "string"- }- }- ],- "responses": {- "200": {- "description": "",- "content": {- "application/json": {- "schema": {- "$ref": "#/components/schemas/GetAttachmentReferencesResponse"- }- }- }- },- "401": {- "description": "",- "content": {- "text/plain": {- "schema": {- "type": "string"- }- }- }- },- "404": {- "description": "",- "content": {- "text/plain": {- "schema": {- "type": "string"- }- }- }- },- "500": {- "description": "",- "content": {- "text/plain": {- "schema": {- "type": "string"- }- }- }- }- }- }- },- "/comms/channels": {- "post": {- "tags": ["channels"],- "operationId": "create_channel",- "requestBody": {- "content": {- "application/json": {- "schema": {- "$ref": "#/components/schemas/CreateChannelRequest"- }- }- },- "required": true- },- "responses": {- "201": {- "description": "",- "content": {- "application/json": {- "schema": {- "$ref": "#/components/schemas/CreateChannelResponse"- }- }- }- },- "400": {- "description": "",- "content": {- "text/plain": {- "schema": {- "type": "string"- }- }- }- },- "401": {- "description": "",- "content": {- "text/plain": {- "schema": {- "type": "string"- }- }- }- },- "403": {- "description": "",- "content": {- "text/plain": {- "schema": {- "type": "string"- }- }- }- },- "404": {- "description": "",- "content": {- "text/plain": {- "schema": {- "type": "string"- }- }- }- },- "500": {- "description": "",- "content": {- "text/plain": {- "schema": {- "type": "string"- }- }- }- }- }- }- },- "/comms/channels/get_or_create_dm": {- "post": {- "tags": ["channels"],- "description": "given a user and a recipient, either finds or creates a direct message channel",- "operationId": "get_or_create_dm",- "requestBody": {- "content": {- "application/json": {- "schema": {- "$ref": "#/components/schemas/GetOrCreateDmRequest"- }- }- },- "required": true- },- "responses": {- "200": {- "description": "",- "content": {- "application/json": {- "schema": {- "$ref": "#/components/schemas/GetOrCreateDmResponse"- }- }- }- },- "400": {- "description": "",- "content": {- "text/plain": {- "schema": {- "type": "string"- }- }- }- },- "401": {- "description": "",- "content": {- "text/plain": {- "schema": {- "type": "string"- }- }- }- },- "404": {- "description": "",- "content": {- "text/plain": {- "schema": {- "type": "string"- }- }- }- },- "500": {- "description": "",- "content": {- "text/plain": {- "schema": {- "type": "string"- }- }- }- }- }- }- },- "/comms/channels/get_or_create_private": {- "post": {- "tags": ["channels"],- "description": "given a list of partiicpants, either fetch an existing private channel with the permtation or create a new one",- "operationId": "get_or_create_private",- "requestBody": {- "content": {- "application/json": {- "schema": {- "$ref": "#/components/schemas/GetOrCreatePrivateRequest"- }- }- },- "required": true- },- "responses": {- "200": {- "description": "",- "content": {- "application/json": {- "schema": {- "$ref": "#/components/schemas/GetOrCreatePrivateResponse"- }- }- }- },- "400": {- "description": "",- "content": {- "text/plain": {- "schema": {- "type": "string"- }- }- }- },- "401": {- "description": "",- "content": {- "text/plain": {- "schema": {- "type": "string"- }- }- }- },- "404": {- "description": "",- "content": {- "text/plain": {- "schema": {- "type": "string"- }- }- }- },- "500": {- "description": "",- "content": {- "text/plain": {- "schema": {- "type": "string"- }- }- }- }- }- }- },- "/comms/channels/messages/context": {- "get": {- "tags": ["channels"],- "operationId": "get_message_with_context",- "parameters": [- {- "name": "message_id",- "in": "query",- "description": "ID of the message to get context around",- "required": true,- "schema": {- "type": "string"- }- },- {- "name": "before",- "in": "query",- "description": "Number of messages to fetch before the target message (defaults to 0)",- "required": false,- "schema": {- "type": "integer",- "format": "int64"- }- },- {- "name": "after",- "in": "query",- "description": "Number of messages to fetch after the target message (defaults to 0)",- "required": false,- "schema": {- "type": "integer",- "format": "int64"- }- }- ],- "responses": {- "200": {- "description": "Successfully retrieved messages with context",- "content": {- "application/json": {- "schema": {- "$ref": "#/components/schemas/GetMessageWithContextResponse"- }- }- }- },- "400": {- "description": "Invalid request parameters",- "content": {- "text/plain": {- "schema": {- "type": "string"- }- }- }- },- "401": {- "description": "Unauthorized",- "content": {- "text/plain": {- "schema": {- "type": "string"- }- }- }- },- "500": {- "description": "Internal server error",- "content": {- "text/plain": {- "schema": {- "type": "string"- }- }- }- }- }- }- },- "/comms/channels/{channel_id}": {- "get": {- "tags": ["channels"],- "operationId": "get_channel",- "parameters": [- {- "name": "channel_id",- "in": "path",- "description": "id of the channel",- "required": true,- "schema": {- "type": "string"- }- },- {- "name": "since",- "in": "query",- "description": "ISO8601 timestamp to fetch messages since",- "required": false,- "schema": {- "type": "string"- }- },- {- "name": "limit",- "in": "query",- "description": "Maximum number of messages to fetch",- "required": false,- "schema": {- "type": "integer",- "format": "int64"- }- }- ],- "responses": {- "200": {- "description": "",- "content": {- "application/json": {- "schema": {- "$ref": "#/components/schemas/GetChannelResponse"- }- }- }- },- "401": {- "description": "",- "content": {- "text/plain": {- "schema": {- "type": "string"- }- }- }- },- "404": {- "description": "",- "content": {- "text/plain": {- "schema": {- "type": "string"- }- }- }- },- "500": {- "description": "",- "content": {- "text/plain": {- "schema": {- "type": "string"- }- }- }- }- }- },- "delete": {- "tags": ["channels"],- "operationId": "delete_channel",- "parameters": [- {- "name": "channel_id",- "in": "path",- "description": "id of the channel",- "required": true,- "schema": {- "type": "string"- }- }- ],- "responses": {- "204": {- "description": "",- "content": {- "text/plain": {- "schema": {- "type": "string"- }- }- }- },- "400": {- "description": "",- "content": {- "text/plain": {- "schema": {- "type": "string"- }- }- }- },- "404": {- "description": "",- "content": {- "text/plain": {- "schema": {- "type": "string"- }- }- }- },- "500": {- "description": "",- "content": {- "text/plain": {- "schema": {- "type": "string"- }- }- }- }- }- },- "patch": {- "tags": ["channels"],- "operationId": "patch_channel",- "parameters": [- {- "name": "channel_id",- "in": "path",- "description": "id of the channel",- "required": true,- "schema": {- "type": "string"- }- }- ],- "requestBody": {- "content": {- "application/json": {- "schema": {- "$ref": "#/components/schemas/PatchChannelOptions"- }- }- },- "required": true- },- "responses": {- "200": {- "description": "",- "content": {- "text/plain": {- "schema": {- "type": "string"- }- }- }- },- "500": {- "description": "",- "content": {- "text/plain": {- "schema": {- "type": "string"- }- }- }- }- }- }- },- "/comms/channels/{channel_id}/join": {- "post": {- "tags": ["channels"],- "description": "allows a user to attempt to join a channel",- "operationId": "join_channel",- "parameters": [- {- "name": "channel_id",- "in": "path",- "description": "channel id",- "required": true,- "schema": {- "type": "string"- }- }- ],- "responses": {- "200": {- "description": ""- },- "401": {- "description": "",- "content": {- "text/plain": {- "schema": {- "type": "string"- }- }- }- },- "404": {- "description": "",- "content": {- "text/plain": {- "schema": {- "type": "string"- }- }- }- },- "500": {- "description": "",- "content": {- "text/plain": {- "schema": {- "type": "string"- }- }- }- }- }- }- },- "/comms/channels/{channel_id}/leave": {- "post": {- "tags": ["channels"],- "description": "allows a user to attempt to leave a channel",- "operationId": "leave_channel",- "parameters": [- {- "name": "channel_id",- "in": "path",- "description": "channel id",- "required": true,- "schema": {- "type": "string"- }- }- ],- "responses": {- "200": {- "description": ""- },- "401": {- "description": "",- "content": {- "text/plain": {- "schema": {- "type": "string"- }- }- }- },- "404": {- "description": "",- "content": {- "text/plain": {- "schema": {- "type": "string"- }- }- }- },- "500": {- "description": "",- "content": {- "text/plain": {- "schema": {- "type": "string"- }- }- }- }- }- }- },- "/comms/channels/{channel_id}/mentions": {- "get": {- "tags": ["channels"],- "operationId": "get_mentions_for_channel",- "parameters": [- {- "name": "channel_id",- "in": "path",- "description": "id of the channel",- "required": true,- "schema": {- "type": "string"- }- }- ],- "responses": {- "200": {- "description": "",- "content": {- "application/json": {- "schema": {- "$ref": "#/components/schemas/GetMentionsResponse"- }- }- }- },- "401": {- "description": "",- "content": {- "text/plain": {- "schema": {- "type": "string"- }- }- }- },- "404": {- "description": "",- "content": {- "text/plain": {- "schema": {- "type": "string"- }- }- }- },- "500": {- "description": "",- "content": {- "text/plain": {- "schema": {- "type": "string"- }- }- }- }- }- }- },- "/comms/channels/{channel_id}/message": {- "post": {- "tags": ["channels"],- "operationId": "post_message",- "parameters": [- {- "name": "channel_id",- "in": "path",- "description": "id of the channel",- "required": true,- "schema": {- "type": "string"- }- }- ],- "requestBody": {- "content": {- "application/json": {- "schema": {- "$ref": "#/components/schemas/PostMessageRequest"- }- }- },- "required": true- },- "responses": {- "201": {- "description": "",- "content": {- "application/json": {- "schema": {- "$ref": "#/components/schemas/PostMessageResponse"- }- }- }- },- "401": {- "description": "",- "content": {- "text/plain": {- "schema": {- "type": "string"- }- }- }- },- "404": {- "description": "",- "content": {- "text/plain": {- "schema": {- "type": "string"- }- }- }- },- "500": {- "description": "",- "content": {- "text/plain": {- "schema": {- "type": "string"- }- }- }- }- }- }- },- "/comms/channels/{channel_id}/message/{message_id}": {- "delete": {- "tags": ["channels"],- "operationId": "delete_message",- "parameters": [- {- "name": "channel_id",- "in": "path",- "description": "id of the channel",- "required": true,- "schema": {- "type": "string"- }- },- {- "name": "message_id",- "in": "path",- "description": "id of the message",- "required": true,- "schema": {- "type": "string"- }- }- ],- "responses": {- "201": {- "description": "",- "content": {- "text/plain": {- "schema": {- "type": "string"- }- }- }- },- "401": {- "description": "",- "content": {- "text/plain": {- "schema": {- "type": "string"- }- }- }- },- "404": {- "description": "",- "content": {- "text/plain": {- "schema": {- "type": "string"- }- }- }- },- "500": {- "description": "",- "content": {- "text/plain": {- "schema": {- "type": "string"- }- }- }- }- }- },- "patch": {- "tags": ["channels"],- "operationId": "patch_message",- "parameters": [- {- "name": "channel_id",- "in": "path",- "description": "id of the channel",- "required": true,- "schema": {- "type": "string"- }- },- {- "name": "message_id",- "in": "path",- "description": "id of the message",- "required": true,- "schema": {- "type": "string"- }- }- ],- "requestBody": {- "content": {- "application/json": {- "schema": {- "$ref": "#/components/schemas/PatchMessageRequest"- }- }- },- "required": true- },- "responses": {- "201": {- "description": "",- "content": {- "text/plain": {- "schema": {- "type": "string"- }- }- }- },- "401": {- "description": "",- "content": {- "text/plain": {- "schema": {- "type": "string"- }- }- }- },- "404": {- "description": "",- "content": {- "text/plain": {- "schema": {- "type": "string"- }- }- }- },- "500": {- "description": "",- "content": {- "text/plain": {- "schema": {- "type": "string"- }- }- }- }- }- }- },- "/comms/channels/{channel_id}/participants": {- "post": {- "tags": ["channels"],- "description": "adds a list of participants to the channel, user must be a participant",- "operationId": "add_participants",- "parameters": [- {- "name": "channel_id",- "in": "path",- "description": "channel id",- "required": true,- "schema": {- "type": "string"- }- }- ],- "requestBody": {- "content": {- "application/json": {- "schema": {- "$ref": "#/components/schemas/AddParticipantsRequest"- }- }- },- "required": true- },- "responses": {- "200": {- "description": ""- },- "401": {- "description": "",- "content": {- "text/plain": {- "schema": {- "type": "string"- }- }- }- },- "404": {- "description": "",- "content": {- "text/plain": {- "schema": {- "type": "string"- }- }- }- },- "500": {- "description": "",- "content": {- "text/plain": {- "schema": {- "type": "string"- }- }- }- }- }- },- "delete": {- "tags": ["channels"],- "description": "removes a list of participants from the channel, user must be a participant",- "operationId": "remove_participants",- "parameters": [- {- "name": "channel_id",- "in": "path",- "description": "channel id",- "required": true,- "schema": {- "type": "string"- }- }- ],- "requestBody": {- "content": {- "application/json": {- "schema": {- "$ref": "#/components/schemas/RemoveParticipantsRequest"- }- }- },- "required": true- },- "responses": {- "200": {- "description": ""- },- "401": {- "description": "",- "content": {- "text/plain": {- "schema": {- "type": "string"- }- }- }- },- "404": {- "description": "",- "content": {- "text/plain": {- "schema": {- "type": "string"- }- }- }- },- "500": {- "description": "",- "content": {- "text/plain": {- "schema": {- "type": "string"- }- }- }- }- }- }- },- "/comms/channels/{channel_id}/reaction": {- "post": {- "tags": ["channels"],- "operationId": "post_reaction",- "parameters": [- {- "name": "channel_id",- "in": "path",- "description": "id of the channel",- "required": true,- "schema": {- "type": "string"- }- }- ],- "requestBody": {- "content": {- "application/json": {- "schema": {- "$ref": "#/components/schemas/PostReactionRequest"- }- }- },- "required": true- },- "responses": {- "201": {- "description": "",- "content": {- "text/plain": {- "schema": {- "type": "string"- }- }- }- },- "401": {- "description": "",- "content": {- "text/plain": {- "schema": {- "type": "string"- }- }- }- },- "404": {- "description": "",- "content": {- "text/plain": {- "schema": {- "type": "string"- }- }- }- },- "500": {- "description": "",- "content": {- "text/plain": {- "schema": {- "type": "string"- }- }- }- }- }- }- },- "/comms/channels/{channel_id}/typing": {- "post": {- "tags": ["channels"],- "operationId": "post_typing",- "parameters": [- {- "name": "channel_id",- "in": "path",- "description": "id of the channel",- "required": true,- "schema": {- "type": "string"- }- }- ],- "requestBody": {- "content": {- "application/json": {- "schema": {- "$ref": "#/components/schemas/PostTypingRequest"- }- }- },- "required": true- },- "responses": {- "201": {- "description": "",- "content": {- "text/plain": {- "schema": {- "type": "string"- }- }- }- },- "401": {- "description": "",- "content": {- "text/plain": {- "schema": {- "type": "string"- }- }- }- },- "404": {- "description": "",- "content": {- "text/plain": {- "schema": {- "type": "string"- }- }- }- },- "500": {- "description": "",- "content": {- "text/plain": {- "schema": {- "type": "string"- }- }- }- }- }- }- },- "/comms/mentions": {- "post": {- "tags": ["mentions"],- "operationId": "create_mention_handler",- "requestBody": {- "content": {- "application/json": {- "schema": {- "$ref": "#/components/schemas/CreateEntityMentionRequest"- }- }- },- "required": true- },- "responses": {- "201": {- "description": "Entity mention created successfully",- "content": {- "application/json": {- "schema": {- "$ref": "#/components/schemas/CreateEntityMentionResponse"- }- }- }- },- "400": {- "description": "Invalid request parameters"- },- "500": {- "description": "Internal server error"- }- }- }- },- "/comms/mentions/{mention_id}": {- "delete": {- "tags": ["mentions"],- "operationId": "delete_mention_handler",- "parameters": [- {- "name": "mention_id",- "in": "path",- "description": "UUID of the entity mention to delete",- "required": true,- "schema": {- "type": "string"- }- }- ],- "responses": {- "200": {- "description": "Entity mention deleted successfully",- "content": {- "application/json": {- "schema": {- "$ref": "#/components/schemas/DeleteEntityMentionResponse"- }- }- }- },- "400": {- "description": "Invalid request parameters"- },- "403": {- "description": "Insufficient permissions"- },- "404": {- "description": "Entity mention not found"- },- "500": {- "description": "Internal server error"- }- }- }- },- "/comms/preview": {- "post": {- "tags": ["preview"],- "operationId": "get_batch_channel_preview",- "requestBody": {- "content": {- "application/json": {- "schema": {- "$ref": "#/components/schemas/GetBatchChannelPreviewRequest"- }- }- },- "required": true- },- "responses": {- "200": {- "description": "",- "content": {- "application/json": {- "schema": {- "$ref": "#/components/schemas/GetBatchChannelPreviewResponse"- }- }- }- },- "401": {- "description": "",- "content": {- "application/json": {- "schema": {- "$ref": "#/components/schemas/GenericErrorResponse"- }- }- }- },- "404": {- "description": "",- "content": {- "application/json": {- "schema": {- "$ref": "#/components/schemas/GenericErrorResponse"- }- }- }- },- "500": {- "description": "",- "content": {- "application/json": {- "schema": {- "$ref": "#/components/schemas/GenericErrorResponse"- }- }- }- }- }- }- }- },- "components": {- "schemas": {- "Activity": {- "type": "object",- "description": "Represents a user's activity in a channel",- "required": ["id", "user_id", "channel_id", "created_at", "updated_at"],- "properties": {- "channel_id": {- "type": "string",- "format": "uuid"- },- "created_at": {- "type": "string",- "format": "date-time"- },- "id": {- "type": "string",- "format": "uuid"- },- "interacted_at": {- "type": ["string", "null"],- "format": "date-time",- "description": "the last time the user intereacted with the channel\neg. reacting, replying, sending a message"- },- "updated_at": {- "type": "string",- "format": "date-time"- },- "user_id": {- "type": "string"- },- "viewed_at": {- "type": ["string", "null"],- "format": "date-time",- "description": "the last time the user viewed the channel"- }- }- },- "ActivityType": {- "type": "string",- "enum": ["view", "interact"]- },- "AddParticipantsRequest": {- "type": "object",- "required": ["participants"],- "properties": {- "participants": {- "type": "array",- "items": {- "type": "string"- }- }- }- },- "ApiActivity": {- "type": "object",- "required": ["id", "user_id", "channel_id", "created_at", "updated_at"],- "properties": {- "channel_id": {- "type": "string",- "format": "uuid"- },- "created_at": {- "type": "string",- "format": "date-time"- },- "id": {- "type": "string",- "format": "uuid"- },- "interacted_at": {- "type": ["string", "null"],- "format": "date-time",- "description": "the last time the user intereacted with the channel\neg. reacting, replying, sending a message"- },- "updated_at": {- "type": "string",- "format": "date-time"- },- "user_id": {- "type": "string"- },- "viewed_at": {- "type": ["string", "null"],- "format": "date-time",- "description": "the last time the user viewed the channel"- }- }- },- "ApiChannelWithLatest": {- "allOf": [- {- "$ref": "#/components/schemas/ChannelWithParticipants"- },- {- "$ref": "#/components/schemas/LatestMessage"- },- {- "type": "object",- "properties": {- "frecency_score": {- "type": ["number", "null"],- "format": "double"- },- "interacted_at": {- "type": ["string", "null"],- "format": "date-time"- },- "viewed_at": {- "type": ["string", "null"],- "format": "date-time"- }- }- }- ]- },- "Attachment": {- "type": "object",- "required": [- "id",- "channel_id",- "message_id",- "entity_type",- "entity_id",- "created_at"- ],- "properties": {- "channel_id": {- "type": "string",- "format": "uuid"- },- "created_at": {- "type": "string",- "format": "date-time"- },- "entity_id": {- "type": "string"- },- "entity_type": {- "type": "string"- },- "height": {- "type": ["integer", "null"],- "format": "int32"- },- "id": {- "type": "string",- "format": "uuid"- },- "message_id": {- "type": "string",- "format": "uuid"- },- "width": {- "type": ["integer", "null"],- "format": "int32",- "description": "dimensions of image/video"- }- }- },- "Channel": {- "type": "object",- "required": [- "id",- "channel_type",- "created_at",- "updated_at",- "owner_id"- ],- "properties": {- "channel_type": {- "$ref": "#/components/schemas/ChannelType",- "description": "type of the channel"- },- "created_at": {- "type": "string",- "format": "date-time",- "description": "timestamp of when the channel was created"- },- "id": {- "type": "string",- "format": "uuid",- "description": "uuid of the channel"- },- "name": {- "type": ["string", "null"],- "description": "string name of the channel"- },- "org_id": {- "type": ["integer", "null"],- "format": "int32",- "description": "id of the organization this channel belongs too",- "minimum": 0- },- "owner_id": {- "type": "string",- "description": "id of the user who created the channel"- },- "updated_at": {- "type": "string",- "format": "date-time",- "description": "timestamp of when the channel was last updated"- }- }- },- "ChannelMessage": {- "type": "object",- "required": [- "message_id",- "sender_id",- "content",- "created_at",- "updated_at",- "mentions"- ],- "properties": {- "content": {- "type": "string"- },- "created_at": {- "type": "string",- "format": "date-time"- },- "deleted_at": {- "type": ["string", "null"],- "format": "date-time"- },- "mentions": {- "type": "array",- "items": {- "type": "string"- },- "description": "message mentions formatted as `{ENTITY_TYPE}:{ENTITY_ID}`"- },- "message_id": {- "type": "string",- "format": "uuid"- },- "sender_id": {- "type": "string"- },- "thread_id": {- "type": ["string", "null"],- "format": "uuid"- },- "updated_at": {- "type": "string",- "format": "date-time"- }- }- },- "ChannelParticipant": {- "type": "object",- "required": ["channel_id", "user_id", "role", "joined_at"],- "properties": {- "channel_id": {- "type": "string",- "format": "uuid",- "description": "id of the channel"- },- "joined_at": {- "type": "string",- "format": "date-time",- "description": "timestamp of when the user joined the channel"- },- "left_at": {- "type": ["string", "null"],- "format": "date-time",- "description": "timestamp of when the user left the channel"- },- "role": {- "$ref": "#/components/schemas/ParticipantRole",- "description": "type of the participant"- },- "user_id": {- "type": "string",- "description": "id of the user"- }- }- },- "ChannelPreview": {- "oneOf": [- {- "allOf": [- {- "$ref": "#/components/schemas/ChannelPreviewData"- },- {- "type": "object",- "required": ["type"],- "properties": {- "type": {- "type": "string",- "enum": ["access"]- }- }- }- ]- },- {- "allOf": [- {- "$ref": "#/components/schemas/WithChannelId"- },- {- "type": "object",- "required": ["type"],- "properties": {- "type": {- "type": "string",- "enum": ["no_access"]- }- }- }- ]- },- {- "allOf": [- {- "$ref": "#/components/schemas/WithChannelId"- },- {- "type": "object",- "required": ["type"],- "properties": {- "type": {- "type": "string",- "enum": ["does_not_exist"]- }- }- }- ]- }- ]- },- "ChannelPreviewData": {- "type": "object",- "required": ["channel_id", "channel_name", "channel_type"],- "properties": {- "channel_id": {- "type": "string"- },- "channel_name": {- "type": "string"- },- "channel_type": {- "$ref": "#/components/schemas/ChannelType"- }- }- },- "ChannelReference": {- "type": "object",- "description": "Representation of a reference from a channel/message",- "required": [- "channel_id",- "message_id",- "sender_id",- "message_content",- "message_created_at",- "attachment_created_at"- ],- "properties": {- "attachment_created_at": {- "type": "string",- "format": "date-time",- "description": "When the attachment row was created (normally identical to message\ncreation, but stored separately just in case)"- },- "channel_id": {- "type": "string",- "format": "uuid",- "description": "Channel that contains the message"- },- "channel_name": {- "type": ["string", "null"],- "description": "Optional channel name (DMs do not have a name)"- },- "message_content": {- "type": "string",- "description": "Full message content (might be used for preview/snippet)"- },- "message_created_at": {- "type": "string",- "format": "date-time",- "description": "When the message itself was created"- },- "message_id": {- "type": "string",- "format": "uuid",- "description": "Message that contains the attachment reference"- },- "sender_id": {- "type": "string",- "description": "Sender of the message"- },- "thread_id": {- "type": ["string", "null"],- "format": "uuid",- "description": "If the message belongs to a thread this is the parent id"- }- }- },- "ChannelType": {- "type": "string",- "enum": ["public", "organization", "private", "direct_message", "team"]- },- "ChannelWithParticipants": {- "allOf": [- {- "$ref": "#/components/schemas/Channel"- },- {- "type": "object",- "required": ["participants"],- "properties": {- "participants": {- "type": "array",- "items": {- "$ref": "#/components/schemas/ChannelParticipant"- }- }- }- }- ]- },- "CommunicationServiceApiVersion": {- "type": "string",- "enum": ["v1"]- },- "CountedReaction": {- "type": "object",- "required": ["emoji", "users"],- "properties": {- "emoji": {- "type": "string"- },- "users": {- "type": "array",- "items": {- "type": "string"- }- }- }- },- "CreateChannelRequest": {- "type": "object",- "required": ["channel_type", "participants"],- "properties": {- "channel_type": {- "$ref": "#/components/schemas/ChannelType",- "description": "The type of channel"- },- "name": {- "type": ["string", "null"],- "description": "Optionally a name for the channel"- },- "participants": {- "type": "array",- "items": {- "type": "string"- },- "description": "list of participants not including the owner"- },- "team_id": {- "type": ["string", "null"],- "format": "uuid",- "description": "If the channel_type is team, provide the id of the team you are creating the channel for"- }- }- },- "CreateChannelResponse": {- "type": "object",- "required": ["id"],- "properties": {- "id": {- "type": "string"- }- }- },- "CreateEntityMentionRequest": {- "type": "object",- "required": [- "source_entity_type",- "source_entity_id",- "entity_type",- "entity_id"- ],- "properties": {- "entity_id": {- "type": "string"- },- "entity_type": {- "type": "string"- },- "source_entity_id": {- "type": "string"- },- "source_entity_type": {- "type": "string"- }- }- },- "CreateEntityMentionResponse": {- "type": "object",- "required": [- "id",- "source_entity_type",- "source_entity_id",- "entity_type",- "entity_id",- "created_at"- ],- "properties": {- "created_at": {- "type": "string",- "format": "date-time"- },- "entity_id": {- "type": "string"- },- "entity_type": {- "type": "string"- },- "id": {- "type": "string"- },- "source_entity_id": {- "type": "string"- },- "source_entity_type": {- "type": "string"- },- "user_id": {- "type": ["string", "null"]- }- }- },- "DeleteEntityMentionRequest": {- "type": "object",- "required": ["entity_mention_id"],- "properties": {- "entity_mention_id": {- "type": "string"- }- }- },- "DeleteEntityMentionResponse": {- "type": "object",- "required": ["deleted"],- "properties": {- "deleted": {- "type": "boolean"- }- }- },- "DeleteMessageParams": {- "type": "object",- "required": ["channel_id", "message_id"],- "properties": {- "channel_id": {- "type": "string"- },- "message_id": {- "type": "string"- }- }- },- "EntityMention": {- "type": "object",- "required": [- "id",- "source_entity_type",- "source_entity_id",- "entity_type",- "entity_id",- "created_at"- ],- "properties": {- "created_at": {- "type": "string",- "format": "date-time"- },- "entity_id": {- "type": "string"- },- "entity_type": {- "type": "string"- },- "id": {- "type": "string",- "format": "uuid"- },- "source_entity_id": {- "type": "string"- },- "source_entity_type": {- "type": "string"- },- "user_id": {- "type": ["string", "null"]- }- }- },- "EntityReference": {- "oneOf": [- {- "allOf": [- {- "$ref": "#/components/schemas/ChannelReference",- "description": "An entity was referenced from a channel"- },- {- "type": "object",- "required": ["reference_type"],- "properties": {- "reference_type": {- "type": "string",- "enum": ["channel"]- }- }- }- ],- "description": "An entity was referenced from a channel"- },- {- "allOf": [- {- "$ref": "#/components/schemas/GenericReference",- "description": "An entity was referenced from anything but a channel"- },- {- "type": "object",- "required": ["reference_type"],- "properties": {- "reference_type": {- "type": "string",- "enum": ["generic"]- }- }- }- ],- "description": "An entity was referenced from anything but a channel"- }- ]- },- "GenericErrorResponse": {- "type": "object",- "required": ["error", "message"],- "properties": {- "error": {- "type": "boolean",- "description": "Indicates if an error occurred"- },- "message": {- "type": "string",- "description": "Message to explain failure"- }- }- },- "GenericReference": {- "type": "object",- "description": "Representation of a reference from any entity type",- "required": [- "source_entity_type",- "source_entity_id",- "entity_type",- "entity_id",- "created_at"- ],- "properties": {- "created_at": {- "type": "string",- "format": "date-time",- "description": "When this reference was created"- },- "entity_id": {- "type": "string",- "description": "ID of the referenced entity"- },- "entity_type": {- "type": "string",- "description": "Type of the referenced entity"- },- "metadata": {- "description": "Optional metadata specific to the source type"- },- "source_entity_id": {- "type": "string",- "description": "ID of the source entity"- },- "source_entity_type": {- "type": "string",- "description": "Type of the source entity (e.g., \"document\", \"chat\", etc.)"- },- "user_id": {- "type": ["string", "null"],- "description": "User who created this reference (optional for non-user sources like channels)"- }- }- },- "GetAttachmentReferencesResponse": {- "type": "object",- "required": ["references"],- "properties": {- "references": {- "type": "array",- "items": {- "$ref": "#/components/schemas/EntityReference"- }- }- }- },- "GetBatchChannelPreviewRequest": {- "type": "object",- "required": ["channel_ids"],- "properties": {- "channel_ids": {- "type": "array",- "items": {- "type": "string"- }- }- }- },- "GetBatchChannelPreviewResponse": {- "type": "object",- "required": ["previews"],- "properties": {- "previews": {- "type": "array",- "items": {- "$ref": "#/components/schemas/ChannelPreview"- }- }- }- },- "GetChannelResponse": {- "type": "object",- "required": [- "channel",- "participants",- "messages",- "reactions",- "attachments",- "access"- ],- "properties": {- "access": {- "$ref": "#/components/schemas/ParticipantAccess",- "description": "What kind of access the user has to the channel\nalmost always this should be [Access(ParticipantType)]"- },- "activity": {- "oneOf": [- {- "type": "null"- },- {- "$ref": "#/components/schemas/Activity",- "description": "the last activity for the given user on this channel"- }- ]- },- "attachments": {- "type": "array",- "items": {- "$ref": "#/components/schemas/Attachment"- },- "description": "Attachments that are linked to messages in this channel"- },- "channel": {- "$ref": "#/components/schemas/Channel",- "description": "information about the channel"- },- "messages": {- "type": "array",- "items": {- "$ref": "#/components/schemas/Message"- },- "description": "messages"- },- "participants": {- "type": "array",- "items": {- "$ref": "#/components/schemas/ChannelParticipant"- },- "description": "list of participants"- },- "reactions": {- "type": "object",- "description": "reactions grouped by message",- "additionalProperties": {- "type": "array",- "items": {- "$ref": "#/components/schemas/CountedReaction"- }- },- "propertyNames": {- "type": "string"- }- }- }- },- "GetMentionsResponse": {- "type": "object",- "required": ["mentions"],- "properties": {- "mentions": {- "type": "array",- "items": {- "$ref": "#/components/schemas/MessageMention"- }- }- }- },- "GetMessageWithContextResponse": {- "type": "object",- "required": ["messages"],- "properties": {- "messages": {- "type": "array",- "items": {- "$ref": "#/components/schemas/Message"- }- }- }- },- "GetOrCreateAction": {- "type": "string",- "enum": ["get", "create"]- },- "GetOrCreateDmRequest": {- "type": "object",- "required": ["recipient_id"],- "properties": {- "recipient_id": {- "type": "string"- }- }- },- "GetOrCreateDmResponse": {- "type": "object",- "required": ["channel_id", "action"],- "properties": {- "action": {- "$ref": "#/components/schemas/GetOrCreateAction"- },- "channel_id": {- "type": "string"- }- }- },- "GetOrCreatePrivateRequest": {- "type": "object",- "required": ["recipients"],- "properties": {- "recipients": {- "type": "array",- "items": {- "type": "string"- }- }- }- },- "GetOrCreatePrivateResponse": {- "type": "object",- "required": ["channel_id", "action"],- "properties": {- "action": {- "$ref": "#/components/schemas/GetOrCreateAction"- },- "channel_id": {- "type": "string"- }- }- },- "LatestMessage": {- "type": "object",- "properties": {- "latest_message": {- "oneOf": [- {- "type": "null"- },- {- "$ref": "#/components/schemas/ChannelMessage"- }- ]- },- "latest_non_thread_message": {- "oneOf": [- {- "type": "null"- },- {- "$ref": "#/components/schemas/ChannelMessage"- }- ]- }- }- },- "Message": {- "type": "object",- "required": [- "id",- "channel_id",- "sender_id",- "content",- "created_at",- "updated_at"- ],- "properties": {- "channel_id": {- "type": "string",- "format": "uuid"- },- "content": {- "type": "string"- },- "created_at": {- "type": "string",- "format": "date-time"- },- "deleted_at": {- "type": ["string", "null"],- "format": "date-time"- },- "edited_at": {- "type": ["string", "null"],- "format": "date-time"- },- "id": {- "type": "string",- "format": "uuid"- },- "sender_id": {- "type": "string"- },- "thread_id": {- "type": ["string", "null"],- "format": "uuid"- },- "updated_at": {- "type": "string",- "format": "date-time"- }- }- },- "MessageMention": {- "type": "object",- "required": ["message_id", "entity_type", "entity_id", "created_at"],- "properties": {- "created_at": {- "type": "string",- "format": "date-time"- },- "entity_id": {- "type": "string"- },- "entity_type": {- "type": "string"- },- "message_id": {- "type": "string",- "format": "uuid"- }- }- },- "NewAttachment": {- "type": "object",- "required": ["entity_type", "entity_id"],- "properties": {- "entity_id": {- "type": "string"- },- "entity_type": {- "type": "string"- },- "height": {- "type": ["integer", "null"],- "format": "int32",- "description": "dimensions of image/video"- },- "width": {- "type": ["integer", "null"],- "format": "int32"- }- }- },- "ParticipantAccess": {- "oneOf": [- {- "type": "object",- "required": ["Access"],- "properties": {- "Access": {- "type": "object",- "required": ["role"],- "properties": {- "role": {- "$ref": "#/components/schemas/ParticipantRole"- }- }- }- }- },- {- "type": "string",- "enum": ["NoAccess"]- }- ]- },- "ParticipantRole": {- "type": "string",- "enum": ["owner", "admin", "member"]- },- "PatchChannelOptions": {- "type": "object",- "properties": {- "channel_name": {- "type": ["string", "null"]- }- }- },- "PatchMessageParams": {- "type": "object",- "required": ["channel_id", "message_id"],- "properties": {- "channel_id": {- "type": "string"- },- "message_id": {- "type": "string"- }- }- },- "PatchMessageRequest": {- "type": "object",- "properties": {- "attachment_ids_to_delete": {- "type": ["array", "null"],- "items": {- "type": "string"- }- },- "attachments_to_add": {- "type": ["array", "null"],- "items": {- "$ref": "#/components/schemas/NewAttachment"- }- },- "content": {- "type": ["string", "null"]- },- "mentions": {- "type": ["array", "null"],- "items": {- "$ref": "#/components/schemas/SimpleMention"- }- },- "nonce": {- "type": ["string", "null"]- }- }- },- "PostActivityRequest": {- "type": "object",- "required": ["channel_id", "activity_type"],- "properties": {- "activity_type": {- "$ref": "#/components/schemas/ActivityType"- },- "channel_id": {- "type": "string"- }- }- },- "PostMessageRequest": {- "type": "object",- "required": ["content", "mentions", "attachments"],- "properties": {- "attachments": {- "type": "array",- "items": {- "$ref": "#/components/schemas/NewAttachment"- }- },- "content": {- "type": "string"- },- "mentions": {- "type": "array",- "items": {- "$ref": "#/components/schemas/SimpleMention"- }- },- "nonce": {- "type": ["string", "null"]- },- "thread_id": {- "type": ["string", "null"],- "format": "uuid"- }- }- },- "PostMessageResponse": {- "type": "object",- "required": ["id"],- "properties": {- "id": {- "type": "string"- },- "nonce": {- "type": ["string", "null"]- }- }- },- "PostReactionRequest": {- "type": "object",- "required": ["emoji", "message_id", "action"],- "properties": {- "action": {- "$ref": "#/components/schemas/ReactionAction"- },- "emoji": {- "type": "string"- },- "message_id": {- "type": "string"- },- "nonce": {- "type": ["string", "null"]- }- }- },- "PostTypingRequest": {- "type": "object",- "required": ["action"],- "properties": {- "action": {- "$ref": "#/components/schemas/TypingAction"- },- "nonce": {- "type": ["string", "null"]- },- "thread_id": {- "type": ["string", "null"]- }- }- },- "Reaction": {- "type": "object",- "required": ["message_id", "user_id", "emoji", "created_at"],- "properties": {- "created_at": {- "type": "string",- "format": "date-time"- },- "emoji": {- "type": "string"- },- "message_id": {- "type": "string",- "format": "uuid"- },- "user_id": {- "type": "string"- }- }- },- "ReactionAction": {- "type": "string",- "enum": ["Add", "Remove"]- },- "RemoveParticipantsRequest": {- "type": "object",- "required": ["participants"],- "properties": {- "participants": {- "type": "array",- "items": {- "type": "string"- }- }- }- },- "SimpleMention": {- "type": "object",- "required": ["entity_type", "entity_id"],- "properties": {- "entity_id": {- "type": "string"- },- "entity_type": {- "type": "string"- }- }- },- "StringIDResponse": {- "type": "object",- "required": ["id"],- "properties": {- "id": {- "type": "string"- }- }- },- "TypingAction": {- "type": "string",- "enum": ["start", "stop"]- },- "WithChannelId": {- "type": "object",- "required": ["channel_id"],- "properties": {- "channel_id": {- "type": "string"- }- }- }- }- },- "tags": [- {- "name": "macro comms service",- "description": "Comms Service"- }- ]-}diff --git a/js/app/packages/service-clients/service-storage/channel-list-types.ts b/js/app/packages/service-clients/service-storage/channel-list-types.tsnew file mode 100644index 0000000000..edb4b0dedf--- /dev/null+++ b/js/app/packages/service-clients/service-storage/channel-list-types.ts@@ -0,0 +1,22 @@+// Hand-written types for the channel-list read model returned by `GET /comms/channels`+// (served by the comms hex). The response flattens the channel, its participants, and the+// latest-message info into a single object, so these mirror that flattened shape using the+// generated service-storage primitives. (Previously generated as `@service-comms`'s+// `ApiChannelWithLatest`; service-storage's generated `SoupChannel` nests these under+// `.channel` and is therefore not interchangeable.)+import type { Channel } from './generated/schemas/channel';+import type { ChannelParticipant } from './generated/schemas/channelParticipant';+import type { LatestMessage } from './generated/schemas/latestMessage';++/** Channel metadata with its participants (channel fields flattened to the top level). */+export type ChannelWithParticipants = Channel & {+ participants: ChannelParticipant[];+};++/** A channel-list item: channel + participants + latest message + the viewer's read state. */+export type ApiChannelWithLatest = ChannelWithParticipants &+ LatestMessage & {+ frecency_score?: number | null;+ interacted_at?: string | null;+ viewed_at?: string | null;+ };diff --git a/js/app/packages/service-clients/service-storage/client.ts b/js/app/packages/service-clients/service-storage/client.tsindex 2acef30907..c92226d5a9 100644--- a/js/app/packages/service-clients/service-storage/client.ts+++ b/js/app/packages/service-clients/service-storage/client.ts@@ -24,9 +24,9 @@ import type { ResultError } from '@core/util/result';import type { SafeFetchInit } from '@core/util/safeFetch';import type { IDocumentStorageServiceFile } from '@filesystem/file';-import type { ApiChannelWithLatest } from '@service-comms/generated/models/apiChannelWithLatest';import { platformFetch } from 'core/util/platformFetch';import { err, ok, type Result } from 'neverthrow';+import type { ApiChannelWithLatest } from './channel-list-types';import type {AccessLevel,CallRecordPreview,diff --git a/js/app/packages/service-clients/service-storage/generated/schemas/apiChannelDetail.ts b/js/app/packages/service-clients/service-storage/generated/schemas/apiChannelDetail.tsnew file mode 100644index 0000000000..e25ccf2426--- /dev/null+++ b/js/app/packages/service-clients/service-storage/generated/schemas/apiChannelDetail.ts@@ -0,0 +1,29 @@+/**+ * Generated by orval v7.21.0 🍺+ * Do not edit manually.+ * document_storage_service+ * OpenAPI spec version: 0.1.0+ */++import type { ApiChannelMessage } from './apiChannelMessage';+import type { ApiChannelParticipant } from './apiChannelParticipant';+import type { ChannelType } from './channelType';++/**+ * Channel detail: metadata, active participants, and a recent page of messages.++`messages` is the newest-first first page (size controlled by `limit`); use the+dedicated `/{channel_id}/messages` endpoint for cursor pagination.+ */+export interface ApiChannelDetail {+ /** Channel id. */+ channel_id: string;+ /** Resolved display name from the viewer's perspective. */+ channel_name: string;+ /** Channel type. */+ channel_type: ChannelType;+ /** Recent messages (newest-first first page). */+ messages: ApiChannelMessage[];+ /** Active participants. */+ participants: ApiChannelParticipant[];+}diff --git a/js/app/packages/service-clients/service-comms/generated/models/getChannelParams.ts b/js/app/packages/service-clients/service-storage/generated/schemas/getChannelParams.tssimilarity index 55%rename from js/app/packages/service-clients/service-comms/generated/models/getChannelParams.tsrename to js/app/packages/service-clients/service-storage/generated/schemas/getChannelParams.tsindex ab6f7f6746..2b9720a3f8 100644--- a/js/app/packages/service-clients/service-comms/generated/models/getChannelParams.ts+++ b/js/app/packages/service-clients/service-storage/generated/schemas/getChannelParams.ts@@ -1,17 +1,14 @@/*** Generated by orval v7.21.0 🍺* Do not edit manually.- * comms_service+ * document_storage_service* OpenAPI spec version: 0.1.0*/export type GetChannelParams = {/**- * ISO8601 timestamp to fetch messages since- */- since?: string;- /**- * Maximum number of messages to fetch+ * Recent message page size (1-100, default 50)+ * @minimum 0*/limit?: number;};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.tsindex 331a002905..a90627f476 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@@ -65,6 +65,7 @@ export * from './apiChannelContextMessage';export * from './apiChannelContextMessageDeletedAt';export * from './apiChannelContextMessageEditedAt';export * from './apiChannelContextMessageThreadId';+export * from './apiChannelDetail';export * from './apiChannelMessage';export * from './apiChannelMessageDeletedAt';export * from './apiChannelMessageEditedAt';@@ -464,6 +465,7 @@ export * from './getBatchProjectPreviewRequest';export * from './getBatchProjectPreviewResponse';export * from './getChannelAttachmentsParams';export * from './getChannelMessagesParams';+export * from './getChannelParams';export * from './getDocumentKeyResponse';export * from './getDocumentKeyResponseData';export * from './getDocumentListResult';diff --git a/js/app/packages/service-clients/service-storage/generated/zod.ts b/js/app/packages/service-clients/service-storage/generated/zod.tsindex 49d0b02c5d..cd9622f606 100644--- a/js/app/packages/service-clients/service-storage/generated/zod.ts+++ b/js/app/packages/service-clients/service-storage/generated/zod.ts@@ -1558,6 +1558,203 @@ export const getBatchChannelPreviewResponse = zod}).describe('Response for a batched channel preview lookup.');+/**+ * @summary Handler for `GET /channels/{channel_id}`.+ */+export const getChannelParams = zod.object({+ channel_id: zod.uuid().describe('Channel ID'),+});++export const getChannelQueryLimitMin = 0;++export const getChannelQueryParams = zod.object({+ limit: zod+ .number()+ .min(getChannelQueryLimitMin)+ .optional()+ .describe('Recent message page size (1-100, default 50)'),+});++export const getChannelResponse = zod+ .object({+ channel_id: zod.uuid().describe('Channel id.'),+ channel_name: zod+ .string()+ .describe("Resolved display name from the viewer's perspective."),+ channel_type: zod+ .enum(['public', 'organization', 'private', 'direct_message', 'team'])+ .describe('Type of channel.'),+ messages: zod+ .array(+ zod+ .object({+ attachments: zod+ .array(+ zod+ .object({+ created_at: zod.iso+ .datetime({})+ .describe('When the attachment was created.'),+ entity_id: zod.string().describe('Entity id.'),+ entity_type: zod.string().describe('Type of entity.'),+ height: zod+ .number()+ .nullish()+ .describe('Height (for images).'),+ id: zod.uuid().describe('Attachment id.'),+ width: zod+ .number()+ .nullish()+ .describe('Width (for images).'),+ })+ .describe('An attachment on a message.')+ )+ .describe('Attachments on this message.'),+ channel_id: zod.uuid().describe('Channel id.'),+ content: zod.string().describe('Message content.'),+ created_at: zod.iso+ .datetime({})+ .describe('When the message was created.'),+ deleted_at: zod.iso+ .datetime({})+ .nullish()+ .describe('When the message was soft-deleted.'),+ edited_at: zod.iso+ .datetime({})+ .nullish()+ .describe('When the message was edited.'),+ id: zod.uuid().describe('Message id.'),+ reactions: zod+ .array(+ zod+ .object({+ emoji: zod.string().describe('The emoji string.'),+ users: zod+ .array(zod.string())+ .describe('User ids who added this reaction.'),+ })+ .describe('A reaction with emoji and user list.')+ )+ .describe('Reactions on this message.'),+ sender: zod+ .object({+ id: zod+ .string()+ .describe('Sender id without the storage namespace prefix.'),+ type: zod.enum(['user', 'bot']).describe('Public sender type.'),+ })+ .describe('Public sender identity for channel messages.'),+ sender_id: zod.string().describe('Sender user id.'),+ thread: zod+ .object({+ latest_reply_at: zod.iso+ .datetime({})+ .nullish()+ .describe('Timestamp of the latest reply.'),+ preview: zod+ .array(+ zod+ .object({+ attachments: zod+ .array(+ zod+ .object({+ created_at: zod.iso+ .datetime({})+ .describe('When the attachment was created.'),+ entity_id: zod.string().describe('Entity id.'),+ entity_type: zod+ .string()+ .describe('Type of entity.'),+ height: zod+ .number()+ .nullish()+ .describe('Height (for images).'),+ id: zod.uuid().describe('Attachment id.'),+ width: zod+ .number()+ .nullish()+ .describe('Width (for images).'),+ })+ .describe('An attachment on a message.')+ )+ .describe('Attachments on this reply.'),+ content: zod.string().describe('Reply content.'),+ created_at: zod.iso+ .datetime({})+ .describe('When the reply was created.'),+ edited_at: zod.iso+ .datetime({})+ .nullish()+ .describe('When the reply was edited.'),+ id: zod.uuid().describe('Reply id.'),+ reactions: zod+ .array(+ zod+ .object({+ emoji: zod+ .string()+ .describe('The emoji string.'),+ users: zod+ .array(zod.string())+ .describe(+ 'User ids who added this reaction.'+ ),+ })+ .describe('A reaction with emoji and user list.')+ )+ .describe('Reactions on this reply.'),+ sender: zod+ .object({+ id: zod+ .string()+ .describe(+ 'Sender id without the storage namespace prefix.'+ ),+ type: zod+ .enum(['user', 'bot'])+ .describe('Public sender type.'),+ })+ .describe(+ 'Public sender identity for channel messages.'+ ),+ sender_id: zod.string().describe('Sender user id.'),+ updated_at: zod.iso+ .datetime({})+ .describe('When the reply was last updated.'),+ })+ .describe('A thread reply shown in preview.')+ )+ .describe('Last N replies for thread preview.'),+ reply_count: zod.number().describe('Total reply count.'),+ })+ .describe('Thread metadata and preview replies.'),+ updated_at: zod.iso+ .datetime({})+ .describe('When the message was last updated.'),+ })+ .describe('A top-level channel message with thread info.')+ )+ .describe('Recent messages (newest-first first page).'),+ participants: zod+ .array(+ zod+ .object({+ channel_id: zod.uuid().describe('Channel id.'),+ joined_at: zod.iso.datetime({}).describe('When the user joined.'),+ role: zod+ .enum(['owner', 'admin', 'member'])+ .describe('Participant role in a channel.'),+ user_id: zod.string().describe('User id.'),+ })+ .describe('A channel participant.')+ )+ .describe('Active participants.'),+ })+ .describe(+ 'Channel detail: metadata, active participants, and a recent page of messages.\n\n`messages` is the newest-first first page (size controlled by `limit`); use the\ndedicated `\/{channel_id}\/messages` endpoint for cursor pagination.'+ );+/*** @summary Handler for `DELETE /channels/{channel_id}`.*/diff --git a/js/app/packages/service-clients/service-storage/openapi.json b/js/app/packages/service-clients/service-storage/openapi.jsonindex 3f5921c538..30ca8171e8 100644--- a/js/app/packages/service-clients/service-storage/openapi.json+++ b/js/app/packages/service-clients/service-storage/openapi.json@@ -1821,6 +1821,76 @@}},"/channels/{channel_id}": {+ "get": {+ "tags": ["channels::inbound::axum_router"],+ "summary": "Handler for `GET /channels/{channel_id}`.",+ "operationId": "get_channel",+ "parameters": [+ {+ "name": "channel_id",+ "in": "path",+ "description": "Channel ID",+ "required": true,+ "schema": {+ "type": "string",+ "format": "uuid"+ }+ },+ {+ "name": "limit",+ "in": "query",+ "description": "Recent message page size (1-100, default 50)",+ "required": false,+ "schema": {+ "type": "integer",+ "format": "int32",+ "minimum": 0+ }+ }+ ],+ "responses": {+ "200": {+ "description": "",+ "content": {+ "application/json": {+ "schema": {+ "$ref": "#/components/schemas/ApiChannelDetail"+ }+ }+ }+ },+ "401": {+ "description": "",+ "content": {+ "application/json": {+ "schema": {+ "$ref": "#/components/schemas/ErrorResponse"+ }+ }+ }+ },+ "404": {+ "description": "",+ "content": {+ "application/json": {+ "schema": {+ "$ref": "#/components/schemas/ErrorResponse"+ }+ }+ }+ },+ "500": {+ "description": "",+ "content": {+ "application/json": {+ "schema": {+ "$ref": "#/components/schemas/ErrorResponse"+ }+ }+ }+ }+ }+ },"delete": {"tags": ["channels"],"summary": "Handler for `DELETE /channels/{channel_id}`.",@@ -8720,6 +8790,46 @@}}},+ "ApiChannelDetail": {+ "type": "object",+ "description": "Channel detail: metadata, active participants, and a recent page of messages.\n\n`messages` is the newest-first first page (size controlled by `limit`); use the\ndedicated `/{channel_id}/messages` endpoint for cursor pagination.",+ "required": [+ "channel_id",+ "channel_type",+ "channel_name",+ "participants",+ "messages"+ ],+ "properties": {+ "channel_id": {+ "type": "string",+ "format": "uuid",+ "description": "Channel id."+ },+ "channel_name": {+ "type": "string",+ "description": "Resolved display name from the viewer's perspective."+ },+ "channel_type": {+ "$ref": "#/components/schemas/ChannelType",+ "description": "Channel type."+ },+ "messages": {+ "type": "array",+ "items": {+ "$ref": "#/components/schemas/ApiChannelMessage"+ },+ "description": "Recent messages (newest-first first page)."+ },+ "participants": {+ "type": "array",+ "items": {+ "$ref": "#/components/schemas/ApiChannelParticipant"+ },+ "description": "Active participants."+ }+ }+ },"ApiChannelMessage": {"type": "object","description": "A top-level channel message with thread info.",diff --git a/js/app/scripts/generate-api-schema.ts b/js/app/scripts/generate-api-schema.tsindex 4a09420b79..1eca22d37f 100644--- a/js/app/scripts/generate-api-schema.ts+++ b/js/app/scripts/generate-api-schema.ts@@ -16,7 +16,6 @@ const elapsed = (start: number) =>// Map service names to Rust crate namesconst serviceToCrate: Record<string, string> = {"cloud-storage": "document_storage_service",- "comms-service": "comms_service","properties-service": "properties_service","document-cognition": "document_cognition_service","auth-service": "authentication_service",diff --git a/js/app/scripts/services.ts b/js/app/scripts/services.tsindex 6759e6e4ad..3ce8f9b321 100644--- a/js/app/scripts/services.ts+++ b/js/app/scripts/services.ts@@ -16,14 +16,6 @@ export const services: Service[] = [output: "../packages/service-clients/service-storage/",orvalKey: "storageService",},- {- name: "comms-service",- dev: "https://cloud-storage-dev.macro.com/comms/api-doc/openapi.json",- prod: "https://cloud-storage.macro.com/comms/api-doc/openapi.json",- local: "http://localhost:8086/comms/api-doc/openapi.json",- output: "../packages/service-clients/service-comms/",- orvalKey: "commsService",- },{name: "properties-service",dev: "https://cloud-storage-dev.macro.com/properties/api-doc/openapi.json",diff --git a/js/app/tsconfig.json b/js/app/tsconfig.jsonindex 62c4ae63b9..bad514001d 100644--- a/js/app/tsconfig.json+++ b/js/app/tsconfig.json@@ -104,9 +104,6 @@"@service-notification/*": ["./packages/service-clients/service-notification/*"],- "@service-comms/*": [- "./packages/service-clients/service-comms/*"- ],"@service-unfurl/*": ["./packages/service-clients/service-unfurl/*"],diff --git a/rust/cloud-storage/.sqlx/query-0bc2a0143c7f09e18223dc04ab8ed7052f7c7587ec002e1716ada1ccd58db8dc.json b/rust/cloud-storage/.sqlx/query-0bc2a0143c7f09e18223dc04ab8ed7052f7c7587ec002e1716ada1ccd58db8dc.jsondeleted file mode 100644index 6e77af4fb4..0000000000--- a/rust/cloud-storage/.sqlx/query-0bc2a0143c7f09e18223dc04ab8ed7052f7c7587ec002e1716ada1ccd58db8dc.json+++ /dev/null@@ -1,71 +0,0 @@-{- "db_name": "PostgreSQL",- "query": "\n SELECT\n id,\n channel_id,\n sender_id,\n content,\n created_at,\n updated_at,\n thread_id,\n edited_at as \"edited_at: chrono::DateTime<chrono::Utc>\",\n deleted_at as \"deleted_at: chrono::DateTime<chrono::Utc>\"\n FROM comms_messages\n WHERE channel_id = (SELECT channel_id FROM comms_messages WHERE id=$1)\n AND\n created_at > (SELECT created_at FROM comms_messages WHERE id=$1)\n ORDER BY created_at ASC\n LIMIT $2\n ",- "describe": {- "columns": [- {- "ordinal": 0,- "name": "id",- "type_info": "Uuid"- },- {- "ordinal": 1,- "name": "channel_id",- "type_info": "Uuid"- },- {- "ordinal": 2,- "name": "sender_id",- "type_info": "Text"- },- {- "ordinal": 3,- "name": "content",- "type_info": "Text"- },- {- "ordinal": 4,- "name": "created_at",- "type_info": "Timestamptz"- },- {- "ordinal": 5,- "name": "updated_at",- "type_info": "Timestamptz"- },- {- "ordinal": 6,- "name": "thread_id",- "type_info": "Uuid"- },- {- "ordinal": 7,- "name": "edited_at: chrono::DateTime<chrono::Utc>",- "type_info": "Timestamp"- },- {- "ordinal": 8,- "name": "deleted_at: chrono::DateTime<chrono::Utc>",- "type_info": "Timestamp"- }- ],- "parameters": {- "Left": [- "Uuid",- "Int8"- ]- },- "nullable": [- false,- false,- false,- false,- false,- false,- true,- true,- true- ]- },- "hash": "0bc2a0143c7f09e18223dc04ab8ed7052f7c7587ec002e1716ada1ccd58db8dc"-}diff --git a/rust/cloud-storage/.sqlx/query-0c59340d688c2132886f2fb765d3a9843931e9bb4006a4b10588e3eb32ed49c0.json b/rust/cloud-storage/.sqlx/query-0c59340d688c2132886f2fb765d3a9843931e9bb4006a4b10588e3eb32ed49c0.jsondeleted file mode 100644index e1bbae2e1a..0000000000--- a/rust/cloud-storage/.sqlx/query-0c59340d688c2132886f2fb765d3a9843931e9bb4006a4b10588e3eb32ed49c0.json+++ /dev/null@@ -1,15 +0,0 @@-{- "db_name": "PostgreSQL",- "query": "\n UPDATE comms_channels\n SET updated_at = $2 \n WHERE id = $1\n ",- "describe": {- "columns": [],- "parameters": {- "Left": [- "Uuid",- "Timestamptz"- ]- },- "nullable": []- },- "hash": "0c59340d688c2132886f2fb765d3a9843931e9bb4006a4b10588e3eb32ed49c0"-}diff --git a/rust/cloud-storage/.sqlx/query-1b9cfa3d4094394511f73413672e79e2ec7426b562ad9dbf8d6adfb3b33045e8.json b/rust/cloud-storage/.sqlx/query-1b9cfa3d4094394511f73413672e79e2ec7426b562ad9dbf8d6adfb3b33045e8.jsondeleted file mode 100644index 68b44d7f91..0000000000--- a/rust/cloud-storage/.sqlx/query-1b9cfa3d4094394511f73413672e79e2ec7426b562ad9dbf8d6adfb3b33045e8.json+++ /dev/null@@ -1,22 +0,0 @@-{- "db_name": "PostgreSQL",- "query": "\n SELECT\n name\n FROM comms_channels\n WHERE id = $1\n ",- "describe": {- "columns": [- {- "ordinal": 0,- "name": "name",- "type_info": "Varchar"- }- ],- "parameters": {- "Left": [- "Uuid"- ]- },- "nullable": [- true- ]- },- "hash": "1b9cfa3d4094394511f73413672e79e2ec7426b562ad9dbf8d6adfb3b33045e8"-}diff --git a/rust/cloud-storage/.sqlx/query-22b6d77bfd1c45120ccf35569e79ddb46a99a61528c59231a0dd5f263df499e6.json b/rust/cloud-storage/.sqlx/query-22b6d77bfd1c45120ccf35569e79ddb46a99a61528c59231a0dd5f263df499e6.jsondeleted file mode 100644index efdf0025ad..0000000000--- a/rust/cloud-storage/.sqlx/query-22b6d77bfd1c45120ccf35569e79ddb46a99a61528c59231a0dd5f263df499e6.json+++ /dev/null@@ -1,16 +0,0 @@-{- "db_name": "PostgreSQL",- "query": "\n DELETE FROM comms_reactions\n WHERE message_id = $1 AND emoji = $2 AND user_id = $3\n ",- "describe": {- "columns": [],- "parameters": {- "Left": [- "Uuid",- "Text",- "Text"- ]- },- "nullable": []- },- "hash": "22b6d77bfd1c45120ccf35569e79ddb46a99a61528c59231a0dd5f263df499e6"-}diff --git a/rust/cloud-storage/.sqlx/query-29a11db8b490eb1c5d38e3675c052d9b254b34f31fd8ec476909d3ded6efe340.json b/rust/cloud-storage/.sqlx/query-29a11db8b490eb1c5d38e3675c052d9b254b34f31fd8ec476909d3ded6efe340.jsondeleted file mode 100644index 5f203b58b1..0000000000--- a/rust/cloud-storage/.sqlx/query-29a11db8b490eb1c5d38e3675c052d9b254b34f31fd8ec476909d3ded6efe340.json+++ /dev/null@@ -1,58 +0,0 @@-{- "db_name": "PostgreSQL",- "query": "\n SELECT id, source_entity_type, source_entity_id, entity_type, entity_id, user_id, created_at\n FROM comms_entity_mentions\n WHERE id = $1\n ",- "describe": {- "columns": [- {- "ordinal": 0,- "name": "id",- "type_info": "Uuid"- },- {- "ordinal": 1,- "name": "source_entity_type",- "type_info": "Varchar"- },- {- "ordinal": 2,- "name": "source_entity_id",- "type_info": "Varchar"- },- {- "ordinal": 3,- "name": "entity_type",- "type_info": "Varchar"- },- {- "ordinal": 4,- "name": "entity_id",- "type_info": "Varchar"- },- {- "ordinal": 5,- "name": "user_id",- "type_info": "Varchar"- },- {- "ordinal": 6,- "name": "created_at",- "type_info": "Timestamptz"- }- ],- "parameters": {- "Left": [- "Uuid"- ]- },- "nullable": [- false,- false,- false,- false,- false,- true,- false- ]- },- "hash": "29a11db8b490eb1c5d38e3675c052d9b254b34f31fd8ec476909d3ded6efe340"-}diff --git a/rust/cloud-storage/.sqlx/query-2f3f099717f4ffb3f73532fab42a02a6467e73fbd05c4d265903fd4bec995a89.json b/rust/cloud-storage/.sqlx/query-2f3f099717f4ffb3f73532fab42a02a6467e73fbd05c4d265903fd4bec995a89.jsondeleted file mode 100644index 7afa5d1c7f..0000000000--- a/rust/cloud-storage/.sqlx/query-2f3f099717f4ffb3f73532fab42a02a6467e73fbd05c4d265903fd4bec995a89.json+++ /dev/null@@ -1,58 +0,0 @@-{- "db_name": "PostgreSQL",- "query": "\n SELECT\n em.id,\n em.source_entity_type,\n em.source_entity_id,\n em.entity_type,\n em.entity_id,\n em.user_id,\n em.created_at\n FROM comms_entity_mentions AS em\n JOIN comms_messages AS m ON em.source_entity_id = m.id::text\n WHERE em.source_entity_type = 'message'\n AND (m.id = $1 OR m.thread_id = $1)\n ORDER BY em.created_at ASC\n ",- "describe": {- "columns": [- {- "ordinal": 0,- "name": "id",- "type_info": "Uuid"- },- {- "ordinal": 1,- "name": "source_entity_type",- "type_info": "Varchar"- },- {- "ordinal": 2,- "name": "source_entity_id",- "type_info": "Varchar"- },- {- "ordinal": 3,- "name": "entity_type",- "type_info": "Varchar"- },- {- "ordinal": 4,- "name": "entity_id",- "type_info": "Varchar"- },- {- "ordinal": 5,- "name": "user_id",- "type_info": "Varchar"- },- {- "ordinal": 6,- "name": "created_at",- "type_info": "Timestamptz"- }- ],- "parameters": {- "Left": [- "Uuid"- ]- },- "nullable": [- false,- false,- false,- false,- false,- true,- false- ]- },- "hash": "2f3f099717f4ffb3f73532fab42a02a6467e73fbd05c4d265903fd4bec995a89"-}diff --git a/rust/cloud-storage/.sqlx/query-3819e79d674b6629df95c52d2e865328a519ed67ec84b882261f44489823523e.json b/rust/cloud-storage/.sqlx/query-3819e79d674b6629df95c52d2e865328a519ed67ec84b882261f44489823523e.jsondeleted file mode 100644index 666c462838..0000000000--- a/rust/cloud-storage/.sqlx/query-3819e79d674b6629df95c52d2e865328a519ed67ec84b882261f44489823523e.json+++ /dev/null@@ -1,23 +0,0 @@-{- "db_name": "PostgreSQL",- "query": "\n SELECT DISTINCT m.channel_id\n FROM comms_entity_mentions em\n JOIN comms_messages m ON m.id::text = em.source_entity_id AND em.source_entity_type = 'message'\n JOIN comms_channels c ON c.id = m.channel_id\n WHERE em.entity_id = $1 AND em.entity_type = $2\n ",- "describe": {- "columns": [- {- "ordinal": 0,- "name": "channel_id",- "type_info": "Uuid"- }- ],- "parameters": {- "Left": [- "Text",- "Text"- ]- },- "nullable": [- false- ]- },- "hash": "3819e79d674b6629df95c52d2e865328a519ed67ec84b882261f44489823523e"-}diff --git a/rust/cloud-storage/.sqlx/query-3e8b0491c7a948d3f6d821b9b7d7516558a0c38da48816d8a8f3ac8420fb4fa7.json b/rust/cloud-storage/.sqlx/query-3e8b0491c7a948d3f6d821b9b7d7516558a0c38da48816d8a8f3ac8420fb4fa7.jsondeleted file mode 100644index 73aeb3e457..0000000000--- a/rust/cloud-storage/.sqlx/query-3e8b0491c7a948d3f6d821b9b7d7516558a0c38da48816d8a8f3ac8420fb4fa7.json+++ /dev/null@@ -1,23 +0,0 @@-{- "db_name": "PostgreSQL",- "query": "\n SELECT EXISTS (\n SELECT 1 FROM comms_channel_participants\n WHERE channel_id = $1\n AND user_id = $2\n AND role IN ('admin'::comms_participant_role, 'owner'::comms_participant_role)\n ) as \"is_authorized!\"\n ",- "describe": {- "columns": [- {- "ordinal": 0,- "name": "is_authorized!",- "type_info": "Bool"- }- ],- "parameters": {- "Left": [- "Uuid",- "Text"- ]- },- "nullable": [- null- ]- },- "hash": "3e8b0491c7a948d3f6d821b9b7d7516558a0c38da48816d8a8f3ac8420fb4fa7"-}diff --git a/rust/cloud-storage/.sqlx/query-52cc02c4d43669d3a1c8f350e3af7c261071298ef899917c3380d56d4873e0d2.json b/rust/cloud-storage/.sqlx/query-52cc02c4d43669d3a1c8f350e3af7c261071298ef899917c3380d56d4873e0d2.jsondeleted file mode 100644index 08b2dd3e86..0000000000--- a/rust/cloud-storage/.sqlx/query-52cc02c4d43669d3a1c8f350e3af7c261071298ef899917c3380d56d4873e0d2.json+++ /dev/null@@ -1,64 +0,0 @@-{- "db_name": "PostgreSQL",- "query": "\n SELECT\n id,\n message_id as \"message_id: Uuid\",\n channel_id as \"channel_id: Uuid\",\n entity_type,\n entity_id,\n width,\n height,\n created_at\n FROM comms_attachments\n WHERE message_id = $1",- "describe": {- "columns": [- {- "ordinal": 0,- "name": "id",- "type_info": "Uuid"- },- {- "ordinal": 1,- "name": "message_id: Uuid",- "type_info": "Uuid"- },- {- "ordinal": 2,- "name": "channel_id: Uuid",- "type_info": "Uuid"- },- {- "ordinal": 3,- "name": "entity_type",- "type_info": "Varchar"- },- {- "ordinal": 4,- "name": "entity_id",- "type_info": "Varchar"- },- {- "ordinal": 5,- "name": "width",- "type_info": "Int4"- },- {- "ordinal": 6,- "name": "height",- "type_info": "Int4"- },- {- "ordinal": 7,- "name": "created_at",- "type_info": "Timestamptz"- }- ],- "parameters": {- "Left": [- "Uuid"- ]- },- "nullable": [- false,- false,- false,- false,- false,- true,- true,- false- ]- },- "hash": "52cc02c4d43669d3a1c8f350e3af7c261071298ef899917c3380d56d4873e0d2"-}diff --git a/rust/cloud-storage/.sqlx/query-6a959012e52fd6acf519e2ff3b2d48c962d566f65758eb3084d384fca676efde.json b/rust/cloud-storage/.sqlx/query-6a959012e52fd6acf519e2ff3b2d48c962d566f65758eb3084d384fca676efde.jsondeleted file mode 100644index 38961c137b..0000000000--- a/rust/cloud-storage/.sqlx/query-6a959012e52fd6acf519e2ff3b2d48c962d566f65758eb3084d384fca676efde.json+++ /dev/null@@ -1,71 +0,0 @@-{- "db_name": "PostgreSQL",- "query": "\n UPDATE comms_messages\n SET content = $1, updated_at = NOW(), deleted_at = NOW()\n WHERE id = $2\n RETURNING \n id, \n channel_id,\n sender_id,\n content, \n created_at,\n updated_at,\n thread_id,\n edited_at as \"edited_at: chrono::DateTime<chrono::Utc>\",\n deleted_at as \"deleted_at: chrono::DateTime<chrono::Utc>\"\n ",- "describe": {- "columns": [- {- "ordinal": 0,- "name": "id",- "type_info": "Uuid"- },- {- "ordinal": 1,- "name": "channel_id",- "type_info": "Uuid"- },- {- "ordinal": 2,- "name": "sender_id",- "type_info": "Text"- },- {- "ordinal": 3,- "name": "content",- "type_info": "Text"- },- {- "ordinal": 4,- "name": "created_at",- "type_info": "Timestamptz"- },- {- "ordinal": 5,- "name": "updated_at",- "type_info": "Timestamptz"- },- {- "ordinal": 6,- "name": "thread_id",- "type_info": "Uuid"- },- {- "ordinal": 7,- "name": "edited_at: chrono::DateTime<chrono::Utc>",- "type_info": "Timestamp"- },- {- "ordinal": 8,- "name": "deleted_at: chrono::DateTime<chrono::Utc>",- "type_info": "Timestamp"- }- ],- "parameters": {- "Left": [- "Text",- "Uuid"- ]- },- "nullable": [- false,- false,- false,- false,- false,- false,- true,- true,- true- ]- },- "hash": "6a959012e52fd6acf519e2ff3b2d48c962d566f65758eb3084d384fca676efde"-}diff --git a/rust/cloud-storage/.sqlx/query-6be5aa69eb2f953dcefeebec85994f26d25cc170a7ae1eaca2e73ef0581605e4.json b/rust/cloud-storage/.sqlx/query-6be5aa69eb2f953dcefeebec85994f26d25cc170a7ae1eaca2e73ef0581605e4.jsondeleted file mode 100644index aa097e55a5..0000000000--- a/rust/cloud-storage/.sqlx/query-6be5aa69eb2f953dcefeebec85994f26d25cc170a7ae1eaca2e73ef0581605e4.json+++ /dev/null@@ -1,22 +0,0 @@-{- "db_name": "PostgreSQL",- "query": "\n SELECT COUNT(id) as count FROM comms_messages\n WHERE channel_id = $1\n ",- "describe": {- "columns": [- {- "ordinal": 0,- "name": "count",- "type_info": "Int8"- }- ],- "parameters": {- "Left": [- "Uuid"- ]- },- "nullable": [- null- ]- },- "hash": "6be5aa69eb2f953dcefeebec85994f26d25cc170a7ae1eaca2e73ef0581605e4"-}diff --git a/rust/cloud-storage/.sqlx/query-6d7020b1f916fc36d8da4a2bc277de97b6045e3908a0b3cee7ceabb3dccf0e7b.json b/rust/cloud-storage/.sqlx/query-6d7020b1f916fc36d8da4a2bc277de97b6045e3908a0b3cee7ceabb3dccf0e7b.jsondeleted file mode 100644index 9f13f899ff..0000000000--- a/rust/cloud-storage/.sqlx/query-6d7020b1f916fc36d8da4a2bc277de97b6045e3908a0b3cee7ceabb3dccf0e7b.json+++ /dev/null@@ -1,40 +0,0 @@-{- "db_name": "PostgreSQL",- "query": "SELECT * FROM comms_reactions WHERE message_id = $1",- "describe": {- "columns": [- {- "ordinal": 0,- "name": "message_id",- "type_info": "Uuid"- },- {- "ordinal": 1,- "name": "emoji",- "type_info": "Varchar"- },- {- "ordinal": 2,- "name": "user_id",- "type_info": "Text"- },- {- "ordinal": 3,- "name": "created_at",- "type_info": "Timestamptz"- }- ],- "parameters": {- "Left": [- "Uuid"- ]- },- "nullable": [- false,- false,- false,- false- ]- },- "hash": "6d7020b1f916fc36d8da4a2bc277de97b6045e3908a0b3cee7ceabb3dccf0e7b"-}diff --git a/rust/cloud-storage/.sqlx/query-6dbeb827ecd69ff3c396cdd1ad2fe22f3298692ad5c45b2ff87b1e396a492108.json b/rust/cloud-storage/.sqlx/query-6dbeb827ecd69ff3c396cdd1ad2fe22f3298692ad5c45b2ff87b1e396a492108.jsondeleted file mode 100644index dd32fa44a6..0000000000--- a/rust/cloud-storage/.sqlx/query-6dbeb827ecd69ff3c396cdd1ad2fe22f3298692ad5c45b2ff87b1e396a492108.json+++ /dev/null@@ -1,47 +0,0 @@-{- "db_name": "PostgreSQL",- "query": "\n SELECT\n channel_type AS \"channel_type: ChannelType\",\n name,\n org_id\n FROM comms_channels\n WHERE id = $1\n ",- "describe": {- "columns": [- {- "ordinal": 0,- "name": "channel_type: ChannelType",- "type_info": {- "Custom": {- "name": "comms_channel_type",- "kind": {- "Enum": [- "public",- "organization",- "private",- "direct_message",- "team"- ]- }- }- }- },- {- "ordinal": 1,- "name": "name",- "type_info": "Varchar"- },- {- "ordinal": 2,- "name": "org_id",- "type_info": "Int8"- }- ],- "parameters": {- "Left": [- "Uuid"- ]- },- "nullable": [- false,- true,- true- ]- },- "hash": "6dbeb827ecd69ff3c396cdd1ad2fe22f3298692ad5c45b2ff87b1e396a492108"-}diff --git a/rust/cloud-storage/.sqlx/query-6ff8a6b2288105fc7239b69206424f13f0542b0fa1d4499f8fe34cbf0c5a2fbc.json b/rust/cloud-storage/.sqlx/query-6ff8a6b2288105fc7239b69206424f13f0542b0fa1d4499f8fe34cbf0c5a2fbc.jsondeleted file mode 100644index 73dcf683dd..0000000000--- a/rust/cloud-storage/.sqlx/query-6ff8a6b2288105fc7239b69206424f13f0542b0fa1d4499f8fe34cbf0c5a2fbc.json+++ /dev/null@@ -1,70 +0,0 @@-{- "db_name": "PostgreSQL",- "query": "\n SELECT\n id,\n channel_id,\n sender_id,\n content,\n created_at,\n updated_at,\n thread_id,\n edited_at as \"edited_at: chrono::DateTime<chrono::Utc>\",\n deleted_at as \"deleted_at: chrono::DateTime<chrono::Utc>\"\n FROM comms_messages\n WHERE id = $1;\n ",- "describe": {- "columns": [- {- "ordinal": 0,- "name": "id",- "type_info": "Uuid"- },- {- "ordinal": 1,- "name": "channel_id",- "type_info": "Uuid"- },- {- "ordinal": 2,- "name": "sender_id",- "type_info": "Text"- },- {- "ordinal": 3,- "name": "content",- "type_info": "Text"- },- {- "ordinal": 4,- "name": "created_at",- "type_info": "Timestamptz"- },- {- "ordinal": 5,- "name": "updated_at",- "type_info": "Timestamptz"- },- {- "ordinal": 6,- "name": "thread_id",- "type_info": "Uuid"- },- {- "ordinal": 7,- "name": "edited_at: chrono::DateTime<chrono::Utc>",- "type_info": "Timestamp"- },- {- "ordinal": 8,- "name": "deleted_at: chrono::DateTime<chrono::Utc>",- "type_info": "Timestamp"- }- ],- "parameters": {- "Left": [- "Uuid"- ]- },- "nullable": [- false,- false,- false,- false,- false,- false,- true,- true,- true- ]- },- "hash": "6ff8a6b2288105fc7239b69206424f13f0542b0fa1d4499f8fe34cbf0c5a2fbc"-}diff --git a/rust/cloud-storage/.sqlx/query-857660d2872b58e76b92cd38e6100f7963d9d2e566acaa8849c5adc537cfc2f1.json b/rust/cloud-storage/.sqlx/query-857660d2872b58e76b92cd38e6100f7963d9d2e566acaa8849c5adc537cfc2f1.jsondeleted file mode 100644index 0dbcf950ad..0000000000--- a/rust/cloud-storage/.sqlx/query-857660d2872b58e76b92cd38e6100f7963d9d2e566acaa8849c5adc537cfc2f1.json+++ /dev/null@@ -1,14 +0,0 @@-{- "db_name": "PostgreSQL",- "query": "\n DELETE FROM comms_entity_mentions\n WHERE id = $1\n ",- "describe": {- "columns": [],- "parameters": {- "Left": [- "Uuid"- ]- },- "nullable": []- },- "hash": "857660d2872b58e76b92cd38e6100f7963d9d2e566acaa8849c5adc537cfc2f1"-}diff --git a/rust/cloud-storage/.sqlx/query-8bbec277addaa63540e2e5f0e8bf028a0d4bd3693357894d25d879dcd9b72563.json b/rust/cloud-storage/.sqlx/query-8bbec277addaa63540e2e5f0e8bf028a0d4bd3693357894d25d879dcd9b72563.jsondeleted file mode 100644index ca5613aa3c..0000000000--- a/rust/cloud-storage/.sqlx/query-8bbec277addaa63540e2e5f0e8bf028a0d4bd3693357894d25d879dcd9b72563.json+++ /dev/null@@ -1,71 +0,0 @@-{- "db_name": "PostgreSQL",- "query": "\n UPDATE comms_messages\n SET \n updated_at = NOW(),\n edited_at = NOW(),\n deleted_at = CASE \n WHEN $2 = false AND (content IS NULL OR content ~ '^[\\s]*$') THEN NOW()\n ELSE deleted_at\n END\n WHERE id = $1\n RETURNING\n id,\n channel_id,\n sender_id,\n content,\n created_at,\n updated_at,\n thread_id,\n edited_at as \"edited_at: chrono::DateTime<chrono::Utc>\",\n deleted_at as \"deleted_at: chrono::DateTime<chrono::Utc>\"\n ",- "describe": {- "columns": [- {- "ordinal": 0,- "name": "id",- "type_info": "Uuid"- },- {- "ordinal": 1,- "name": "channel_id",- "type_info": "Uuid"- },- {- "ordinal": 2,- "name": "sender_id",- "type_info": "Text"- },- {- "ordinal": 3,- "name": "content",- "type_info": "Text"- },- {- "ordinal": 4,- "name": "created_at",- "type_info": "Timestamptz"- },- {- "ordinal": 5,- "name": "updated_at",- "type_info": "Timestamptz"- },- {- "ordinal": 6,- "name": "thread_id",- "type_info": "Uuid"- },- {- "ordinal": 7,- "name": "edited_at: chrono::DateTime<chrono::Utc>",- "type_info": "Timestamp"- },- {- "ordinal": 8,- "name": "deleted_at: chrono::DateTime<chrono::Utc>",- "type_info": "Timestamp"- }- ],- "parameters": {- "Left": [- "Uuid",- "Bool"- ]- },- "nullable": [- false,- false,- false,- false,- false,- false,- true,- true,- true- ]- },- "hash": "8bbec277addaa63540e2e5f0e8bf028a0d4bd3693357894d25d879dcd9b72563"-}diff --git a/rust/cloud-storage/.sqlx/query-92afd811fa4a67de45ac9a1d6d4274f01c865b9c861f2034c89f0531b88aac85.json b/rust/cloud-storage/.sqlx/query-92afd811fa4a67de45ac9a1d6d4274f01c865b9c861f2034c89f0531b88aac85.jsondeleted file mode 100644index 567175f84e..0000000000--- a/rust/cloud-storage/.sqlx/query-92afd811fa4a67de45ac9a1d6d4274f01c865b9c861f2034c89f0531b88aac85.json+++ /dev/null@@ -1,71 +0,0 @@-{- "db_name": "PostgreSQL",- "query": "\n SELECT\n id,\n name,\n channel_type AS \"channel_type: model::comms::ChannelType\",\n org_id,\n created_at,\n updated_at,\n owner_id\n FROM comms_channels\n WHERE id = $1\n ",- "describe": {- "columns": [- {- "ordinal": 0,- "name": "id",- "type_info": "Uuid"- },- {- "ordinal": 1,- "name": "name",- "type_info": "Varchar"- },- {- "ordinal": 2,- "name": "channel_type: model::comms::ChannelType",- "type_info": {- "Custom": {- "name": "comms_channel_type",- "kind": {- "Enum": [- "public",- "organization",- "private",- "direct_message",- "team"- ]- }- }- }- },- {- "ordinal": 3,- "name": "org_id",- "type_info": "Int8"- },- {- "ordinal": 4,- "name": "created_at",- "type_info": "Timestamptz"- },- {- "ordinal": 5,- "name": "updated_at",- "type_info": "Timestamptz"- },- {- "ordinal": 6,- "name": "owner_id",- "type_info": "Text"- }- ],- "parameters": {- "Left": [- "Uuid"- ]- },- "nullable": [- false,- true,- false,- true,- false,- false,- false- ]- },- "hash": "92afd811fa4a67de45ac9a1d6d4274f01c865b9c861f2034c89f0531b88aac85"-}diff --git a/rust/cloud-storage/.sqlx/query-98b0bd8f950443e4240f137adebdf2219b052d3bcbd4a3e79a5f80e81a61522e.json b/rust/cloud-storage/.sqlx/query-98b0bd8f950443e4240f137adebdf2219b052d3bcbd4a3e79a5f80e81a61522e.jsondeleted file mode 100644index 94d5f34dbe..0000000000--- a/rust/cloud-storage/.sqlx/query-98b0bd8f950443e4240f137adebdf2219b052d3bcbd4a3e79a5f80e81a61522e.json+++ /dev/null@@ -1,71 +0,0 @@-{- "db_name": "PostgreSQL",- "query": "\n UPDATE comms_messages\n SET content = $1, updated_at = NOW(), edited_at = NOW()\n WHERE id = $2\n RETURNING\n id,\n channel_id,\n sender_id,\n content,\n created_at,\n updated_at,\n thread_id,\n edited_at as \"edited_at: chrono::DateTime<chrono::Utc>\",\n deleted_at as \"deleted_at: chrono::DateTime<chrono::Utc>\"\n ",- "describe": {- "columns": [- {- "ordinal": 0,- "name": "id",- "type_info": "Uuid"- },- {- "ordinal": 1,- "name": "channel_id",- "type_info": "Uuid"- },- {- "ordinal": 2,- "name": "sender_id",- "type_info": "Text"- },- {- "ordinal": 3,- "name": "content",- "type_info": "Text"- },- {- "ordinal": 4,- "name": "created_at",- "type_info": "Timestamptz"- },- {- "ordinal": 5,- "name": "updated_at",- "type_info": "Timestamptz"- },- {- "ordinal": 6,- "name": "thread_id",- "type_info": "Uuid"- },- {- "ordinal": 7,- "name": "edited_at: chrono::DateTime<chrono::Utc>",- "type_info": "Timestamp"- },- {- "ordinal": 8,- "name": "deleted_at: chrono::DateTime<chrono::Utc>",- "type_info": "Timestamp"- }- ],- "parameters": {- "Left": [- "Text",- "Uuid"- ]- },- "nullable": [- false,- false,- false,- false,- false,- false,- true,- true,- true- ]- },- "hash": "98b0bd8f950443e4240f137adebdf2219b052d3bcbd4a3e79a5f80e81a61522e"-}diff --git a/rust/cloud-storage/.sqlx/query-a39eae1006cfea2c75cd5535ca05790dc40b7534736632062d8167c7f450a830.json b/rust/cloud-storage/.sqlx/query-a39eae1006cfea2c75cd5535ca05790dc40b7534736632062d8167c7f450a830.jsondeleted file mode 100644index 1c414e492b..0000000000--- a/rust/cloud-storage/.sqlx/query-a39eae1006cfea2c75cd5535ca05790dc40b7534736632062d8167c7f450a830.json+++ /dev/null@@ -1,23 +0,0 @@-{- "db_name": "PostgreSQL",- "query": "\n SELECT id\n FROM comms_channels\n WHERE channel_type = 'direct_message'\n AND EXISTS (\n SELECT 1\n FROM comms_channel_participants cp\n WHERE cp.channel_id = comms_channels.id\n AND cp.user_id = $1\n )\n AND EXISTS (\n SELECT 1\n FROM comms_channel_participants cp\n WHERE cp.channel_id = comms_channels.id\n AND cp.user_id = $2\n )\n ",- "describe": {- "columns": [- {- "ordinal": 0,- "name": "id",- "type_info": "Uuid"- }- ],- "parameters": {- "Left": [- "Text",- "Text"- ]- },- "nullable": [- false- ]- },- "hash": "a39eae1006cfea2c75cd5535ca05790dc40b7534736632062d8167c7f450a830"-}diff --git a/rust/cloud-storage/.sqlx/query-a50dbd446eb87217f71d275788a2c2f7ad1583ff17bc8b32145d6863070aa63a.json b/rust/cloud-storage/.sqlx/query-a50dbd446eb87217f71d275788a2c2f7ad1583ff17bc8b32145d6863070aa63a.jsondeleted file mode 100644index ce74fe57d6..0000000000--- a/rust/cloud-storage/.sqlx/query-a50dbd446eb87217f71d275788a2c2f7ad1583ff17bc8b32145d6863070aa63a.json+++ /dev/null@@ -1,71 +0,0 @@-{- "db_name": "PostgreSQL",- "query": "\n SELECT\n id,\n channel_id,\n sender_id,\n content,\n created_at,\n updated_at,\n thread_id,\n edited_at as \"edited_at: chrono::DateTime<chrono::Utc>\",\n deleted_at as \"deleted_at: chrono::DateTime<chrono::Utc>\"\n FROM comms_messages\n WHERE channel_id = (SELECT channel_id FROM comms_messages WHERE id=$1)\n AND\n created_at < (SELECT created_at FROM comms_messages WHERE id=$1)\n ORDER BY created_at DESC\n LIMIT $2\n ",- "describe": {- "columns": [- {- "ordinal": 0,- "name": "id",- "type_info": "Uuid"- },- {- "ordinal": 1,- "name": "channel_id",- "type_info": "Uuid"- },- {- "ordinal": 2,- "name": "sender_id",- "type_info": "Text"- },- {- "ordinal": 3,- "name": "content",- "type_info": "Text"- },- {- "ordinal": 4,- "name": "created_at",- "type_info": "Timestamptz"- },- {- "ordinal": 5,- "name": "updated_at",- "type_info": "Timestamptz"- },- {- "ordinal": 6,- "name": "thread_id",- "type_info": "Uuid"- },- {- "ordinal": 7,- "name": "edited_at: chrono::DateTime<chrono::Utc>",- "type_info": "Timestamp"- },- {- "ordinal": 8,- "name": "deleted_at: chrono::DateTime<chrono::Utc>",- "type_info": "Timestamp"- }- ],- "parameters": {- "Left": [- "Uuid",- "Int8"- ]- },- "nullable": [- false,- false,- false,- false,- false,- false,- true,- true,- true- ]- },- "hash": "a50dbd446eb87217f71d275788a2c2f7ad1583ff17bc8b32145d6863070aa63a"-}diff --git a/rust/cloud-storage/.sqlx/query-a765f217add20532a937d9f7987ea56ce1f80c9cb9236bc3dc83c73b346ffe79.json b/rust/cloud-storage/.sqlx/query-a765f217add20532a937d9f7987ea56ce1f80c9cb9236bc3dc83c73b346ffe79.jsondeleted file mode 100644index cffbe7653a..0000000000--- a/rust/cloud-storage/.sqlx/query-a765f217add20532a937d9f7987ea56ce1f80c9cb9236bc3dc83c73b346ffe79.json+++ /dev/null@@ -1,22 +0,0 @@-{- "db_name": "PostgreSQL",- "query": "\n SELECT\n sender_id\n FROM comms_messages\n WHERE id = $1\n ORDER BY created_at ASC\n ",- "describe": {- "columns": [- {- "ordinal": 0,- "name": "sender_id",- "type_info": "Text"- }- ],- "parameters": {- "Left": [- "Uuid"- ]- },- "nullable": [- false- ]- },- "hash": "a765f217add20532a937d9f7987ea56ce1f80c9cb9236bc3dc83c73b346ffe79"-}diff --git a/rust/cloud-storage/.sqlx/query-af221abca7c795e8be43765273da50af55ed9b7f069ee43fa7149deb8425f6bf.json b/rust/cloud-storage/.sqlx/query-af221abca7c795e8be43765273da50af55ed9b7f069ee43fa7149deb8425f6bf.jsondeleted file mode 100644index f86bbc7421..0000000000--- a/rust/cloud-storage/.sqlx/query-af221abca7c795e8be43765273da50af55ed9b7f069ee43fa7149deb8425f6bf.json+++ /dev/null@@ -1,71 +0,0 @@-{- "db_name": "PostgreSQL",- "query": "\n SELECT\n id,\n name,\n channel_type AS \"channel_type: ChannelType\",\n org_id,\n created_at,\n updated_at,\n owner_id\n FROM comms_channels\n WHERE id = $1\n ",- "describe": {- "columns": [- {- "ordinal": 0,- "name": "id",- "type_info": "Uuid"- },- {- "ordinal": 1,- "name": "name",- "type_info": "Varchar"- },- {- "ordinal": 2,- "name": "channel_type: ChannelType",- "type_info": {- "Custom": {- "name": "comms_channel_type",- "kind": {- "Enum": [- "public",- "organization",- "private",- "direct_message",- "team"- ]- }- }- }- },- {- "ordinal": 3,- "name": "org_id",- "type_info": "Int8"- },- {- "ordinal": 4,- "name": "created_at",- "type_info": "Timestamptz"- },- {- "ordinal": 5,- "name": "updated_at",- "type_info": "Timestamptz"- },- {- "ordinal": 6,- "name": "owner_id",- "type_info": "Text"- }- ],- "parameters": {- "Left": [- "Uuid"- ]- },- "nullable": [- false,- true,- false,- true,- false,- false,- false- ]- },- "hash": "af221abca7c795e8be43765273da50af55ed9b7f069ee43fa7149deb8425f6bf"-}diff --git a/rust/cloud-storage/.sqlx/query-b7234825305171a78e8d113745b271492fc7c2921b36730ce9331249d55d300c.json b/rust/cloud-storage/.sqlx/query-b7234825305171a78e8d113745b271492fc7c2921b36730ce9331249d55d300c.jsondeleted file mode 100644index c75041f6fc..0000000000--- a/rust/cloud-storage/.sqlx/query-b7234825305171a78e8d113745b271492fc7c2921b36730ce9331249d55d300c.json+++ /dev/null@@ -1,16 +0,0 @@-{- "db_name": "PostgreSQL",- "query": "\n INSERT INTO comms_reactions (message_id, emoji, user_id)\n VALUES ($1, $2, $3)\n ON CONFLICT DO NOTHING\n ",- "describe": {- "columns": [],- "parameters": {- "Left": [- "Uuid",- "Varchar",- "Text"- ]- },- "nullable": []- },- "hash": "b7234825305171a78e8d113745b271492fc7c2921b36730ce9331249d55d300c"-}diff --git a/rust/cloud-storage/.sqlx/query-cbe989d8428852cbc096f4f28398b5c5352f1fc2369890ab77d90fb643b8d4c4.json b/rust/cloud-storage/.sqlx/query-cbe989d8428852cbc096f4f28398b5c5352f1fc2369890ab77d90fb643b8d4c4.jsondeleted file mode 100644index 8ab1279285..0000000000--- a/rust/cloud-storage/.sqlx/query-cbe989d8428852cbc096f4f28398b5c5352f1fc2369890ab77d90fb643b8d4c4.json+++ /dev/null@@ -1,64 +0,0 @@-{- "db_name": "PostgreSQL",- "query": "\n SELECT\n id,\n message_id as \"message_id: Uuid\",\n channel_id as \"channel_id: Uuid\",\n entity_type,\n entity_id,\n width,\n height,\n created_at\n FROM comms_attachments\n WHERE channel_id = $1\n ORDER BY created_at ASC\n ",- "describe": {- "columns": [- {- "ordinal": 0,- "name": "id",- "type_info": "Uuid"- },- {- "ordinal": 1,- "name": "message_id: Uuid",- "type_info": "Uuid"- },- {- "ordinal": 2,- "name": "channel_id: Uuid",- "type_info": "Uuid"- },- {- "ordinal": 3,- "name": "entity_type",- "type_info": "Varchar"- },- {- "ordinal": 4,- "name": "entity_id",- "type_info": "Varchar"- },- {- "ordinal": 5,- "name": "width",- "type_info": "Int4"- },- {- "ordinal": 6,- "name": "height",- "type_info": "Int4"- },- {- "ordinal": 7,- "name": "created_at",- "type_info": "Timestamptz"- }- ],- "parameters": {- "Left": [- "Uuid"- ]- },- "nullable": [- false,- false,- false,- false,- false,- true,- true,- false- ]- },- "hash": "cbe989d8428852cbc096f4f28398b5c5352f1fc2369890ab77d90fb643b8d4c4"-}diff --git a/rust/cloud-storage/.sqlx/query-ccc0496ce34f87e79360098eba2eeee80a42eab9217c57dfde6a972b458e609e.json b/rust/cloud-storage/.sqlx/query-ccc0496ce34f87e79360098eba2eeee80a42eab9217c57dfde6a972b458e609e.jsondeleted file mode 100644index 9190908373..0000000000--- a/rust/cloud-storage/.sqlx/query-ccc0496ce34f87e79360098eba2eeee80a42eab9217c57dfde6a972b458e609e.json+++ /dev/null@@ -1,15 +0,0 @@-{- "db_name": "PostgreSQL",- "query": "\n DELETE FROM comms_entity_mentions\n WHERE entity_id = ANY($1) AND source_entity_id = $2\n ",- "describe": {- "columns": [],- "parameters": {- "Left": [- "TextArray",- "Text"- ]- },- "nullable": []- },- "hash": "ccc0496ce34f87e79360098eba2eeee80a42eab9217c57dfde6a972b458e609e"-}diff --git a/rust/cloud-storage/.sqlx/query-d7f495dccb8ccbbb1852b75eb6f8c4886d163b9864ed3cdb0b52b95b4f8325f7.json b/rust/cloud-storage/.sqlx/query-d7f495dccb8ccbbb1852b75eb6f8c4886d163b9864ed3cdb0b52b95b4f8325f7.jsondeleted file mode 100644index 6a73801e19..0000000000--- a/rust/cloud-storage/.sqlx/query-d7f495dccb8ccbbb1852b75eb6f8c4886d163b9864ed3cdb0b52b95b4f8325f7.json+++ /dev/null@@ -1,22 +0,0 @@-{- "db_name": "PostgreSQL",- "query": "\n SELECT id\n FROM comms_channels\n WHERE channel_type = 'private'\n AND (\n (\n SELECT COUNT(*)\n FROM comms_channel_participants cp\n WHERE cp.channel_id = comms_channels.id\n AND cp.user_id = ANY($1)\n ) = CARDINALITY($1)\n AND (\n SELECT COUNT(*)\n FROM comms_channel_participants\n WHERE channel_id = comms_channels.id\n ) = CARDINALITY($1)\n )\n ",- "describe": {- "columns": [- {- "ordinal": 0,- "name": "id",- "type_info": "Uuid"- }- ],- "parameters": {- "Left": [- "TextArray"- ]- },- "nullable": [- false- ]- },- "hash": "d7f495dccb8ccbbb1852b75eb6f8c4886d163b9864ed3cdb0b52b95b4f8325f7"-}diff --git a/rust/cloud-storage/.sqlx/query-e2ce5bac0954c6b635a707279d36b926dfeea6482a19a9fc7911fb5487714cd7.json b/rust/cloud-storage/.sqlx/query-e2ce5bac0954c6b635a707279d36b926dfeea6482a19a9fc7911fb5487714cd7.jsondeleted file mode 100644index aaf62f0e21..0000000000--- a/rust/cloud-storage/.sqlx/query-e2ce5bac0954c6b635a707279d36b926dfeea6482a19a9fc7911fb5487714cd7.json+++ /dev/null@@ -1,40 +0,0 @@-{- "db_name": "PostgreSQL",- "query": "SELECT * FROM comms_reactions WHERE message_id = ANY($1)",- "describe": {- "columns": [- {- "ordinal": 0,- "name": "message_id",- "type_info": "Uuid"- },- {- "ordinal": 1,- "name": "emoji",- "type_info": "Varchar"- },- {- "ordinal": 2,- "name": "user_id",- "type_info": "Text"- },- {- "ordinal": 3,- "name": "created_at",- "type_info": "Timestamptz"- }- ],- "parameters": {- "Left": [- "UuidArray"- ]- },- "nullable": [- false,- false,- false,- false- ]- },- "hash": "e2ce5bac0954c6b635a707279d36b926dfeea6482a19a9fc7911fb5487714cd7"-}diff --git a/rust/cloud-storage/.sqlx/query-e58e7758d9e066abfb5c6d0e5d14ccd7925ff91159a77cc1bf4c94f8e910f2b1.json b/rust/cloud-storage/.sqlx/query-e58e7758d9e066abfb5c6d0e5d14ccd7925ff91159a77cc1bf4c94f8e910f2b1.jsondeleted file mode 100644index 1da6bbfcbe..0000000000--- a/rust/cloud-storage/.sqlx/query-e58e7758d9e066abfb5c6d0e5d14ccd7925ff91159a77cc1bf4c94f8e910f2b1.json+++ /dev/null@@ -1,70 +0,0 @@-{- "db_name": "PostgreSQL",- "query": "\n INSERT INTO comms_attachments (id, message_id, channel_id, entity_type, entity_id, width, height)\n SELECT * FROM UNNEST($1::uuid[], $2::uuid[], $3::uuid[], $4::varchar[], $5::varchar[], $6::int[], $7::int[])\n RETURNING\n id,\n message_id,\n channel_id,\n entity_type,\n entity_id,\n width,\n height,\n created_at\n ",- "describe": {- "columns": [- {- "ordinal": 0,- "name": "id",- "type_info": "Uuid"- },- {- "ordinal": 1,- "name": "message_id",- "type_info": "Uuid"- },- {- "ordinal": 2,- "name": "channel_id",- "type_info": "Uuid"- },- {- "ordinal": 3,- "name": "entity_type",- "type_info": "Varchar"- },- {- "ordinal": 4,- "name": "entity_id",- "type_info": "Varchar"- },- {- "ordinal": 5,- "name": "width",- "type_info": "Int4"- },- {- "ordinal": 6,- "name": "height",- "type_info": "Int4"- },- {- "ordinal": 7,- "name": "created_at",- "type_info": "Timestamptz"- }- ],- "parameters": {- "Left": [- "UuidArray",- "UuidArray",- "UuidArray",- "VarcharArray",- "VarcharArray",- "Int4Array",- "Int4Array"- ]- },- "nullable": [- false,- false,- false,- false,- false,- true,- true,- false- ]- },- "hash": "e58e7758d9e066abfb5c6d0e5d14ccd7925ff91159a77cc1bf4c94f8e910f2b1"-}diff --git a/rust/cloud-storage/.sqlx/query-e7beaf1aca82261875e7d9886fa6b1b6e4ed2a281d8b1571e8edd83bbe890721.json b/rust/cloud-storage/.sqlx/query-e7beaf1aca82261875e7d9886fa6b1b6e4ed2a281d8b1571e8edd83bbe890721.jsondeleted file mode 100644index 46cf44d494..0000000000--- a/rust/cloud-storage/.sqlx/query-e7beaf1aca82261875e7d9886fa6b1b6e4ed2a281d8b1571e8edd83bbe890721.json+++ /dev/null@@ -1,63 +0,0 @@-{- "db_name": "PostgreSQL",- "query": "\n INSERT INTO comms_entity_mentions (id, source_entity_type, source_entity_id, entity_type, entity_id, user_id)\n VALUES ($1, $2, $3, $4, $5, $6)\n RETURNING id, source_entity_type, source_entity_id, entity_type, entity_id, user_id, created_at\n ",- "describe": {- "columns": [- {- "ordinal": 0,- "name": "id",- "type_info": "Uuid"- },- {- "ordinal": 1,- "name": "source_entity_type",- "type_info": "Varchar"- },- {- "ordinal": 2,- "name": "source_entity_id",- "type_info": "Varchar"- },- {- "ordinal": 3,- "name": "entity_type",- "type_info": "Varchar"- },- {- "ordinal": 4,- "name": "entity_id",- "type_info": "Varchar"- },- {- "ordinal": 5,- "name": "user_id",- "type_info": "Varchar"- },- {- "ordinal": 6,- "name": "created_at",- "type_info": "Timestamptz"- }- ],- "parameters": {- "Left": [- "Uuid",- "Varchar",- "Varchar",- "Varchar",- "Varchar",- "Varchar"- ]- },- "nullable": [- false,- false,- false,- false,- false,- true,- false- ]- },- "hash": "e7beaf1aca82261875e7d9886fa6b1b6e4ed2a281d8b1571e8edd83bbe890721"-}diff --git a/rust/cloud-storage/.sqlx/query-ecfb4ae58128a90c615fb3c25c24aaa6dab70b4a4e90b23913f297d806a06a7e.json b/rust/cloud-storage/.sqlx/query-ecfb4ae58128a90c615fb3c25c24aaa6dab70b4a4e90b23913f297d806a06a7e.jsondeleted file mode 100644index 07a1ab68c7..0000000000--- a/rust/cloud-storage/.sqlx/query-ecfb4ae58128a90c615fb3c25c24aaa6dab70b4a4e90b23913f297d806a06a7e.json+++ /dev/null@@ -1,15 +0,0 @@-{- "db_name": "PostgreSQL",- "query": "\n DELETE FROM comms_channels\n WHERE id = $1\n AND EXISTS (\n SELECT 1 FROM comms_channel_participants\n WHERE channel_id = $1\n AND user_id = $2\n AND role = 'owner'::comms_participant_role\n )\n ",- "describe": {- "columns": [],- "parameters": {- "Left": [- "Uuid",- "Text"- ]- },- "nullable": []- },- "hash": "ecfb4ae58128a90c615fb3c25c24aaa6dab70b4a4e90b23913f297d806a06a7e"-}diff --git a/rust/cloud-storage/.sqlx/query-ef1c943a49c710bf357a4946bc9836b8f94e41153e09be1b64120d8b5d5834b9.json b/rust/cloud-storage/.sqlx/query-ef1c943a49c710bf357a4946bc9836b8f94e41153e09be1b64120d8b5d5834b9.jsondeleted file mode 100644index 4cce0a41ea..0000000000--- a/rust/cloud-storage/.sqlx/query-ef1c943a49c710bf357a4946bc9836b8f94e41153e09be1b64120d8b5d5834b9.json+++ /dev/null@@ -1,61 +0,0 @@-{- "db_name": "PostgreSQL",- "query": "\n SELECT \n c.id as channel_id,\n c.name as channel_name,\n c.channel_type as \"channel_type: ChannelType\",\n (\n SELECT COUNT(*) \n FROM comms_channel_participants cp_count \n WHERE cp_count.channel_id = c.id \n AND cp_count.left_at IS NULL\n ) as \"participants!: i32\",\n CASE WHEN (\n c.channel_type = 'public'\n OR\n (c.channel_type = 'organization' AND $3::bigint IS NOT NULL AND c.org_id = $3)\n OR\n (c.channel_type IN ('private', 'direct_message', 'team') AND EXISTS (\n SELECT 1 FROM comms_channel_participants cp \n WHERE cp.channel_id = c.id \n AND cp.user_id = $2\n AND cp.left_at IS NULL\n ))\n ) THEN true ELSE false END as \"has_access!: bool\"\n FROM\n comms_channels c\n WHERE\n c.id::text = ANY($1)\n AND (c.channel_type != 'organization' OR $3::bigint IS NOT NULL)\n GROUP BY \n c.id,\n c.name,\n c.channel_type,\n c.org_id\n ",- "describe": {- "columns": [- {- "ordinal": 0,- "name": "channel_id",- "type_info": "Uuid"- },- {- "ordinal": 1,- "name": "channel_name",- "type_info": "Varchar"- },- {- "ordinal": 2,- "name": "channel_type: ChannelType",- "type_info": {- "Custom": {- "name": "comms_channel_type",- "kind": {- "Enum": [- "public",- "organization",- "private",- "direct_message",- "team"- ]- }- }- }- },- {- "ordinal": 3,- "name": "participants!: i32",- "type_info": "Int8"- },- {- "ordinal": 4,- "name": "has_access!: bool",- "type_info": "Bool"- }- ],- "parameters": {- "Left": [- "TextArray",- "Text",- "Int8"- ]- },- "nullable": [- false,- true,- false,- null,- null- ]- },- "hash": "ef1c943a49c710bf357a4946bc9836b8f94e41153e09be1b64120d8b5d5834b9"-}diff --git a/rust/cloud-storage/.sqlx/query-f994c62400d14f223c8be523136c008a34cde0310e6f57130a9ccd538f9d7866.json b/rust/cloud-storage/.sqlx/query-f994c62400d14f223c8be523136c008a34cde0310e6f57130a9ccd538f9d7866.jsondeleted file mode 100644index f3e671dfa5..0000000000--- a/rust/cloud-storage/.sqlx/query-f994c62400d14f223c8be523136c008a34cde0310e6f57130a9ccd538f9d7866.json+++ /dev/null@@ -1,40 +0,0 @@-{- "db_name": "PostgreSQL",- "query": "\n SELECT\n e.source_entity_id::uuid as \"message_id!: uuid::Uuid\",\n e.entity_type as \"entity_type!\",\n e.entity_id as \"entity_id!\",\n e.created_at as \"created_at!\"\n FROM comms_entity_mentions e\n JOIN comms_messages m ON e.source_entity_id = m.id::text\n WHERE e.source_entity_type = 'message'\n AND m.channel_id = $1\n AND m.deleted_at IS NULL\n ORDER BY e.created_at DESC\n ",- "describe": {- "columns": [- {- "ordinal": 0,- "name": "message_id!: uuid::Uuid",- "type_info": "Uuid"- },- {- "ordinal": 1,- "name": "entity_type!",- "type_info": "Varchar"- },- {- "ordinal": 2,- "name": "entity_id!",- "type_info": "Varchar"- },- {- "ordinal": 3,- "name": "created_at!",- "type_info": "Timestamptz"- }- ],- "parameters": {- "Left": [- "Uuid"- ]- },- "nullable": [- null,- false,- false,- false- ]- },- "hash": "f994c62400d14f223c8be523136c008a34cde0310e6f57130a9ccd538f9d7866"-}diff --git a/rust/cloud-storage/.sqlx/query-faa0297c270e2643d9f8523a4331c4cd24bd39b97dcde6411ace461d6c61a8b0.json b/rust/cloud-storage/.sqlx/query-faa0297c270e2643d9f8523a4331c4cd24bd39b97dcde6411ace461d6c61a8b0.jsondeleted file mode 100644index 7af45e1045..0000000000--- a/rust/cloud-storage/.sqlx/query-faa0297c270e2643d9f8523a4331c4cd24bd39b97dcde6411ace461d6c61a8b0.json+++ /dev/null@@ -1,14 +0,0 @@-{- "db_name": "PostgreSQL",- "query": "\n DELETE FROM comms_attachments\n WHERE id = ANY($1)\n ",- "describe": {- "columns": [],- "parameters": {- "Left": [- "UuidArray"- ]- },- "nullable": []- },- "hash": "faa0297c270e2643d9f8523a4331c4cd24bd39b97dcde6411ace461d6c61a8b0"-}diff --git a/rust/cloud-storage/CLAUDE.md b/rust/cloud-storage/CLAUDE.mdindex 621929b4e8..f85a6acb66 100644--- a/rust/cloud-storage/CLAUDE.md+++ b/rust/cloud-storage/CLAUDE.md@@ -26,7 +26,6 @@ from the cloud-storage folder.**Communication Services:**-- `comms_service`: Internal communication handling- `email_service`: Email processing and management- `notification_service`: User notificationsdiff --git a/rust/cloud-storage/Cargo.lock b/rust/cloud-storage/Cargo.lockindex 98698c682b..75d45e47ba 100644--- a/rust/cloud-storage/Cargo.lock+++ b/rust/cloud-storage/Cargo.lock@@ -2275,79 +2275,6 @@ dependencies = ["uuid",]-[[package]]-name = "comms_service"-version = "0.1.0"-dependencies = [- "anyhow",- "async-trait",- "aws-sdk-secretsmanager",- "aws-sdk-sqs",- "axum",- "axum-extra",- "axum-macros",- "chrono",- "comms",- "comms_db_client",- "connection_gateway_client",- "contacts",- "doppleganger",- "entity_access",- "entity_access_db_utils",- "frecency",- "futures",- "http-body-util",- "jsonwebtoken 10.3.0",- "last_online_tracker",- "macro_auth",- "macro_db_client",- "macro_env",- "macro_env_var",- "macro_middleware",- "macro_user_id",- "macro_uuid",- "model",- "model-entity",- "model_notifications",- "models_comms",- "models_opensearch",- "models_permissions",- "notification",- "reqwest 0.13.3",- "rootcause",- "secretsmanager_client",- "serde",- "serde_json",- "sqlx",- "sqs_client",- "thiserror 2.0.18",- "tokio",- "tower 0.5.3",- "tower-http",- "tracing",- "utoipa",- "utoipa-swagger-ui",- "uuid",-]--[[package]]-name = "comms_service_client"-version = "0.1.0"-dependencies = [- "anyhow",- "async-trait",- "chrono",- "model",- "models_comms",- "reqwest 0.13.3",- "serde",- "serde_json",- "thiserror 2.0.18",- "tracing",- "urlencoding",- "uuid",-]-[[package]]name = "compression-codecs"version = "0.4.38"@@ -3366,7 +3293,6 @@ dependencies = ["chat","chrono","comms",- "comms_service_client","connection_gateway","cookie","crm",@@ -3464,7 +3390,6 @@ dependencies = ["cloudfront_sign","comms","comms_db_client",- "comms_service","connection","connection_gateway_client","contacts",diff --git a/rust/cloud-storage/Cargo.toml b/rust/cloud-storage/Cargo.tomlindex 0942e9372e..3414e2058e 100644--- a/rust/cloud-storage/Cargo.toml+++ b/rust/cloud-storage/Cargo.toml@@ -7,7 +7,6 @@ members = ["backfill_entity_access","bot_id","bots",- "comms_service","connection_gateway","contacts_service","convert_service",diff --git a/rust/cloud-storage/channels/src/domain/ports.rs b/rust/cloud-storage/channels/src/domain/ports.rsindex 6ed9ec558a..b09df3daee 100644--- a/rust/cloud-storage/channels/src/domain/ports.rs+++ b/rust/cloud-storage/channels/src/domain/ports.rs@@ -401,6 +401,20 @@ pub trait ChannelService: Send + Sync + 'static {channel_id: Uuid,) -> impl Future<Output = Result<Vec<ChannelParticipant>, ChannelMessagesErr>> + Send;+ /// Fetch channel metadata (type + resolved display name) from the viewer's perspective.+ fn get_channel_metadata(+ &self,+ channel_id: Uuid,+ viewer_user_id: MacroUserIdStr<'static>,+ ) -> impl Future<Output = Result<ChannelMetadata, ChannelMessagesErr>> + Send {+ let _ = (channel_id, viewer_user_id);+ async move {+ Err(ChannelMessagesErr::Repo(anyhow::anyhow!(+ "get_channel_metadata is not configured"+ )))+ }+ }+/// Batch fetch channel previews for the requested ids.fn batch_get_channel_previews(&self,diff --git a/rust/cloud-storage/channels/src/domain/service.rs b/rust/cloud-storage/channels/src/domain/service.rsindex ce860739c1..8fc019cb41 100644--- a/rust/cloud-storage/channels/src/domain/service.rs+++ b/rust/cloud-storage/channels/src/domain/service.rs@@ -1252,6 +1252,21 @@ whereOk(participants)}+ #[tracing::instrument(err, skip(self))]+ async fn get_channel_metadata(+ &self,+ channel_id: Uuid,+ viewer_user_id: MacroUserIdStr<'static>,+ ) -> Result<ChannelMetadata, ChannelMessagesErr> {+ let metadata = self+ .repo+ .get_channel_metadata(channel_id, viewer_user_id)+ .await+ .map_err(anyhow::Error::from)?;++ Ok(metadata)+ }+#[tracing::instrument(err, skip(self, channel_ids))]async fn batch_get_channel_previews(&self,diff --git a/rust/cloud-storage/channels/src/inbound/axum_router.rs b/rust/cloud-storage/channels/src/inbound/axum_router.rsindex d5bc45046b..142ec7a363 100644--- a/rust/cloud-storage/channels/src/inbound/axum_router.rs+++ b/rust/cloud-storage/channels/src/inbound/axum_router.rs@@ -4,7 +4,7 @@ mod test;use crate::domain::models::{Activity, ActivityType, AttachmentChannelReference, AttachmentEntityReference,AttachmentGenericReference, ChannelAttachment, ChannelAttachmentType, ChannelContextMessage,- ChannelMessage, ChannelMessageKind, ChannelParticipant, CountedReaction,+ ChannelMessage, ChannelMessageKind, ChannelParticipant, ChannelType, CountedReaction,CreateEntityMentionOptions, MessageAttachment, MessagePageDirection, ParticipantRole,ResolvedChannelMessage, Sender, ThreadInfo, ThreadReply,};@@ -292,6 +292,7 @@ whereT: Send + Sync,{channel_mutation_router::<S, Svc>()+ .route("/{channel_id}", get(get_channel_handler::<S, Svc>)).route("/{channel_id}/messages",get(get_channel_messages_handler::<S, Svc>)@@ -1278,6 +1279,83 @@ pub async fn get_channel_attachments_handler<S: ChannelService, Svc: EntityAccesOk(Json(page.type_erase().map(ApiChannelAttachment::from)))}+/// Channel detail: metadata, active participants, and a recent page of messages.+///+/// `messages` is the newest-first first page (size controlled by `limit`); use the+/// dedicated `/{channel_id}/messages` endpoint for cursor pagination.+#[derive(Debug, Serialize, utoipa::ToSchema)]+pub struct ApiChannelDetail {+ /// Channel id.+ channel_id: Uuid,+ /// Channel type.+ channel_type: ChannelType,+ /// Resolved display name from the viewer's perspective.+ channel_name: String,+ /// Active participants.+ participants: Vec<ApiChannelParticipant>,+ /// Recent messages (newest-first first page).+ messages: Vec<ApiChannelMessage>,+}++/// Handler for `GET /channels/{channel_id}`.+#[utoipa::path(+ get,+ operation_id = "get_channel",+ path = "/channels/{channel_id}",+ params(+ ("channel_id" = Uuid, Path, description = "Channel ID"),+ ("limit" = Option<u16>, Query, description = "Recent message page size (1-100, default 50)"),+ ),+ responses(+ (status = 200, body = ApiChannelDetail),+ (status = 401, body = ErrorResponse),+ (status = 404, body = ErrorResponse),+ (status = 500, body = ErrorResponse),+ )+)]+#[tracing::instrument(err, skip_all, fields(channel_id = tracing::field::Empty))]+pub async fn get_channel_handler<S: ChannelService, Svc: EntityAccessService>(+ State(state): State<ChannelsRouterState<S, Svc>>,+ access: ChannelAccessLevelExtractor<MemberParticipantRole, Svc>,+ Query(params): Query<Params>,+) -> Result<Json<ApiChannelDetail>, ChannelsHandlerErr> {+ let channel_id = channel_id_from_receipt(&access.entity_access_receipt)?;+ tracing::Span::current().record("channel_id", tracing::field::display(channel_id));+ let viewer = access+ .entity_access_receipt+ .get_authenticated_user()+ .cloned()+ .map_err(|_| ChannelsHandlerErr::BadRequest("authenticated user required"))?;++ let metadata = state+ .service+ .get_channel_metadata(channel_id, viewer)+ .await?;+ let participants = state.service.get_channel_participants(channel_id).await?;+ let messages = channel_messages_response(+ &state,+ params,+ None,+ channel_id,+ &ChannelMessageFilters::default(),+ None,+ )+ .await?+ .0+ .items;++ Ok(Json(ApiChannelDetail {+ channel_id,+ channel_type: metadata.channel_type,+ channel_name: metadata.channel_name,+ participants: participants+ .into_iter()+ .map(ApiChannelParticipant::from)+ .collect(),+ messages,+ }))+}+/// Handler for `GET /channels/{channel_id}/participants`.#[utoipa::path(get,diff --git a/rust/cloud-storage/comms/src/domain/models.rs b/rust/cloud-storage/comms/src/domain/models.rsindex 8bcfb2d995..952bb514c0 100644--- a/rust/cloud-storage/comms/src/domain/models.rs+++ b/rust/cloud-storage/comms/src/domain/models.rs@@ -1,6 +1,6 @@use item_filters::ast::{LiteralTree, channel::ChannelLiteral};use macro_user_id::user_id::MacroUserIdStr;-pub use models_comms::{channel, mentions};+pub use models_comms::channel;use models_pagination::{Query, SimpleSortMethod};use serde::Deserialize;use uuid::Uuid;diff --git a/rust/cloud-storage/comms_db_client/src/activity/mod.rs b/rust/cloud-storage/comms_db_client/src/activity/mod.rsindex 526b548dc2..d8f25cfdc7 100644--- a/rust/cloud-storage/comms_db_client/src/activity/mod.rs+++ b/rust/cloud-storage/comms_db_client/src/activity/mod.rs@@ -1,3 +1,2 @@pub mod create_activity;pub mod get_activity;-pub mod upsert_activity;diff --git a/rust/cloud-storage/comms_db_client/src/activity/upsert_activity.rs b/rust/cloud-storage/comms_db_client/src/activity/upsert_activity.rsdeleted file mode 100644index ff51b52214..0000000000--- a/rust/cloud-storage/comms_db_client/src/activity/upsert_activity.rs+++ /dev/null@@ -1,85 +0,0 @@-use crate::model::{Activity, ActivityType};-use anyhow::Result;-use chrono::{DateTime, Utc};-use sqlx::{Executor, Postgres};-use uuid::Uuid;--/// Updates activity for the given channel or user-pub async fn upsert_activity<'e, E>(- executor: E,- user_id: &str,- channel_id: &Uuid,- activity_type: &ActivityType,-) -> Result<Activity, sqlx::Error>-where- E: Executor<'e, Database = Postgres>,-{- match activity_type {- ActivityType::View => {- sqlx::query_as!(- Activity,- r#"- INSERT INTO comms_activity (- id,- user_id,- channel_id,- viewed_at- )- VALUES (- $1, $2, $3, NOW()- )- ON CONFLICT (user_id, channel_id) DO UPDATE- SET- viewed_at = NOW(),- updated_at = NOW()- RETURNING- id as "id!: Uuid",- user_id as "user_id!: String",- channel_id as "channel_id!: Uuid",- created_at as "created_at!: DateTime<Utc>",- updated_at as "updated_at!: DateTime<Utc>",- viewed_at as "viewed_at?: DateTime<Utc>",- interacted_at as "interacted_at?: DateTime<Utc>"- "#,- macro_uuid::generate_uuid_v7(),- user_id,- channel_id,- )- .fetch_one(executor)- .await- }- ActivityType::Interact => {- sqlx::query_as!(- Activity,- r#"- INSERT INTO comms_activity (- id,- user_id,- channel_id,- interacted_at- )- VALUES (- $1, $2, $3, NOW()- )- ON CONFLICT (user_id, channel_id) DO UPDATE- SET- interacted_at = NOW(),- updated_at = NOW()- RETURNING- id as "id!: Uuid",- user_id as "user_id!: String",- channel_id as "channel_id!: Uuid",- created_at as "created_at!: DateTime<Utc>",- updated_at as "updated_at!: DateTime<Utc>",- viewed_at as "viewed_at?: DateTime<Utc>",- interacted_at as "interacted_at?: DateTime<Utc>"- "#,- macro_uuid::generate_uuid_v7(),- user_id,- channel_id,- )- .fetch_one(executor)- .await- }- }-}diff --git a/rust/cloud-storage/comms_db_client/src/attachments/delete_attachments.rs b/rust/cloud-storage/comms_db_client/src/attachments/delete_attachments.rsdeleted file mode 100644index 10d54b6daf..0000000000--- a/rust/cloud-storage/comms_db_client/src/attachments/delete_attachments.rs+++ /dev/null@@ -1,34 +0,0 @@-use anyhow::Context;-use sqlx::{Pool, Postgres};-use uuid::Uuid;--#[tracing::instrument(skip(db))]-pub async fn delete_attachments_by_ids(- db: &Pool<Postgres>,- attachment_ids: Vec<Uuid>,-) -> anyhow::Result<u64> {- if attachment_ids.is_empty() {- return Ok(0);- }-- let deleted_count = sqlx::query!(- r#"- DELETE FROM comms_attachments- WHERE id = ANY($1)- "#,- &attachment_ids- )- .execute(db)- .await- .context("failed to delete attachments by IDs")?- .rows_affected();-- // Log deletion information- tracing::debug!(- attachment_ids=?attachment_ids,- count=%deleted_count,- "Deleted attachments by IDs"- );-- Ok(deleted_count)-}diff --git a/rust/cloud-storage/comms_db_client/src/attachments/get_attachments.rs b/rust/cloud-storage/comms_db_client/src/attachments/get_attachments.rsdeleted file mode 100644index cf706c3f4e..0000000000--- a/rust/cloud-storage/comms_db_client/src/attachments/get_attachments.rs+++ /dev/null@@ -1,59 +0,0 @@-use crate::model::Attachment;-use anyhow::{Context, Result};-use sqlx::{Pool, Postgres};-use uuid::Uuid;--#[tracing::instrument(skip(db))]-pub async fn get_attachments(db: &Pool<Postgres>, channel_id: &Uuid) -> Result<Vec<Attachment>> {- let messages = sqlx::query_as!(- Attachment,- r#"- SELECT- id,- message_id as "message_id: Uuid",- channel_id as "channel_id: Uuid",- entity_type,- entity_id,- width,- height,- created_at- FROM comms_attachments- WHERE channel_id = $1- ORDER BY created_at ASC- "#,- channel_id- )- .fetch_all(db)- .await- .context("failed to get attachments")?;-- Ok(messages)-}--#[tracing::instrument(skip(db))]-pub async fn get_attachments_by_message_id(- db: &Pool<Postgres>,- message_id: Uuid,-) -> Result<Vec<Attachment>> {- let attachments = sqlx::query_as!(- Attachment,- r#"- SELECT- id,- message_id as "message_id: Uuid",- channel_id as "channel_id: Uuid",- entity_type,- entity_id,- width,- height,- created_at- FROM comms_attachments- WHERE message_id = $1"#,- message_id- )- .fetch_all(db)- .await- .context("failed to get attachments by message ID")?;-- Ok(attachments)-}diff --git a/rust/cloud-storage/comms_db_client/src/attachments/mod.rs b/rust/cloud-storage/comms_db_client/src/attachments/mod.rsindex 1fa2aff324..8bb77ca8be 100644--- a/rust/cloud-storage/comms_db_client/src/attachments/mod.rs+++ b/rust/cloud-storage/comms_db_client/src/attachments/mod.rs@@ -1,3 +1 @@-pub mod delete_attachments;pub mod get_attachment_references;-pub mod get_attachments;diff --git a/rust/cloud-storage/comms_db_client/src/channels/delete_channel.rs b/rust/cloud-storage/comms_db_client/src/channels/delete_channel.rsdeleted file mode 100644index a3d45304ea..0000000000--- a/rust/cloud-storage/comms_db_client/src/channels/delete_channel.rs+++ /dev/null@@ -1,96 +0,0 @@-use anyhow::{Context, Result};-use sqlx::{Pool, Postgres};-use uuid::Uuid;--/// Deletes a channel given its channel_id-/// The user_id provided must be the owner of the channel-#[tracing::instrument(skip(db))]-pub async fn delete_channel(db: &Pool<Postgres>, channel_id: Uuid, user_id: &str) -> Result<()> {- let result = sqlx::query!(- r#"- DELETE FROM comms_channels- WHERE id = $1- AND EXISTS (- SELECT 1 FROM comms_channel_participants- WHERE channel_id = $1- AND user_id = $2- AND role = 'owner'::comms_participant_role- )- "#,- channel_id,- user_id- )- .execute(db)- .await- .context("Failed to delete channel")?;-- if result.rows_affected() == 0 {- anyhow::bail!(- "channel not deleted, either it didn't exist or the user_id provided was not the owner"- )- } else {- Ok(())- }-}--#[cfg(test)]-mod tests {- use super::*;- use crate::channels::get_channel;- use macro_db_migrator::MACRO_DB_MIGRATIONS;- use sqlx::{Pool, Postgres};-- #[sqlx::test(- migrator = "MACRO_DB_MIGRATIONS",- fixtures(path = "../../fixtures", scripts("channels"))- )]- async fn test_delete_channel(pool: Pool<Postgres>) -> Result<()> {- const _: &sqlx::migrate::Migrator = &MACRO_DB_MIGRATIONS; // Dummy reference for IDE- let result = delete_channel(- &pool,- "11111111-1111-1111-1111-111111111111"- .parse::<Uuid>()- .unwrap(),- "macro|[email protected]",- )- .await;-- assert!(result.is_ok());-- let channel = get_channel::get_channel(- &pool,- &"11111111-1111-1111-1111-111111111111"- .parse::<Uuid>()- .unwrap(),- )- .await;- assert!(channel.is_err());- Ok(())- }- #[sqlx::test(- migrator = "MACRO_DB_MIGRATIONS",- fixtures(path = "../../fixtures", scripts("channels"))- )]- async fn test_delete_channel_fail_when_not_owner(pool: Pool<Postgres>) -> Result<()> {- let result = delete_channel(- &pool,- "11111111-1111-1111-1111-111111111111"- .parse::<Uuid>()- .unwrap(),- "user2",- )- .await;-- assert!(result.is_err());-- let channel = get_channel::get_channel(- &pool,- &"11111111-1111-1111-1111-111111111111"- .parse::<Uuid>()- .unwrap(),- )- .await;- assert!(channel.is_ok());- Ok(())- }-}diff --git a/rust/cloud-storage/comms_db_client/src/channels/get_channel.rs b/rust/cloud-storage/comms_db_client/src/channels/get_channel.rsdeleted file mode 100644index 961f1c699d..0000000000--- a/rust/cloud-storage/comms_db_client/src/channels/get_channel.rs+++ /dev/null@@ -1,60 +0,0 @@-use anyhow::{Context, Result};-use macro_user_id::cowlike::CowLike;-use model::comms::{Channel, ChannelId, ChannelType, OrganizationId};-use sqlx::{Pool, Postgres};-use uuid::Uuid;--pub async fn get_channel(db: &Pool<Postgres>, channel_id: &Uuid) -> Result<Channel> {- let channel = sqlx::query!(- r#"- SELECT- id,- name,- channel_type AS "channel_type: ChannelType",- org_id,- created_at,- updated_at,- owner_id- FROM comms_channels- WHERE id = $1- "#,- channel_id- )- .try_map(|row| {- Ok(Channel {- id: ChannelId(row.id),- name: row.name,- channel_type: row.channel_type,- org_id: row.org_id.map(|id| OrganizationId(id as u32)),- created_at: row.created_at,- updated_at: row.updated_at,- owner_id: macro_user_id::user_id::MacroUserIdStr::parse_from_str(&row.owner_id)- .map_err(|e| sqlx::Error::Decode(Box::new(e)))?- .into_owned(),- })- })- .fetch_one(db)- .await- .context("failed to get channel")?;-- Ok(channel)-}--/// Gets the channel name if present-pub async fn get_channel_name(db: &Pool<Postgres>, channel_id: &Uuid) -> Result<Option<String>> {- let channel = sqlx::query!(- r#"- SELECT- name- FROM comms_channels- WHERE id = $1- "#,- channel_id- )- .map(|row| row.name)- .fetch_one(db)- .await- .context("failed to get channel")?;-- Ok(channel)-}diff --git a/rust/cloud-storage/comms_db_client/src/channels/get_channel_info.rs b/rust/cloud-storage/comms_db_client/src/channels/get_channel_info.rsdeleted file mode 100644index b62fb6de40..0000000000--- a/rust/cloud-storage/comms_db_client/src/channels/get_channel_info.rs+++ /dev/null@@ -1,42 +0,0 @@-use anyhow::Result;-use cached::proc_macro::cached;-use model::comms::ChannelType;-use serde::{Deserialize, Serialize};-use sqlx::{Pool, Postgres};-use uuid::Uuid;--#[derive(Debug, Clone, Serialize, Deserialize)]-pub struct ChannelInfo {- pub channel_type: ChannelType,- pub org_id: Option<i64>,- pub name: Option<String>,-}--#[tracing::instrument(skip(db))]-#[cached(- time = 20,- result = true,- key = "String",- convert = r#"{ channel_id.to_string() }"#-)]-pub async fn get_channel_info(- db: &Pool<Postgres>,- channel_id: &Uuid,-) -> Result<ChannelInfo, sqlx::Error> {- let res = sqlx::query_as!(- ChannelInfo,- r#"- SELECT- channel_type AS "channel_type: ChannelType",- name,- org_id- FROM comms_channels- WHERE id = $1- "#,- channel_id- )- .fetch_one(db)- .await?;-- Ok(res)-}diff --git a/rust/cloud-storage/comms_db_client/src/channels/get_dm.rs b/rust/cloud-storage/comms_db_client/src/channels/get_dm.rsdeleted file mode 100644index 952ff54bb1..0000000000--- a/rust/cloud-storage/comms_db_client/src/channels/get_dm.rs+++ /dev/null@@ -1,44 +0,0 @@-use anyhow::{Context, Result};-use sqlx::{Pool, Postgres};-use uuid::Uuid;--#[derive(Debug, sqlx::FromRow)]-struct ChannelId {- id: Uuid,-}--/// Tries to fetch a channel with channel_type = direct_message and-/// where both user_id and recipient_id are participants of the channel-pub async fn maybe_get_dm(- db: &Pool<Postgres>,- user_id: &str,- recipient_id: &str,-) -> Result<Option<Uuid>> {- let channel = sqlx::query_as!(- ChannelId,- r#"- SELECT id- FROM comms_channels- WHERE channel_type = 'direct_message'- AND EXISTS (- SELECT 1- FROM comms_channel_participants cp- WHERE cp.channel_id = comms_channels.id- AND cp.user_id = $1- )- AND EXISTS (- SELECT 1- FROM comms_channel_participants cp- WHERE cp.channel_id = comms_channels.id- AND cp.user_id = $2- )- "#,- user_id,- recipient_id- )- .fetch_optional(db)- .await- .context("unable to get direct message channel")?;-- Ok(channel.map(|c| c.id))-}diff --git a/rust/cloud-storage/comms_db_client/src/channels/get_mentions_for_channel.rs b/rust/cloud-storage/comms_db_client/src/channels/get_mentions_for_channel.rsdeleted file mode 100644index 1bca9e2884..0000000000--- a/rust/cloud-storage/comms_db_client/src/channels/get_mentions_for_channel.rs+++ /dev/null@@ -1,122 +0,0 @@-use crate::model::MessageMention;-use sqlx::Executor;-use uuid::Uuid;--pub async fn get_mentions_for_channel<'e, E: Executor<'e, Database = sqlx::Postgres>>(- executor: E,- channel_id: &Uuid,-) -> anyhow::Result<Vec<MessageMention>> {- let mentions = sqlx::query_as!(- MessageMention,- r#"- SELECT- e.source_entity_id::uuid as "message_id!: uuid::Uuid",- e.entity_type as "entity_type!",- e.entity_id as "entity_id!",- e.created_at as "created_at!"- FROM comms_entity_mentions e- JOIN comms_messages m ON e.source_entity_id = m.id::text- WHERE e.source_entity_type = 'message'- AND m.channel_id = $1- AND m.deleted_at IS NULL- ORDER BY e.created_at DESC- "#,- channel_id- )- .fetch_all(executor)- .await?;-- Ok(mentions)-}--#[cfg(test)]-mod tests {- use super::*;- use macro_db_migrator::MACRO_DB_MIGRATIONS;- use sqlx::{Pool, Postgres};-- #[sqlx::test(- migrator = "MACRO_DB_MIGRATIONS",- fixtures(path = "../../fixtures", scripts("mentions_extended"))- )]- async fn test_get_mentions_for_channel(pool: Pool<Postgres>) {- const _: &sqlx::migrate::Migrator = &MACRO_DB_MIGRATIONS; // Dummy reference for IDE- let channel_id = uuid::uuid!("11111111-1111-1111-1111-111111111111");-- let mentions = get_mentions_for_channel(&pool, &channel_id).await.unwrap();-- assert_eq!(mentions.len(), 1);- assert_eq!(- mentions[0].message_id,- uuid::uuid!("11111111-1111-1111-1111-111111111111")- );- assert_eq!(mentions[0].entity_type, "user");- assert_eq!(mentions[0].entity_id, "user1");- }-- #[sqlx::test(- migrator = "MACRO_DB_MIGRATIONS",- fixtures(path = "../../fixtures", scripts("mentions_extended"))- )]- async fn test_get_mentions_for_channel_no_mentions(pool: Pool<Postgres>) {- let channel_id = uuid::uuid!("22222222-2222-2222-2222-222222222222");-- let mentions = get_mentions_for_channel(&pool, &channel_id).await.unwrap();-- assert_eq!(mentions.len(), 0);- }-- #[sqlx::test(- migrator = "MACRO_DB_MIGRATIONS",- fixtures(path = "../../fixtures", scripts("mentions_extended"))- )]- async fn test_get_mentions_for_nonexistent_channel(pool: Pool<Postgres>) {- let channel_id = uuid::uuid!("99999999-9999-9999-9999-999999999999");-- let mentions = get_mentions_for_channel(&pool, &channel_id).await.unwrap();-- assert_eq!(mentions.len(), 0);- }-- #[sqlx::test(- migrator = "MACRO_DB_MIGRATIONS",- fixtures(path = "../../fixtures", scripts("mentions_extended"))- )]- async fn test_get_mentions_deleted_message(pool: Pool<Postgres>) {- // Channel 4 has a deleted message with a mention- let channel_id = uuid::uuid!("44444444-4444-4444-4444-444444444444");-- // Should not return mentions from deleted messages- let mentions = get_mentions_for_channel(&pool, &channel_id).await.unwrap();-- assert_eq!(mentions.len(), 0);- }-- #[sqlx::test(- migrator = "MACRO_DB_MIGRATIONS",- fixtures(path = "../../fixtures", scripts("mentions_extended"))- )]- async fn test_get_mentions_multiple_in_channel(pool: Pool<Postgres>) {- // Channel 5 has multiple messages with mentions- let channel_id = uuid::uuid!("55555555-5555-5555-5555-555555555555");-- let mentions = get_mentions_for_channel(&pool, &channel_id).await.unwrap();-- assert_eq!(mentions.len(), 2);-- // Check that mentions are ordered by created_at DESC (newest first)- assert_eq!(- mentions[0].message_id,- uuid::uuid!("55555555-5555-5555-5555-555555555552")- );- assert_eq!(mentions[0].entity_type, "doc");- assert_eq!(mentions[0].entity_id, "doc1");-- assert_eq!(- mentions[1].message_id,- uuid::uuid!("55555555-5555-5555-5555-555555555551")- );- assert_eq!(mentions[1].entity_type, "user");- assert_eq!(mentions[1].entity_id, "user3");- }-}diff --git a/rust/cloud-storage/comms_db_client/src/channels/get_private.rs b/rust/cloud-storage/comms_db_client/src/channels/get_private.rsdeleted file mode 100644index 3b3fce63d7..0000000000--- a/rust/cloud-storage/comms_db_client/src/channels/get_private.rs+++ /dev/null@@ -1,97 +0,0 @@-use anyhow::{Context, Result};-use sqlx::{Pool, Postgres};-use uuid::Uuid;--#[derive(Debug, sqlx::FromRow)]-struct ChannelId {- id: Uuid,-}-/// Tries to fetch a channel that has a certain list of participants-/// and is of type [ChannelType::Private]-pub async fn maybe_get_private_channel(- db: &Pool<Postgres>,- participants: &Vec<String>,-) -> Result<Option<Uuid>> {- let channel = sqlx::query_as!(- ChannelId,- r#"- SELECT id- FROM comms_channels- WHERE channel_type = 'private'- AND (- (- SELECT COUNT(*)- FROM comms_channel_participants cp- WHERE cp.channel_id = comms_channels.id- AND cp.user_id = ANY($1)- ) = CARDINALITY($1)- AND (- SELECT COUNT(*)- FROM comms_channel_participants- WHERE channel_id = comms_channels.id- ) = CARDINALITY($1)- )- "#,- participants- )- .fetch_optional(db)- .await- .context("unable to get private channel")?;-- Ok(channel.map(|c| c.id))-}--#[cfg(test)]-mod tests {- use super::*;- use macro_db_migrator::MACRO_DB_MIGRATIONS;- use sqlx::{Pool, Postgres};-- #[sqlx::test(- migrator = "MACRO_DB_MIGRATIONS",- fixtures(path = "../../fixtures", scripts("channels"))- )]- async fn test_get_existing_private_channel(pool: Pool<Postgres>) -> anyhow::Result<()> {- const _: &sqlx::migrate::Migrator = &MACRO_DB_MIGRATIONS; // Dummy reference for IDE- let result = maybe_get_private_channel(- &pool,- &vec![- "macro|[email protected]".to_string(),- "macro|[email protected]".to_string(),- ],- )- .await?;-- assert_eq!(result, None);-- let result = maybe_get_private_channel(- &pool,- &vec![- "macro|[email protected]".to_string(),- "macro|[email protected]".to_string(),- "macro|[email protected]".to_string(),- ],- )- .await?;-- assert_eq!(- result.unwrap(),- Uuid::parse_str("11111111-1111-1111-1111-111111111111")?- );-- let result = maybe_get_private_channel(- &pool,- &vec![- "macro|[email protected]".to_string(),- "macro|[email protected]".to_string(),- "macro|[email protected]".to_string(),- "macro|[email protected]".to_string(),- ],- )- .await?;-- assert_eq!(result, None);-- Ok(())- }-}diff --git a/rust/cloud-storage/comms_db_client/src/channels/mod.rs b/rust/cloud-storage/comms_db_client/src/channels/mod.rsindex 3ac07e556a..362f4b2d98 100644--- a/rust/cloud-storage/comms_db_client/src/channels/mod.rs+++ b/rust/cloud-storage/comms_db_client/src/channels/mod.rs@@ -1,11 +1,3 @@pub mod create_channel;-pub mod delete_channel;-pub mod get_channel;-pub mod get_channel_info;pub mod get_channels;-pub mod get_dm;-pub mod get_mentions_for_channel;-pub mod get_private;-pub mod patch_channel;pub mod seed_channel;-pub mod updated_at;diff --git a/rust/cloud-storage/comms_db_client/src/channels/patch_channel.rs b/rust/cloud-storage/comms_db_client/src/channels/patch_channel.rsdeleted file mode 100644index da73412e12..0000000000--- a/rust/cloud-storage/comms_db_client/src/channels/patch_channel.rs+++ /dev/null@@ -1,137 +0,0 @@-use anyhow::{Context, Result};-use sqlx::{Pool, Postgres};-use utoipa::ToSchema;-use uuid::Uuid;--#[derive(Debug, serde::Serialize, serde::Deserialize, ToSchema)]-pub struct PatchChannelOptions {- pub channel_name: Option<String>,-}--#[tracing::instrument(skip(db))]-pub async fn patch_channel(- db: &Pool<Postgres>,- channel_id: &Uuid,- user_id: &str,- options: PatchChannelOptions,-) -> Result<()> {- let authorized = sqlx::query!(- r#"- SELECT EXISTS (- SELECT 1 FROM comms_channel_participants- WHERE channel_id = $1- AND user_id = $2- AND role IN ('admin'::comms_participant_role, 'owner'::comms_participant_role)- ) as "is_authorized!"- "#,- channel_id,- user_id- )- .fetch_one(db)- .await- .context("Failed to check user authorization")?- .is_authorized;-- if !authorized {- anyhow::bail!(- "User is not authorized to perform this action, to patch a channel you must be an admin or owner"- );- }-- let mut transaction = db.begin().await?;-- if let Some(channel_name) = options.channel_name {- sqlx::query!(- r#"- UPDATE comms_channels- SET name = $1- WHERE id = $2- "#,- channel_name,- channel_id- )- .execute(&mut *transaction)- .await?;- }-- transaction.commit().await?;-- return Ok(());-}--#[cfg(test)]-mod tests {- use super::*;- use crate::channels::get_channel;- use macro_db_migrator::MACRO_DB_MIGRATIONS;- use sqlx::{Pool, Postgres};-- #[sqlx::test(- migrator = "MACRO_DB_MIGRATIONS",- fixtures(path = "../../fixtures", scripts("channels"))- )]- async fn test_patch_channel(pool: Pool<Postgres>) -> Result<()> {- const _: &sqlx::migrate::Migrator = &MACRO_DB_MIGRATIONS; // Dummy reference for IDE- let result = patch_channel(- &pool,- &"11111111-1111-1111-1111-111111111111"- .parse::<Uuid>()- .unwrap(),- "macro|[email protected]",- PatchChannelOptions {- channel_name: Some("new channel name".to_string()),- },- )- .await;-- assert!(result.is_ok());-- let channel = get_channel::get_channel(- &pool,- &"11111111-1111-1111-1111-111111111111"- .parse::<Uuid>()- .unwrap(),- )- .await;-- assert!(channel.is_ok());-- assert_eq!(channel.unwrap().name, Some("new channel name".to_string()));-- Ok(())- }-- #[sqlx::test(- migrator = "MACRO_DB_MIGRATIONS",- fixtures(path = "../../fixtures", scripts("channels"))- )]- async fn test_patch_channnel_unauthorized(pool: Pool<Postgres>) -> Result<()> {- let result = patch_channel(- &pool,- &"11111111-1111-1111-1111-111111111111"- .parse::<Uuid>()- .unwrap(),- "macro|[email protected]",- PatchChannelOptions {- channel_name: Some("new channel name".to_string()),- },- )- .await;-- assert!(result.is_err());-- let channel = get_channel::get_channel(- &pool,- &"11111111-1111-1111-1111-111111111111"- .parse::<Uuid>()- .unwrap(),- )- .await;-- assert!(channel.is_ok());-- assert_eq!(channel.unwrap().name, Some("private 1 ".to_string()));-- Ok(())- }-}diff --git a/rust/cloud-storage/comms_db_client/src/channels/updated_at.rs b/rust/cloud-storage/comms_db_client/src/channels/updated_at.rsdeleted file mode 100644index 99c8235512..0000000000--- a/rust/cloud-storage/comms_db_client/src/channels/updated_at.rs+++ /dev/null@@ -1,28 +0,0 @@-use anyhow::{Context, Result};-use uuid::Uuid;--/// Updates the updated_at timestamp for the given channel-/// to the current time-pub async fn updated_at<'e, E>(- executor: E,- channel_id: &Uuid,-) -> Result<chrono::DateTime<chrono::Utc>>-where- E: sqlx::Executor<'e, Database = sqlx::Postgres>,-{- let now = chrono::Utc::now();- sqlx::query!(- r#"- UPDATE comms_channels- SET updated_at = $2- WHERE id = $1- "#,- channel_id,- now- )- .execute(executor)- .await- .context("unable to update the channel updated_at timestamp")?;-- Ok(now)-}diff --git a/rust/cloud-storage/comms_db_client/src/entity_mentions/create_entity_mention.rs b/rust/cloud-storage/comms_db_client/src/entity_mentions/create_entity_mention.rsdeleted file mode 100644index f2637b0fa1..0000000000--- a/rust/cloud-storage/comms_db_client/src/entity_mentions/create_entity_mention.rs+++ /dev/null@@ -1,156 +0,0 @@-use crate::model::EntityMention;-use anyhow::Result;-use sqlx::{Executor, Postgres};--#[derive(Debug, Clone)]-pub struct CreateEntityMentionOptions {- pub source_entity_type: String,- pub source_entity_id: String,- pub entity_type: String,- pub entity_id: String,- pub user_id: Option<String>,-}--#[tracing::instrument(skip(executor))]-pub async fn create_entity_mention<'e, E>(- executor: E,- options: CreateEntityMentionOptions,-) -> Result<EntityMention>-where- E: Executor<'e, Database = Postgres>,-{- let id = macro_uuid::generate_uuid_v7();-- let entity_mention = sqlx::query_as!(- EntityMention,- r#"- INSERT INTO comms_entity_mentions (id, source_entity_type, source_entity_id, entity_type, entity_id, user_id)- VALUES ($1, $2, $3, $4, $5, $6)- RETURNING id, source_entity_type, source_entity_id, entity_type, entity_id, user_id, created_at- "#,- id,- options.source_entity_type,- options.source_entity_id,- options.entity_type,- options.entity_id,- options.user_id,- )- .fetch_one(executor)- .await?;-- Ok(entity_mention)-}--#[cfg(test)]-mod tests {- use super::*;- use macro_db_migrator::MACRO_DB_MIGRATIONS;- use sqlx::PgPool;- use std::str::FromStr;- use uuid::Uuid;-- #[sqlx::test(- migrator = "MACRO_DB_MIGRATIONS",- fixtures(path = "./../../fixtures", scripts("mentions"))- )]- async fn test_create_entity_mention(pool: PgPool) -> anyhow::Result<()> {- const _: &sqlx::migrate::Migrator = &MACRO_DB_MIGRATIONS; // Dummy reference for IDE- let message_id = Uuid::from_str("11111111-1111-1111-1111-111111111111")?;-- create_entity_mention(- &pool,- CreateEntityMentionOptions {- source_entity_type: "message".to_string(),- source_entity_id: message_id.to_string(),- entity_type: "document".to_string(),- entity_id: "doc123".to_string(),- user_id: None,- },- )- .await?;-- // Verify the mention was created- let count = sqlx::query_scalar!(- r#"- SELECT COUNT(*) as "count!"- FROM comms_entity_mentions- WHERE source_entity_type = 'message'- AND source_entity_id = $1- AND entity_type = 'document'- AND entity_id = 'doc123'- "#,- message_id.to_string()- )- .fetch_one(&pool)- .await?;-- assert_eq!(count, 1);- Ok(())- }-- #[sqlx::test(- migrator = "MACRO_DB_MIGRATIONS",- fixtures(path = "./../../fixtures", scripts("mentions"))- )]- async fn test_create_entity_mention_allows_duplicates(pool: PgPool) -> anyhow::Result<()> {- let message_id = Uuid::from_str("11111111-1111-1111-1111-111111111111")?;- let options = CreateEntityMentionOptions {- source_entity_type: "message".to_string(),- source_entity_id: message_id.to_string(),- entity_type: "document".to_string(),- entity_id: "doc456".to_string(),- user_id: None,- };-- // Create the mention twice- create_entity_mention(&pool, options.clone()).await?;- create_entity_mention(&pool, options).await?;-- // Should now have two mentions since duplicates are allowed- let count = sqlx::query_scalar!(- r#"- SELECT COUNT(*) as "count!"- FROM comms_entity_mentions- WHERE source_entity_type = 'message'- AND source_entity_id = $1- AND entity_type = 'document'- AND entity_id = 'doc456'- "#,- message_id.to_string()- )- .fetch_one(&pool)- .await?;-- assert_eq!(count, 2);- Ok(())- }-- #[sqlx::test(- migrator = "MACRO_DB_MIGRATIONS",- fixtures(path = "./../../fixtures", scripts("mentions"))- )]- async fn test_create_entity_mention_with_user_id(pool: PgPool) -> anyhow::Result<()> {- let _message_id = Uuid::from_str("11111111-1111-1111-1111-111111111111")?;- let user_id = "user123".to_string();-- let mention = create_entity_mention(- &pool,- CreateEntityMentionOptions {- source_entity_type: "document".to_string(),- source_entity_id: "doc789".to_string(),- entity_type: "user".to_string(),- entity_id: "user123".to_string(),- user_id: Some(user_id.clone()),- },- )- .await?;-- // Verify the mention was created with the user_id- assert_eq!(mention.user_id, Some(user_id));- assert_eq!(mention.source_entity_type, "document");- assert_eq!(mention.source_entity_id, "doc789");- assert_eq!(mention.entity_type, "user");- assert_eq!(mention.entity_id, "user123");- Ok(())- }-}diff --git a/rust/cloud-storage/comms_db_client/src/entity_mentions/delete_entity_mention_by_id.rs b/rust/cloud-storage/comms_db_client/src/entity_mentions/delete_entity_mention_by_id.rsdeleted file mode 100644index 050bf8acb2..0000000000--- a/rust/cloud-storage/comms_db_client/src/entity_mentions/delete_entity_mention_by_id.rs+++ /dev/null@@ -1,263 +0,0 @@-use anyhow::Result;-use sqlx::{Executor, Postgres};-use uuid::Uuid;--#[tracing::instrument(skip(executor))]-pub async fn delete_entity_mention_by_id<'e, E>(executor: E, id: Uuid) -> Result<bool>-where- E: Executor<'e, Database = Postgres>,-{- let result = sqlx::query!(- r#"- DELETE FROM comms_entity_mentions- WHERE id = $1- "#,- id,- )- .execute(executor)- .await?;-- Ok(result.rows_affected() > 0)-}--#[tracing::instrument(skip(executor))]-pub async fn delete_entity_mentions_by_entity<'e, E>(- executor: E,- entity_ids: Vec<String>,- source_entity_id: String,-) -> Result<u64>-where- E: Executor<'e, Database = Postgres>,-{- if entity_ids.is_empty() {- return Ok(0);- }-- let result = sqlx::query!(- r#"- DELETE FROM comms_entity_mentions- WHERE entity_id = ANY($1) AND source_entity_id = $2- "#,- &entity_ids,- source_entity_id,- )- .execute(executor)- .await?;-- tracing::debug!(- entity_ids=?entity_ids,- source_entity_id=%source_entity_id,- rows_affected=%result.rows_affected(),- "Deleted entity mentions matching entity_ids and source_entity_id"- );-- Ok(result.rows_affected())-}--#[cfg(test)]-mod tests {- use super::*;- use crate::entity_mentions::create_entity_mention::{- CreateEntityMentionOptions, create_entity_mention,- };- use macro_db_migrator::MACRO_DB_MIGRATIONS;- use sqlx::PgPool;-- #[sqlx::test(- migrator = "MACRO_DB_MIGRATIONS",- fixtures(path = "./../../fixtures", scripts("mentions"))- )]- async fn test_delete_entity_mention_by_id(pool: PgPool) -> anyhow::Result<()> {- const _: &sqlx::migrate::Migrator = &MACRO_DB_MIGRATIONS; // Dummy reference for IDE- // First create a mention- let created_mention = create_entity_mention(- &pool,- CreateEntityMentionOptions {- source_entity_type: "document".to_string(),- source_entity_id: "doc123".to_string(),- entity_type: "user".to_string(),- entity_id: "user789".to_string(),- user_id: None,- },- )- .await?;-- // Delete it by ID- let deleted = delete_entity_mention_by_id(&pool, created_mention.id).await?;- assert!(deleted);-- // Verify it's gone- let count = sqlx::query_scalar!(- r#"- SELECT COUNT(*) as "count!"- FROM comms_entity_mentions- WHERE id = $1- "#,- created_mention.id- )- .fetch_one(&pool)- .await?;-- assert_eq!(count, 0);- Ok(())- }-- #[sqlx::test(- migrator = "MACRO_DB_MIGRATIONS",- fixtures(path = "./../../fixtures", scripts("mentions"))- )]- async fn test_delete_entity_mention_by_id_nonexistent(pool: PgPool) -> anyhow::Result<()> {- let random_id = Uuid::new_v4();-- // Try to delete a non-existent mention- let deleted = delete_entity_mention_by_id(&pool, random_id).await?;-- assert!(!deleted);- Ok(())- }-- #[sqlx::test(- migrator = "MACRO_DB_MIGRATIONS",- fixtures(path = "./../../fixtures", scripts("mentions"))- )]- async fn test_delete_entity_mentions_by_entity(pool: PgPool) -> anyhow::Result<()> {- // Create test data with different entity_ids but same source_entity_id- let source_entity_id = "doc123".to_string();- let entity_ids = vec![- "user1".to_string(),- "user2".to_string(),- "user3".to_string(),- ];-- // Create mentions for each entity_id- for entity_id in &entity_ids {- // Create first mention- let _mention = create_entity_mention(- &pool,- CreateEntityMentionOptions {- source_entity_type: "document".to_string(),- source_entity_id: source_entity_id.clone(),- entity_type: "user".to_string(),- entity_id: entity_id.clone(),- user_id: None,- },- )- .await?;-- // Create duplicate mention to test multiple deletions per entity_id- if entity_id == "user1" {- let _duplicate = create_entity_mention(- &pool,- CreateEntityMentionOptions {- source_entity_type: "document".to_string(),- source_entity_id: source_entity_id.clone(),- entity_type: "user".to_string(),- entity_id: entity_id.clone(),- user_id: None,- },- )- .await?;- }- }-- // Create an additional mention with different source_entity_id that shouldn't be deleted- let _other_mention = create_entity_mention(- &pool,- CreateEntityMentionOptions {- source_entity_type: "document".to_string(),- source_entity_id: "different_doc".to_string(),- entity_type: "user".to_string(),- entity_id: "user1".to_string(),- user_id: None,- },- )- .await?;-- // Delete only user1 and user2 mentions, leaving user3- let deleted_count = delete_entity_mentions_by_entity(- &pool,- vec!["user1".to_string(), "user2".to_string()],- source_entity_id.clone(),- )- .await?;-- // Should have deleted 3 mentions (2 for user1, 1 for user2)- assert_eq!(deleted_count, 3);-- // Verify user1 and user2 mentions are gone for this source_entity_id- let remaining_count = sqlx::query_scalar!(- r#"- SELECT COUNT(*) as "count!"- FROM comms_entity_mentions- WHERE entity_id IN ('user1', 'user2') AND source_entity_id = $1- "#,- source_entity_id- )- .fetch_one(&pool)- .await?;-- assert_eq!(remaining_count, 0);-- // Verify user3 mention still exists- let user3_count = sqlx::query_scalar!(- r#"- SELECT COUNT(*) as "count!"- FROM comms_entity_mentions- WHERE entity_id = 'user3' AND source_entity_id = $1- "#,- source_entity_id- )- .fetch_one(&pool)- .await?;-- assert_eq!(user3_count, 1);-- // Verify the different source_entity_id mention wasn't deleted- let other_count = sqlx::query_scalar!(- r#"- SELECT COUNT(*) as "count!"- FROM comms_entity_mentions- WHERE entity_id = 'user1' AND source_entity_id = 'different_doc'- "#,- )- .fetch_one(&pool)- .await?;-- assert_eq!(other_count, 1);-- Ok(())- }-- #[sqlx::test(- migrator = "MACRO_DB_MIGRATIONS",- fixtures(path = "./../../fixtures", scripts("mentions"))- )]- async fn test_delete_entity_mentions_by_entity_empty_list(pool: PgPool) -> anyhow::Result<()> {- // Should return early with 0 count when entity_ids is empty- let deleted_count =- delete_entity_mentions_by_entity(&pool, vec![], "doc123".to_string()).await?;-- assert_eq!(deleted_count, 0);- Ok(())- }-- #[sqlx::test(- migrator = "MACRO_DB_MIGRATIONS",- fixtures(path = "./../../fixtures", scripts("mentions"))- )]- async fn test_delete_entity_mentions_by_entity_nonexistent(pool: PgPool) -> anyhow::Result<()> {- // Try to delete non-existent mentions- let deleted_count = delete_entity_mentions_by_entity(- &pool,- vec![- "nonexistent_user1".to_string(),- "nonexistent_user2".to_string(),- ],- "nonexistent_doc".to_string(),- )- .await?;-- assert_eq!(deleted_count, 0);- Ok(())- }-}diff --git a/rust/cloud-storage/comms_db_client/src/entity_mentions/get_entity_mention_by_id.rs b/rust/cloud-storage/comms_db_client/src/entity_mentions/get_entity_mention_by_id.rsdeleted file mode 100644index 1e9e86129c..0000000000--- a/rust/cloud-storage/comms_db_client/src/entity_mentions/get_entity_mention_by_id.rs+++ /dev/null@@ -1,80 +0,0 @@-use crate::model::EntityMention;-use anyhow::Result;-use sqlx::{Executor, Postgres};-use uuid::Uuid;--#[tracing::instrument(skip(executor))]-pub async fn get_entity_mention_by_id<'e, E>(executor: E, id: Uuid) -> Result<Option<EntityMention>>-where- E: Executor<'e, Database = Postgres>,-{- let entity_mention = sqlx::query_as!(- EntityMention,- r#"- SELECT id, source_entity_type, source_entity_id, entity_type, entity_id, user_id, created_at- FROM comms_entity_mentions- WHERE id = $1- "#,- id,- )- .fetch_optional(executor)- .await?;-- Ok(entity_mention)-}--#[cfg(test)]-mod tests {- use super::*;- use crate::entity_mentions::create_entity_mention::{- CreateEntityMentionOptions, create_entity_mention,- };- use macro_db_migrator::MACRO_DB_MIGRATIONS;- use sqlx::PgPool;-- #[sqlx::test(- migrator = "MACRO_DB_MIGRATIONS",- fixtures(path = "./../../fixtures", scripts("mentions"))- )]- async fn test_get_entity_mention_by_id(pool: PgPool) -> anyhow::Result<()> {- const _: &sqlx::migrate::Migrator = &MACRO_DB_MIGRATIONS; // Dummy reference for IDE- // Create an entity mention first- let created_mention = create_entity_mention(- &pool,- CreateEntityMentionOptions {- source_entity_type: "document".to_string(),- source_entity_id: "doc123".to_string(),- entity_type: "user".to_string(),- entity_id: "user456".to_string(),- user_id: None,- },- )- .await?;-- // Fetch it by ID- let fetched_mention = get_entity_mention_by_id(&pool, created_mention.id)- .await?- .expect("Mention should exist");-- assert_eq!(fetched_mention.id, created_mention.id);- assert_eq!(fetched_mention.source_entity_type, "document");- assert_eq!(fetched_mention.source_entity_id, "doc123");- assert_eq!(fetched_mention.entity_type, "user");- assert_eq!(fetched_mention.entity_id, "user456");-- Ok(())- }-- #[sqlx::test(- migrator = "MACRO_DB_MIGRATIONS",- fixtures(path = "./../../fixtures", scripts("mentions"))- )]- async fn test_get_entity_mention_by_id_not_found(pool: PgPool) -> anyhow::Result<()> {- let random_id = Uuid::new_v4();-- let result = get_entity_mention_by_id(&pool, random_id).await?;-- assert!(result.is_none());- Ok(())- }-}diff --git a/rust/cloud-storage/comms_db_client/src/entity_mentions/get_entity_mentions_for_thread.rs b/rust/cloud-storage/comms_db_client/src/entity_mentions/get_entity_mentions_for_thread.rsdeleted file mode 100644index 9be3e0a60e..0000000000--- a/rust/cloud-storage/comms_db_client/src/entity_mentions/get_entity_mentions_for_thread.rs+++ /dev/null@@ -1,38 +0,0 @@-use crate::model::EntityMention;-use sqlx::{Executor, Postgres};-use uuid::Uuid;--/// This query finds all entity mentions where the source is a message-/// that is either the parent message of a thread OR a reply within that thread.-#[tracing::instrument(skip(executor))]-pub async fn get_entity_mentions_for_thread<'e, E>(- executor: E,- message_id: &Uuid,-) -> anyhow::Result<Vec<EntityMention>, sqlx::Error>-where- E: Executor<'e, Database = Postgres>,-{- let mentions = sqlx::query_as!(- EntityMention,- r#"- SELECT- em.id,- em.source_entity_type,- em.source_entity_id,- em.entity_type,- em.entity_id,- em.user_id,- em.created_at- FROM comms_entity_mentions AS em- JOIN comms_messages AS m ON em.source_entity_id = m.id::text- WHERE em.source_entity_type = 'message'- AND (m.id = $1 OR m.thread_id = $1)- ORDER BY em.created_at ASC- "#,- message_id,- )- .fetch_all(executor)- .await?;-- Ok(mentions)-}diff --git a/rust/cloud-storage/comms_db_client/src/entity_mentions/mod.rs b/rust/cloud-storage/comms_db_client/src/entity_mentions/mod.rsindex 71db169bfa..a721cd068c 100644--- a/rust/cloud-storage/comms_db_client/src/entity_mentions/mod.rs+++ b/rust/cloud-storage/comms_db_client/src/entity_mentions/mod.rs@@ -1,13 +1,3 @@-pub mod create_entity_mention;-pub mod delete_entity_mention_by_id;pub mod delete_entity_mentions_by_source;-pub mod get_entity_mention_by_id;-mod get_entity_mentions_for_thread;-pub use create_entity_mention::{CreateEntityMentionOptions, create_entity_mention};-pub use delete_entity_mention_by_id::{- delete_entity_mention_by_id, delete_entity_mentions_by_entity,-};pub use delete_entity_mentions_by_source::delete_entity_mentions_by_source;-pub use get_entity_mention_by_id::get_entity_mention_by_id;-pub use get_entity_mentions_for_thread::get_entity_mentions_for_thread;diff --git a/rust/cloud-storage/comms_db_client/src/lib.rs b/rust/cloud-storage/comms_db_client/src/lib.rsindex 94434630d8..a9e4232dec 100644--- a/rust/cloud-storage/comms_db_client/src/lib.rs+++ b/rust/cloud-storage/comms_db_client/src/lib.rs@@ -2,9 +2,6 @@ pub mod activity;pub mod attachments;pub mod channels;pub mod entity_mentions;-pub mod mentions;pub mod messages;pub mod model;pub mod participants;-pub mod preview;-pub mod reactions;diff --git a/rust/cloud-storage/comms_db_client/src/mentions.rs b/rust/cloud-storage/comms_db_client/src/mentions.rsdeleted file mode 100644index 171b3562ee..0000000000--- a/rust/cloud-storage/comms_db_client/src/mentions.rs+++ /dev/null@@ -1,44 +0,0 @@-pub async fn get_channel_mentions_by_item(- db: &sqlx::Pool<sqlx::Postgres>,- item_id: &str,- item_type: &str,-) -> anyhow::Result<Vec<String>> {- let channel_ids = sqlx::query!(- r#"- SELECT DISTINCT m.channel_id- FROM comms_entity_mentions em- JOIN comms_messages m ON m.id::text = em.source_entity_id AND em.source_entity_type = 'message'- JOIN comms_channels c ON c.id = m.channel_id- WHERE em.entity_id = $1 AND em.entity_type = $2- "#,- item_id,- item_type,- )- .map(|row| row.channel_id.to_string())- .fetch_all(db)- .await?;-- Ok(channel_ids)-}--#[cfg(test)]-mod tests {- use super::*;- use macro_db_migrator::MACRO_DB_MIGRATIONS;-- #[sqlx::test(- migrator = "MACRO_DB_MIGRATIONS",- fixtures(path = "../fixtures", scripts("mentions"))- )]- async fn test_get_channel_mentions_by_item(- pool: sqlx::Pool<sqlx::Postgres>,- ) -> anyhow::Result<()> {- const _: &sqlx::migrate::Migrator = &MACRO_DB_MIGRATIONS; // Dummy reference for IDE- let channel_ids = get_channel_mentions_by_item(&pool, "user1", "user").await?;- assert_eq!(- channel_ids,- vec!["11111111-1111-1111-1111-111111111111".to_string()]- );- Ok(())- }-}diff --git a/rust/cloud-storage/comms_db_client/src/messages/add_attachments.rs b/rust/cloud-storage/comms_db_client/src/messages/add_attachments.rsdeleted file mode 100644index 0685a36970..0000000000--- a/rust/cloud-storage/comms_db_client/src/messages/add_attachments.rs+++ /dev/null@@ -1,55 +0,0 @@-use anyhow::Result;-use sqlx::{Pool, Postgres};-use uuid::Uuid;--use crate::model::{Attachment, NewAttachment};--#[tracing::instrument(skip(db))]-pub async fn add_attachments_to_message(- db: &Pool<Postgres>,- message_id: &Uuid,- channel_id: &Uuid,- attachments: Vec<NewAttachment>,-) -> Result<Vec<Attachment>> {- if attachments.is_empty() {- return Ok(vec![]);- }-- let ids: Vec<Uuid> = attachments- .iter()- .map(|_| macro_uuid::generate_uuid_v7())- .collect();-- let entity_types: Vec<String> = attachments.iter().map(|a| a.entity_type.clone()).collect();- let entity_ids: Vec<String> = attachments.iter().map(|a| a.entity_id.clone()).collect();- let widths: Vec<Option<i32>> = attachments.iter().map(|a| a.width).collect();- let heights: Vec<Option<i32>> = attachments.iter().map(|a| a.height).collect();-- let created_attachments = sqlx::query_as!(- Attachment,- r#"- INSERT INTO comms_attachments (id, message_id, channel_id, entity_type, entity_id, width, height)- SELECT * FROM UNNEST($1::uuid[], $2::uuid[], $3::uuid[], $4::varchar[], $5::varchar[], $6::int[], $7::int[])- RETURNING- id,- message_id,- channel_id,- entity_type,- entity_id,- width,- height,- created_at- "#,- &ids as &[Uuid],- &vec![*message_id; attachments.len()] as &[Uuid],- &vec![*channel_id; attachments.len()] as &[Uuid],- &entity_types as &[String],- &entity_ids as &[String],- &widths as &[Option<i32>],- &heights as &[Option<i32>]- )- .fetch_all(db)- .await?;-- Ok(created_attachments)-}diff --git a/rust/cloud-storage/comms_db_client/src/messages/delete_message.rs b/rust/cloud-storage/comms_db_client/src/messages/delete_message.rsdeleted file mode 100644index 6d1ecb5930..0000000000--- a/rust/cloud-storage/comms_db_client/src/messages/delete_message.rs+++ /dev/null@@ -1,48 +0,0 @@-use crate::model::Message;-use anyhow::{Context, Result};-use macro_user_id::{cowlike::CowLike, user_id::MacroUserIdStr};-use sqlx::{Pool, Postgres};-use uuid::Uuid;--#[tracing::instrument(skip(db))]-pub async fn delete_message(db: &Pool<Postgres>, message_id: Uuid) -> Result<Message> {- let message = sqlx::query!(- r#"- UPDATE comms_messages- SET content = $1, updated_at = NOW(), deleted_at = NOW()- WHERE id = $2- RETURNING- id,- channel_id,- sender_id,- content,- created_at,- updated_at,- thread_id,- edited_at as "edited_at: chrono::DateTime<chrono::Utc>",- deleted_at as "deleted_at: chrono::DateTime<chrono::Utc>"- "#,- "".to_string(),- message_id- )- .try_map(|row| {- Ok(Message {- id: row.id,- channel_id: row.channel_id,- thread_id: row.thread_id,- sender_id: MacroUserIdStr::parse_from_str(&row.sender_id)- .map_err(|e| sqlx::Error::Decode(Box::new(e)))?- .into_owned(),- content: row.content,- created_at: row.created_at,- updated_at: row.updated_at,- edited_at: row.edited_at,- deleted_at: row.deleted_at,- })- })- .fetch_one(db)- .await- .context("unable to delete message")?;-- Ok(message)-}diff --git a/rust/cloud-storage/comms_db_client/src/messages/get_count.rs b/rust/cloud-storage/comms_db_client/src/messages/get_count.rsdeleted file mode 100644index e3f82f0cd5..0000000000--- a/rust/cloud-storage/comms_db_client/src/messages/get_count.rs+++ /dev/null@@ -1,26 +0,0 @@-use sqlx::{Executor, Postgres};-use uuid::Uuid;--#[cfg(test)]-mod test;--/// Returns the total number of messages (including soft-deleted) in the-/// given channel.-#[tracing::instrument(skip(executor))]-pub async fn get_channel_message_count<'e, E>(executor: E, channel_id: &Uuid) -> anyhow::Result<i64>-where- E: Executor<'e, Database = Postgres>,-{- let count = sqlx::query!(- r#"- SELECT COUNT(id) as count FROM comms_messages- WHERE channel_id = $1- "#,- channel_id- )- .map(|row| row.count.unwrap_or(0))- .fetch_one(executor)- .await?;-- Ok(count)-}diff --git a/rust/cloud-storage/comms_db_client/src/messages/get_count/test.rs b/rust/cloud-storage/comms_db_client/src/messages/get_count/test.rsdeleted file mode 100644index ff877abc3c..0000000000--- a/rust/cloud-storage/comms_db_client/src/messages/get_count/test.rs+++ /dev/null@@ -1,106 +0,0 @@-use super::*;-use macro_db_migrator::MACRO_DB_MIGRATIONS;-use sqlx::PgPool;--const _: &sqlx::migrate::Migrator = &MACRO_DB_MIGRATIONS; // Dummy reference for IDE--async fn insert_channel(pool: &PgPool, channel_id: Uuid) {- sqlx::query!(- r#"- INSERT INTO comms_channels (id, name, channel_type, org_id, owner_id)- VALUES ($1, 'test', 'public', NULL, 'owner')- "#,- channel_id- )- .execute(pool)- .await- .unwrap();-}--async fn insert_message(pool: &PgPool, channel_id: Uuid, deleted: bool, thread_id: Option<Uuid>) {- sqlx::query!(- r#"- INSERT INTO comms_messages- (id, channel_id, sender_id, content, thread_id, deleted_at)- VALUES- ($1, $2, 'sender', 'content', $3,- CASE WHEN $4 THEN NOW() ELSE NULL END)- "#,- macro_uuid::generate_uuid_v7(),- channel_id,- thread_id,- deleted- )- .execute(pool)- .await- .unwrap();-}--#[sqlx::test(migrator = "MACRO_DB_MIGRATIONS")]-async fn returns_zero_for_empty_channel(pool: PgPool) -> anyhow::Result<()> {- let channel_id = Uuid::new_v4();- insert_channel(&pool, channel_id).await;-- let count = get_channel_message_count(&pool, &channel_id).await?;- assert_eq!(count, 0);- Ok(())-}--#[sqlx::test(migrator = "MACRO_DB_MIGRATIONS")]-async fn returns_one_for_single_message(pool: PgPool) -> anyhow::Result<()> {- let channel_id = Uuid::new_v4();- insert_channel(&pool, channel_id).await;- insert_message(&pool, channel_id, false, None).await;-- let count = get_channel_message_count(&pool, &channel_id).await?;- assert_eq!(count, 1);- Ok(())-}--#[sqlx::test(migrator = "MACRO_DB_MIGRATIONS")]-async fn returns_full_count_not_capped_at_one(pool: PgPool) -> anyhow::Result<()> {- let channel_id = Uuid::new_v4();- insert_channel(&pool, channel_id).await;- for _ in 0..5 {- insert_message(&pool, channel_id, false, None).await;- }-- let count = get_channel_message_count(&pool, &channel_id).await?;- assert_eq!(- count, 5,- "function should return the real row count, not a 0/1 flag"- );- Ok(())-}--#[sqlx::test(migrator = "MACRO_DB_MIGRATIONS")]-async fn includes_deleted_messages(pool: PgPool) -> anyhow::Result<()> {- let channel_id = Uuid::new_v4();- insert_channel(&pool, channel_id).await;- insert_message(&pool, channel_id, false, None).await;- insert_message(&pool, channel_id, true, None).await;- insert_message(&pool, channel_id, true, None).await;-- let count = get_channel_message_count(&pool, &channel_id).await?;- assert_eq!(- count, 3,- "soft-deleted messages are still counted by the underlying query"- );- Ok(())-}--#[sqlx::test(migrator = "MACRO_DB_MIGRATIONS")]-async fn only_counts_matching_channel(pool: PgPool) -> anyhow::Result<()> {- let channel_a = Uuid::new_v4();- let channel_b = Uuid::new_v4();- insert_channel(&pool, channel_a).await;- insert_channel(&pool, channel_b).await;-- insert_message(&pool, channel_a, false, None).await;- insert_message(&pool, channel_a, false, None).await;- insert_message(&pool, channel_b, false, None).await;-- assert_eq!(get_channel_message_count(&pool, &channel_a).await?, 2);- assert_eq!(get_channel_message_count(&pool, &channel_b).await?, 1);- Ok(())-}diff --git a/rust/cloud-storage/comms_db_client/src/messages/get_message_owner.rs b/rust/cloud-storage/comms_db_client/src/messages/get_message_owner.rsdeleted file mode 100644index 70eaf33977..0000000000--- a/rust/cloud-storage/comms_db_client/src/messages/get_message_owner.rs+++ /dev/null@@ -1,29 +0,0 @@-use anyhow::{Context, Result};-use serde::{Deserialize, Serialize};-use sqlx::{Pool, Postgres};-use uuid::Uuid;--#[derive(Debug, Clone, Serialize, Deserialize)]-pub struct MessageOwner {- pub sender_id: String,-}--#[tracing::instrument(skip(db))]-pub async fn get_message_owner(db: &Pool<Postgres>, message_id: &Uuid) -> Result<String> {- let message = sqlx::query_as!(- MessageOwner,- r#"- SELECT- sender_id- FROM comms_messages- WHERE id = $1- ORDER BY created_at ASC- "#,- message_id- )- .fetch_one(db)- .await- .context("unable to get messages")?;-- Ok(message.sender_id)-}diff --git a/rust/cloud-storage/comms_db_client/src/messages/mod.rs b/rust/cloud-storage/comms_db_client/src/messages/mod.rsindex cbe1893b34..06b8c6348c 100644--- a/rust/cloud-storage/comms_db_client/src/messages/mod.rs+++ b/rust/cloud-storage/comms_db_client/src/messages/mod.rs@@ -1,12 +1,6 @@-pub mod add_attachments;pub mod create_message;pub mod create_message_mentions;-pub mod delete_message;pub mod get_channel_message;-pub mod get_count;pub mod get_deleted_ats;-pub mod get_message_owner;pub mod get_messages;-pub mod patch_message;-pub mod read_message_with_context;pub mod seed_message;diff --git a/rust/cloud-storage/comms_db_client/src/messages/patch_message.rs b/rust/cloud-storage/comms_db_client/src/messages/patch_message.rsdeleted file mode 100644index 88b3b7c2c2..0000000000--- a/rust/cloud-storage/comms_db_client/src/messages/patch_message.rs+++ /dev/null@@ -1,106 +0,0 @@-use crate::model::{Attachment, Message};--use anyhow::{Context, Result};-use macro_user_id::{cowlike::CowLike, user_id::MacroUserIdStr};-use sqlx::{Pool, Postgres};-use uuid::Uuid;--#[tracing::instrument(skip(db))]-pub async fn patch_message(- db: &Pool<Postgres>,- message_id: Uuid,- content: &str,-) -> Result<Message> {- let message = sqlx::query!(- r#"- UPDATE comms_messages- SET content = $1, updated_at = NOW(), edited_at = NOW()- WHERE id = $2- RETURNING- id,- channel_id,- sender_id,- content,- created_at,- updated_at,- thread_id,- edited_at as "edited_at: chrono::DateTime<chrono::Utc>",- deleted_at as "deleted_at: chrono::DateTime<chrono::Utc>"- "#,- content,- message_id- )- .try_map(|row| {- Ok(Message {- id: row.id,- channel_id: row.channel_id,- thread_id: row.thread_id,- sender_id: MacroUserIdStr::parse_from_str(&row.sender_id)- .map_err(|e| sqlx::Error::Decode(Box::new(e)))?- .into_owned(),- content: row.content,- created_at: row.created_at,- updated_at: row.updated_at,- edited_at: row.edited_at,- deleted_at: row.deleted_at,- })- })- .fetch_one(db)- .await- .context("unable to update message")?;-- Ok(message)-}--#[tracing::instrument(skip(db))]-pub async fn patch_message_attachments(- db: &Pool<Postgres>,- message_id: Uuid,- attachments: Vec<Attachment>,-) -> Result<Message> {- let has_attachments = !attachments.is_empty();- let message = sqlx::query!(- r#"- UPDATE comms_messages- SET- updated_at = NOW(),- edited_at = NOW(),- deleted_at = CASE- WHEN $2 = false AND (content IS NULL OR content ~ '^[\s]*$') THEN NOW()- ELSE deleted_at- END- WHERE id = $1- RETURNING- id,- channel_id,- sender_id,- content,- created_at,- updated_at,- thread_id,- edited_at as "edited_at: chrono::DateTime<chrono::Utc>",- deleted_at as "deleted_at: chrono::DateTime<chrono::Utc>"- "#,- message_id,- has_attachments- )- .try_map(|row| {- Ok(Message {- id: row.id,- channel_id: row.channel_id,- thread_id: row.thread_id,- sender_id: MacroUserIdStr::parse_from_str(&row.sender_id)- .map_err(|e| sqlx::Error::Decode(Box::new(e)))?- .into_owned(),- content: row.content,- created_at: row.created_at,- updated_at: row.updated_at,- edited_at: row.edited_at,- deleted_at: row.deleted_at,- })- })- .fetch_one(db)- .await- .context("unable to update message")?;- Ok(message)-}diff --git a/rust/cloud-storage/comms_db_client/src/messages/read_message_with_context.rs b/rust/cloud-storage/comms_db_client/src/messages/read_message_with_context.rsdeleted file mode 100644index 7abe9ef134..0000000000--- a/rust/cloud-storage/comms_db_client/src/messages/read_message_with_context.rs+++ /dev/null@@ -1,205 +0,0 @@-use crate::model::Message;-use anyhow::{Context, Result};-use macro_user_id::{cowlike::CowLike, user_id::MacroUserIdStr};-use sqlx::{Pool, Postgres};-use uuid::Uuid;--/// get all the messages around a message (before/after in same channel), including current-#[tracing::instrument(skip(db))]-pub async fn get_messages_with_context(- db: &Pool<Postgres>,- message_id: &Uuid,- before: i64,- after: i64,-) -> Result<Vec<Message>> {- let msg = sqlx::query!(- r#"- SELECT- id,- channel_id,- sender_id,- content,- created_at,- updated_at,- thread_id,- edited_at as "edited_at: chrono::DateTime<chrono::Utc>",- deleted_at as "deleted_at: chrono::DateTime<chrono::Utc>"- FROM comms_messages- WHERE id = $1;- "#,- message_id- )- .try_map(|row| {- Ok(Message {- id: row.id,- channel_id: row.channel_id,- thread_id: row.thread_id,- sender_id: MacroUserIdStr::parse_from_str(&row.sender_id)- .map_err(|e| sqlx::Error::Decode(Box::new(e)))?- .into_owned(),- content: row.content,- created_at: row.created_at,- updated_at: row.updated_at,- edited_at: row.edited_at,- deleted_at: row.deleted_at,- })- })- .fetch_one(db)- .await;-- if let &Err(sqlx::Error::RowNotFound) = &msg {- return Ok(vec![]);- }-- let msg = msg.context("fetch message")?;-- let mut before = sqlx::query!(- r#"- SELECT- id,- channel_id,- sender_id,- content,- created_at,- updated_at,- thread_id,- edited_at as "edited_at: chrono::DateTime<chrono::Utc>",- deleted_at as "deleted_at: chrono::DateTime<chrono::Utc>"- FROM comms_messages- WHERE channel_id = (SELECT channel_id FROM comms_messages WHERE id=$1)- AND- created_at < (SELECT created_at FROM comms_messages WHERE id=$1)- ORDER BY created_at DESC- LIMIT $2- "#,- message_id,- before- )- .try_map(|row| {- Ok(Message {- id: row.id,- channel_id: row.channel_id,- thread_id: row.thread_id,- sender_id: MacroUserIdStr::parse_from_str(&row.sender_id)- .map_err(|e| sqlx::Error::Decode(Box::new(e)))?- .into_owned(),- content: row.content,- created_at: row.created_at,- updated_at: row.updated_at,- edited_at: row.edited_at,- deleted_at: row.deleted_at,- })- })- .fetch_all(db)- .await- .context("fetch message before")?- .into_iter()- .rev()- .collect::<Vec<_>>();-- let mut after = sqlx::query!(- r#"- SELECT- id,- channel_id,- sender_id,- content,- created_at,- updated_at,- thread_id,- edited_at as "edited_at: chrono::DateTime<chrono::Utc>",- deleted_at as "deleted_at: chrono::DateTime<chrono::Utc>"- FROM comms_messages- WHERE channel_id = (SELECT channel_id FROM comms_messages WHERE id=$1)- AND- created_at > (SELECT created_at FROM comms_messages WHERE id=$1)- ORDER BY created_at ASC- LIMIT $2- "#,- message_id,- after- )- .try_map(|row| {- Ok(Message {- id: row.id,- channel_id: row.channel_id,- thread_id: row.thread_id,- sender_id: MacroUserIdStr::parse_from_str(&row.sender_id)- .map_err(|e| sqlx::Error::Decode(Box::new(e)))?- .into_owned(),- content: row.content,- created_at: row.created_at,- updated_at: row.updated_at,- edited_at: row.edited_at,- deleted_at: row.deleted_at,- })- })- .fetch_all(db)- .await- .context("fetch message after")?;-- let mut all = Vec::new();- all.append(&mut before);- all.push(msg);- all.append(&mut after);- Ok(all)-}--#[cfg(test)]-mod test {- use super::*;- use macro_db_migrator::MACRO_DB_MIGRATIONS;- use sqlx::{Pool, Postgres};-- #[sqlx::test(- migrator = "MACRO_DB_MIGRATIONS",- fixtures(path = "../../fixtures", scripts("messages_with_context"))- )]- async fn test_get_single_message_only(pool: Pool<Postgres>) {- const _: &sqlx::migrate::Migrator = &MACRO_DB_MIGRATIONS; // Dummy reference for IDE- let message_id = uuid::uuid!("bbbbbbbb-0000-0000-0000-000000000005");-- let messages = get_messages_with_context(&pool, &message_id, 0, 0)- .await- .unwrap();-- assert_eq!(messages.len(), 1);- assert_eq!(messages[0].id, message_id);- assert_eq!(messages[0].content, "Message 5");- }-- #[sqlx::test(- migrator = "MACRO_DB_MIGRATIONS",- fixtures(path = "../../fixtures", scripts("messages_with_context"))- )]- async fn test_get_messages_with_before_and_after(pool: Pool<Postgres>) {- let message_id = uuid::uuid!("bbbbbbbb-0000-0000-0000-000000000005");-- let messages = get_messages_with_context(&pool, &message_id, 2, 3)- .await- .unwrap();-- // Should return: message 3, 4, 5, 6, 7, 8 (2 before, target, 3 after)- assert_eq!(messages.len(), 6);-- // Verify order is chronological- assert_eq!(messages[0].content, "Message 3");- assert_eq!(messages[1].content, "Message 4");- assert_eq!(messages[2].content, "Message 5"); // Target message- assert_eq!(messages[3].content, "Message 6");- assert_eq!(messages[4].content, "Message 7");- assert_eq!(messages[5].content, "Message 8");- }-- #[sqlx::test(- migrator = "MACRO_DB_MIGRATIONS",- fixtures(path = "../../fixtures", scripts("messages_with_context"))- )]- async fn test_get_messages_nonexistent_message(pool: Pool<Postgres>) {- let message_id = uuid::uuid!("99999999-9999-9999-9999-999999999999");-- let result = get_messages_with_context(&pool, &message_id, 2, 3).await;- assert!(result.is_ok());- assert!(result.unwrap().is_empty());- }-}diff --git a/rust/cloud-storage/comms_db_client/src/preview/mod.rs b/rust/cloud-storage/comms_db_client/src/preview/mod.rsdeleted file mode 100644index 174faef972..0000000000--- a/rust/cloud-storage/comms_db_client/src/preview/mod.rs+++ /dev/null@@ -1,202 +0,0 @@-use crate::participants::get_participants::get_participants;-use anyhow::{Context, Result};-use doppleganger::Mirror;-use model::comms::{ChannelParticipant, ChannelType};-use sqlx::{Pool, Postgres};-use uuid::Uuid;--#[derive(Clone, serde::Serialize, serde::Deserialize, sqlx::FromRow, Debug)]-pub struct RawPreviewRecord {- pub channel_id: Uuid,- pub channel_name: Option<String>,- pub channel_type: ChannelType,- pub has_access: bool,- pub participants: Vec<ChannelParticipant>,-}--#[derive(Clone, serde::Serialize, serde::Deserialize, sqlx::FromRow, Debug)]-pub struct Previews {- pub exists: Vec<RawPreviewRecord>,- pub remaining: Vec<String>,-}--#[tracing::instrument(skip(db))]-pub async fn batch_get_channel_preview(- db: &Pool<Postgres>,- channel_ids: &Vec<String>,- user_id: &str,- org_id: Option<i64>,-) -> Result<Previews> {- let preview_data = sqlx::query!(- r#"- SELECT- c.id as channel_id,- c.name as channel_name,- c.channel_type as "channel_type: ChannelType",- (- SELECT COUNT(*)- FROM comms_channel_participants cp_count- WHERE cp_count.channel_id = c.id- AND cp_count.left_at IS NULL- ) as "participants!: i32",- CASE WHEN (- c.channel_type = 'public'- OR- (c.channel_type = 'organization' AND $3::bigint IS NOT NULL AND c.org_id = $3)- OR- (c.channel_type IN ('private', 'direct_message', 'team') AND EXISTS (- SELECT 1 FROM comms_channel_participants cp- WHERE cp.channel_id = c.id- AND cp.user_id = $2- AND cp.left_at IS NULL- ))- ) THEN true ELSE false END as "has_access!: bool"- FROM- comms_channels c- WHERE- c.id::text = ANY($1)- AND (c.channel_type != 'organization' OR $3::bigint IS NOT NULL)- GROUP BY- c.id,- c.name,- c.channel_type,- c.org_id- "#,- channel_ids,- user_id,- org_id as Option<i64>- )- .fetch_all(db)- .await- .context("unable to get channels")?;-- let mut previews: Vec<RawPreviewRecord> = vec![];-- for row in preview_data {- let participants = get_participants(db, &row.channel_id)- .await?- .into_iter()- .map(model::comms::ChannelParticipant::mirror)- .collect();-- previews.push(RawPreviewRecord {- channel_id: row.channel_id,- channel_name: row.channel_name.to_owned(),- channel_type: row.channel_type,- has_access: row.has_access,- participants,- });- }-- let previews_ids = previews- .iter()- .map(|p| p.channel_id.to_string())- .collect::<Vec<String>>();-- let remaining = channel_ids- .iter()- .filter(|id| !previews_ids.contains(id))- .map(|id| id.to_owned())- .collect();-- let result = Previews {- exists: previews,- remaining,- };-- Ok(result)-}--#[cfg(test)]-mod tests {- use std::str::FromStr;-- use super::*;- use macro_db_migrator::MACRO_DB_MIGRATIONS;- use sqlx::{Pool, Postgres};- use uuid::Uuid;-- #[sqlx::test(- migrator = "MACRO_DB_MIGRATIONS",- fixtures(path = "../../fixtures", scripts("channels"))- )]- async fn test_preview_for_private_channel(pool: Pool<Postgres>) -> anyhow::Result<()> {- const _: &sqlx::migrate::Migrator = &MACRO_DB_MIGRATIONS; // Dummy reference for IDE- let ids = vec!["11111111-1111-1111-1111-111111111111".to_string()];- let previews = batch_get_channel_preview(&pool, &ids, "macro|[email protected]", None).await?;- assert_eq!(previews.exists.len(), 1);- assert_eq!(- previews.exists[0].channel_id,- Uuid::from_str("11111111-1111-1111-1111-111111111111")?- );- assert_eq!(- previews.exists[0].channel_name,- Some("private 1 ".to_string())- );- assert_eq!(previews.exists[0].channel_type, ChannelType::Private);- assert!(previews.exists[0].has_access);- assert_eq!(previews.exists[0].participants.len(), 3);-- dbg!(&previews);-- Ok(())- }-- #[sqlx::test(- migrator = "MACRO_DB_MIGRATIONS",- fixtures(path = "../../fixtures", scripts("channels"))- )]- async fn test_access_dm(pool: Pool<Postgres>) -> anyhow::Result<()> {- let ids = vec!["22222222-2222-2222-2222-222222222222".to_string()];- let previews = batch_get_channel_preview(&pool, &ids, "macro|[email protected]", None).await?;- assert_eq!(previews.exists.len(), 1);- assert!(- previews.exists[0].has_access,- "user 1 should have access to this channel"- );- Ok(())- }-- #[sqlx::test(- migrator = "MACRO_DB_MIGRATIONS",- fixtures(path = "../../fixtures", scripts("channels"))- )]- async fn test_no_access_dm(pool: Pool<Postgres>) -> anyhow::Result<()> {- let ids = vec!["22222222-2222-2222-2222-222222222222".to_string()];- let previews = batch_get_channel_preview(&pool, &ids, "macro|[email protected]", None).await?;- assert_eq!(previews.exists.len(), 1);- assert!(- !previews.exists[0].has_access,- "user should not have access to this channel"- );- Ok(())- }-- #[sqlx::test(- migrator = "MACRO_DB_MIGRATIONS",- fixtures(path = "../../fixtures", scripts("channels"))- )]- async fn test_does_not_exist(pool: Pool<Postgres>) -> anyhow::Result<()> {- let ids = vec!["44444444-4444-4444-4444-444444444444".to_string()];- let previews = batch_get_channel_preview(&pool, &ids, "macro|[email protected]", None).await?;- assert_eq!(previews.exists.len(), 0);- assert_eq!(previews.remaining.len(), 1);- Ok(())- }-- #[sqlx::test(- migrator = "MACRO_DB_MIGRATIONS",- fixtures(path = "../../fixtures", scripts("channels"))- )]- async fn test_no_access_private(pool: Pool<Postgres>) -> anyhow::Result<()> {- let ids = vec!["11111111-1111-1111-1111-111111111111".to_string()];- let previews = batch_get_channel_preview(&pool, &ids, "macro|[email protected]", None).await?;- assert_eq!(previews.exists.len(), 1);- assert!(- !previews.exists[0].has_access,- "user 4 should not have access to this channel"- );-- Ok(())- }-}diff --git a/rust/cloud-storage/comms_db_client/src/reactions/add_reaction.rs b/rust/cloud-storage/comms_db_client/src/reactions/add_reaction.rsdeleted file mode 100644index a8cecee501..0000000000--- a/rust/cloud-storage/comms_db_client/src/reactions/add_reaction.rs+++ /dev/null@@ -1,27 +0,0 @@-use anyhow::{Context, Result};-use sqlx::{Pool, Postgres};-use uuid::Uuid;--#[tracing::instrument(skip(db))]-pub async fn add_reaction(- db: &Pool<Postgres>,- message_id: Uuid,- emoji: String,- user_id: String,-) -> Result<()> {- sqlx::query!(- r#"- INSERT INTO comms_reactions (message_id, emoji, user_id)- VALUES ($1, $2, $3)- ON CONFLICT DO NOTHING- "#,- message_id,- emoji,- user_id,- )- .execute(db)- .await- .context("failed to add reaction")?;-- Ok(())-}diff --git a/rust/cloud-storage/comms_db_client/src/reactions/get_reactions.rs b/rust/cloud-storage/comms_db_client/src/reactions/get_reactions.rsdeleted file mode 100644index 983af0df53..0000000000--- a/rust/cloud-storage/comms_db_client/src/reactions/get_reactions.rs+++ /dev/null@@ -1,36 +0,0 @@-use anyhow::{Context, Result};-use sqlx::{Pool, Postgres};-use uuid::Uuid;--use crate::model::Reaction;--#[tracing::instrument(skip(db))]-pub async fn get_message_reactions(db: &Pool<Postgres>, message_id: Uuid) -> Result<Vec<Reaction>> {- let reactions = sqlx::query_as!(- Reaction,- "SELECT * FROM comms_reactions WHERE message_id = $1",- message_id- )- .fetch_all(db)- .await- .context("unable to fetch reactions")?;-- Ok(reactions)-}--#[tracing::instrument(skip(db))]-pub async fn get_messages_reactions(- db: &Pool<Postgres>,- message_ids: Vec<Uuid>,-) -> Result<Vec<Reaction>> {- let reactions = sqlx::query_as!(- Reaction,- "SELECT * FROM comms_reactions WHERE message_id = ANY($1)",- &message_ids- )- .fetch_all(db)- .await- .context("unable to fetch reactions")?;-- Ok(reactions)-}diff --git a/rust/cloud-storage/comms_db_client/src/reactions/mod.rs b/rust/cloud-storage/comms_db_client/src/reactions/mod.rsdeleted file mode 100644index e307fe6af0..0000000000--- a/rust/cloud-storage/comms_db_client/src/reactions/mod.rs+++ /dev/null@@ -1,79 +0,0 @@-use crate::model::{CountedReaction, Reaction};-use std::collections::HashMap;-pub mod add_reaction;-pub mod get_reactions;-pub mod remove_reaction;--/// Groups the reactions for a single message into a vec of CountedMessages-pub fn group_reactions(reactions: Vec<Reaction>) -> Vec<CountedReaction> {- let mut emoji_groups: HashMap<String, (Vec<String>, chrono::DateTime<chrono::Utc>)> =- HashMap::new();-- for reaction in reactions {- emoji_groups- .entry(reaction.emoji)- .and_modify(|(users, earliest_time)| {- users.push(reaction.user_id.clone());- *earliest_time = std::cmp::min(*earliest_time, reaction.created_at);- })- .or_insert_with(|| (vec![reaction.user_id], reaction.created_at));- }-- let mut counted_reactions: Vec<_> = emoji_groups- .into_iter()- .map(|(emoji, (users, time))| (CountedReaction { emoji, users }, time))- .collect();-- counted_reactions.sort_by_key(|(_, time)| *time);-- counted_reactions- .into_iter()- .map(|(reaction, _)| reaction)- .collect()-}--/// Groups the reactions for multiple messages into a vec of CountedMessages-pub fn group_reactions_by_message(- reactions: Vec<Reaction>,-) -> HashMap<String, Vec<CountedReaction>> {- #[expect(- clippy::type_complexity,- reason = "no good reason too annoying to fix right now"- )]- let mut message_groups: HashMap<- String,- HashMap<String, (Vec<String>, chrono::DateTime<chrono::Utc>)>,- > = HashMap::new();-- for reaction in reactions {- let message_id = reaction.message_id.to_string();- let emoji_groups = message_groups.entry(message_id).or_default();-- emoji_groups- .entry(reaction.emoji)- .and_modify(|(users, earliest_time)| {- users.push(reaction.user_id.clone());- *earliest_time = std::cmp::min(*earliest_time, reaction.created_at);- })- .or_insert_with(|| (vec![reaction.user_id], reaction.created_at));- }-- message_groups- .into_iter()- .map(|(message_id, emoji_groups)| {- let mut reactions_with_time: Vec<_> = emoji_groups- .into_iter()- .map(|(emoji, (users, time))| (CountedReaction { emoji, users }, time))- .collect();-- reactions_with_time.sort_by_key(|(_, time)| *time);-- let counted_reactions = reactions_with_time- .into_iter()- .map(|(reaction, _)| reaction)- .collect();-- (message_id, counted_reactions)- })- .collect()-}diff --git a/rust/cloud-storage/comms_db_client/src/reactions/remove_reaction.rs b/rust/cloud-storage/comms_db_client/src/reactions/remove_reaction.rsdeleted file mode 100644index 85ffe35830..0000000000--- a/rust/cloud-storage/comms_db_client/src/reactions/remove_reaction.rs+++ /dev/null@@ -1,26 +0,0 @@-use anyhow::{Context, Result};-use sqlx::{Pool, Postgres};-use uuid::Uuid;--#[tracing::instrument(skip(db))]-pub async fn remove_reaction(- db: &Pool<Postgres>,- message_id: Uuid,- emoji: String,- user_id: String,-) -> Result<()> {- sqlx::query!(- r#"- DELETE FROM comms_reactions- WHERE message_id = $1 AND emoji = $2 AND user_id = $3- "#,- message_id,- emoji,- user_id,- )- .execute(db)- .await- .context("failed to remove reaction")?;-- Ok(())-}diff --git a/rust/cloud-storage/comms_service/Cargo.toml b/rust/cloud-storage/comms_service/Cargo.tomldeleted file mode 100644index 0f8e42a6cf..0000000000--- a/rust/cloud-storage/comms_service/Cargo.toml+++ /dev/null@@ -1,81 +0,0 @@-[package]-edition = "2024"-name = "comms_service"-publish = false-version = "0.1.0"--[lib]-name = "comms_service"-path = "src/lib.rs"--[[bin]]-name = "comms_service_openapi"-path = "src/openapi.rs"--[features]-channel_search = []-default = ["channel_search", "service"]-local_auth = []-service = ["comms_db_client"]--[dependencies]-anyhow = { workspace = true }-async-trait = { workspace = true }-aws-sdk-secretsmanager = { workspace = true }-aws-sdk-sqs = { workspace = true }-axum = { workspace = true, features = ["tower-log", "ws"] }-axum-extra = { workspace = true }-axum-macros = { workspace = true }-chrono = { workspace = true }-comms = { path = "../comms", features = ["inbound", "outbound"] }-comms_db_client = { path = "../comms_db_client", optional = true }-connection_gateway_client = { path = "../connection_gateway_client" }-doppleganger = { workspace = true }-entity_access = { path = "../entity_access" }-entity_access_db_utils = { path = "../entity_access_db_utils" }-frecency = { path = "../frecency", features = ["postgres"] }-futures = { workspace = true }-http-body-util = { workspace = true }-jsonwebtoken.workspace = true-last_online_tracker = { path = "../last_online_tracker" }-macro_auth = { path = "../macro_auth" }-macro_db_client = { path = "../macro_db_client" }-macro_env = { path = "../macro_env" }-macro_env_var = { path = "../macro_env_var" }-macro_middleware = { path = "../macro_middleware", default-features = false, features = [- "auth",- "cloud_storage",-] }-macro_user_id = { path = "../macro_user_id" }-macro_uuid = { path = "../macro_uuid" }-model = { path = "../model" }-model-entity = { path = "../model-entity" }-model_notifications = { path = "../model_notifications" }-models_comms = { path = "../models_comms" }-models_opensearch = { path = "../models_opensearch" }-models_permissions = { path = "../models_permissions" }-notification_hex = { path = "../notification", package = "notification" }-reqwest.workspace = true-secretsmanager_client = { path = "../secretsmanager_client" }-serde = { workspace = true }-serde_json = { workspace = true }-sqlx = { workspace = true }-sqs_client = { path = "../sqs_client", default-features = false, features = [- "search",-] }-contacts = { path = "../contacts" }-thiserror = { workspace = true }-tokio = { workspace = true }-tower = { workspace = true }-tower-http = { workspace = true }-tracing = { workspace = true }-utoipa = { workspace = true, features = ["axum_extras", "chrono", "uuid"] }-utoipa-swagger-ui = { workspace = true, features = ["axum"] }-uuid = { workspace = true }--[dev-dependencies]-rootcause = { workspace = true }-tokio = { workspace = true, features = ["macros"] }--[package.metadata.cargo-machete]-ignored = ["connection_gateway"]diff --git a/rust/cloud-storage/comms_service/README.md b/rust/cloud-storage/comms_service/README.mddeleted file mode 100644index 1ddeca0c5a..0000000000--- a/rust/cloud-storage/comms_service/README.md+++ /dev/null@@ -1,65 +0,0 @@-# Comms (Communication) Service--# Overview-Restful api for dealing with channels & messages, stores information in comms db using the [comms_db_client](../comms_db_client).--## Building & Running Locally--Ussually it is sufficient to build with the `SQLX_OFFLINE=true` flag.-```bash-SQLX_OFFLINE=true cargo build-```--``` bash-cargo run --features local_auth-```--`local_auth` feature will automatically inject a valid jwt token into the request header.-To set the user_id you can set the `LOCAL_USER_ID` environemnt variable.---## Interactions With `connection_gateway`-Comms Service uses the `connection_gateway` to send channel / message updates to to the client.--Things like:-- sending a message to a channel-- reacting to a message-- editing a message-- deleting a message--are all events that are broadcasted to the client by the comms service through the `connection_gateway`.--In most cases the recipients are the participants of the channel.--Most push operations to the comms service are done via http, vs updates happen via the connection gateway websocket connection.-HTTP requests provide more reliable delivery and tracking of the request.---### Running With `connection_gateway` Locally--By default the `.env.sample` file points to the `connection_gateway` in dev.--To run this with the `connection_gateway` locally, you should follow the instructions in [connection_gateway](../connection_gateway);--NOTE: ensure your `INTERNAL_API_SECRET_KEY` defined in this `.env` and the one in the `connection_gateway` match up.--## Interactions with `comms_db_client`--It's recommended to just use the `DATABASE_URL` pointing to the dev instance of `comms` which is the name of the comms database.--If required, you can just point to a local instance of comms.--Please see the [comms_db_client](../comms_db_client) for more details.--# Technical Documentation--## Creating Channels--`POST /channels`: is the most extensible endpoint for creating channels.--`POST /channels/get_or_create_dm {recipient}`:-For `direct_message` channels, there is a `get_or_create_dm` endpoint.-This is useful because ideally there should only be one direct message channel for each permutaton of two users.--`POST /channels/get_or_create_private {recipients: []}`:-Similarly for `private` channels, there is a `get_or_create_private` endpoint.diff --git a/rust/cloud-storage/comms_service/justfile b/rust/cloud-storage/comms_service/justfiledeleted file mode 100644index 5a2f3c6cc5..0000000000--- a/rust/cloud-storage/comms_service/justfile+++ /dev/null@@ -1,21 +0,0 @@-set dotenv-load := true--mod ci '../ci.just'--deploy-dev:- just ci::deploy-dev comms-service--run:- cargo run--build:- SQLX_OFFLINE=true cargo build--check:- SQLX_OFFLINE=true cargo check--clippy:- SQLX_OFFLINE=true cargo clippy--run-local:- cargo run --features macro_middleware/local_authdiff --git a/rust/cloud-storage/comms_service/src/api/activity/mod.rs b/rust/cloud-storage/comms_service/src/api/activity/mod.rsdeleted file mode 100644index 98719af1f4..0000000000--- a/rust/cloud-storage/comms_service/src/api/activity/mod.rs+++ /dev/null@@ -1 +0,0 @@-pub mod post_activity;diff --git a/rust/cloud-storage/comms_service/src/api/activity/post_activity.rs b/rust/cloud-storage/comms_service/src/api/activity/post_activity.rsdeleted file mode 100644index 54934191e3..0000000000--- a/rust/cloud-storage/comms_service/src/api/activity/post_activity.rs+++ /dev/null@@ -1,52 +0,0 @@-use anyhow::Result;-use axum::extract::Json;-use axum::{Extension, extract::State};-use comms_db_client::{- activity::upsert_activity::upsert_activity,- model::{Activity, ActivityType},-};-use model::user::UserContext;-use reqwest::StatusCode;-use serde::{Deserialize, Serialize};-use sqlx::PgPool;-use utoipa::ToSchema;-use uuid::Uuid;--#[derive(Debug, Serialize, Deserialize, ToSchema)]-pub struct PostActivityRequest {- pub channel_id: String,- pub activity_type: ActivityType,-}--#[tracing::instrument(skip(db, user_context), fields(user_id = user_context.user_id))]-#[utoipa::path(- post,- tag = "activity",- operation_id = "post_activity",- path = "/comms/activity",- responses(- (status = 200, body=Activity),- (status = 401, body=String),- (status = 404, body=String),- (status = 500, body=String),- )- )]-pub async fn post_activity_handler(- State(db): State<PgPool>,- user_context: Extension<UserContext>,- req: Json<PostActivityRequest>,-) -> Result<(StatusCode, Json<Activity>), (StatusCode, String)> {- let channel_id = Uuid::parse_str(&req.channel_id).map_err(|err| {- tracing::error!("unable to parse channel id: {:?}", err);- (StatusCode::BAD_REQUEST, err.to_string())- })?;-- let activity = upsert_activity(&db, &user_context.user_id, &channel_id, &req.activity_type)- .await- .map_err(|err| {- tracing::error!("unable to upsert activity: {:?}", err);- (StatusCode::INTERNAL_SERVER_ERROR, err.to_string())- })?;-- Ok((StatusCode::OK, Json(activity)))-}diff --git a/rust/cloud-storage/comms_service/src/api/attachments/mod.rs b/rust/cloud-storage/comms_service/src/api/attachments/mod.rsdeleted file mode 100644index f7a0ee2034..0000000000--- a/rust/cloud-storage/comms_service/src/api/attachments/mod.rs+++ /dev/null@@ -1,11 +0,0 @@-use axum::{Router, routing::get};--use crate::api::context::AppState;-pub mod references;--pub fn router() -> Router<AppState> {- Router::new().route(- "/{entity_type}/{entity_id}/references",- get(references::handler),- )-}diff --git a/rust/cloud-storage/comms_service/src/api/attachments/references.rs b/rust/cloud-storage/comms_service/src/api/attachments/references.rsdeleted file mode 100644index ec9952a393..0000000000--- a/rust/cloud-storage/comms_service/src/api/attachments/references.rs+++ /dev/null@@ -1,53 +0,0 @@-use axum::Extension;-use axum::extract::{Json, Path, State};-use axum::http::StatusCode;-use comms_db_client::attachments::get_attachment_references::{- EntityReference, get_attachment_references,-};-use model::user::UserContext;--use crate::api::context::AppState;--#[derive(Debug, serde::Serialize, serde::Deserialize, utoipa::ToSchema)]-pub struct GetAttachmentReferencesResponse {- references: Vec<EntityReference>,-}--#[utoipa::path(- get,- path = "/comms/attachments/{entity_type}/{entity_id}/references",- tag = "attachments",- operation_id = "get_attachment_references",- params(- ("entity_type" = String, Path, description = "type of the attachment entity"),- ("entity_id" = String, Path, description = "id of the attachment entity"),- ),- responses(- (status = 200, body=GetAttachmentReferencesResponse),- (status = 401, body=String),- (status = 404, body=String),- (status = 500, body=String),- )- )]-#[tracing::instrument(- skip(ctx, user_context),- fields(user_id=?user_context.user_id)-)]-pub async fn handler(- State(ctx): State<AppState>,- user_context: Extension<UserContext>,- Path((entity_type, entity_id)): Path<(String, String)>,-) -> Result<(StatusCode, Json<GetAttachmentReferencesResponse>), (StatusCode, String)> {- let references =- get_attachment_references(&ctx.db, &entity_type, &entity_id, &user_context.user_id)- .await- .map_err(|err| {- tracing::error!(error=?err, "unable to get attachment references");- (StatusCode::INTERNAL_SERVER_ERROR, err.to_string())- })?;-- Ok((- StatusCode::OK,- Json(GetAttachmentReferencesResponse { references }),- ))-}diff --git a/rust/cloud-storage/comms_service/src/api/channels/add_participants.rs b/rust/cloud-storage/comms_service/src/api/channels/add_participants.rsdeleted file mode 100644index fd1e1985b5..0000000000--- a/rust/cloud-storage/comms_service/src/api/channels/add_participants.rs+++ /dev/null@@ -1,161 +0,0 @@-use std::collections::HashSet;--use contacts::domain::ports::ContactsIngress;--use crate::api::channels::create_channel::to_lowercase;-use crate::api::context::{AppState, ChannelImpl};-use crate::api::extractors::{- ChannelId, ChannelMember, ChannelName, ChannelParticipants, ChannelTypeExtractor,-};-use crate::notification as comms_notification;-use anyhow::Result;-use axum::extract::Json;-use axum::{extract::State, http::StatusCode};-use axum_extra::extract::Cached;-use comms_db_client::participants::add_participant::{AddParticipantOptions, add_participant};-use doppleganger::Mirror;-use macro_user_id::cowlike::CowLike;-use macro_user_id::user_id::MacroUserIdStr;-use model_notifications::CommonChannelMetadata;-use models_comms::channel::ChannelType;-use serde::{Deserialize, Serialize};-use utoipa::ToSchema;--#[derive(Deserialize, Serialize, ToSchema, Debug)]-pub struct AddParticipantsRequest {- participants: Vec<String>,-}--#[utoipa::path(- post,- tag = "channels",- operation_id = "add_participants",- description = "adds a list of participants to the channel, user must be a participant",- path = "/comms/channels/{channel_id}/participants",- params(- ("channel_id" = String, Path, description = "channel id"),- ),- responses(- (status = 200),- (status = 401, body=String),- (status = 404, body=String),- (status = 500, body=String),- )-)]-#[tracing::instrument(skip(ctx, channel_participants))]-#[axum::debug_handler]-pub async fn handler(- State(ctx): State<AppState>,- Cached(ChannelMember(channel_member)): Cached<ChannelMember>,- Cached(ChannelName(channel_name, ..)): Cached<ChannelName<ChannelImpl>>,- Cached(ChannelTypeExtractor(channel_type)): Cached<ChannelTypeExtractor>,- Cached(ChannelParticipants(channel_participants)): Cached<ChannelParticipants>,- Cached(ChannelId(channel_id)): Cached<ChannelId>,- req: Json<AddParticipantsRequest>,-) -> Result<StatusCode, (StatusCode, String)> {- if let ChannelType::DirectMessage = channel_type {- tracing::error!("cannot add/remove participants from direct message channels");- return Err((- StatusCode::BAD_REQUEST,- "cannot add/remove participants from direct message channels".to_string(),- ));- }-- let invited_by_user_id = MacroUserIdStr::parse_from_str(&channel_member.context.user_id)- .map_err(|_e| (StatusCode::BAD_REQUEST, "Invalid macro user id".to_string()))?- .into_owned();-- let participants = to_lowercase(&req.participants);-- for participant in participants.iter() {- add_participant(- &ctx.db,- AddParticipantOptions {- channel_id: &channel_id,- user_id: participant.as_str(),- participant_role: Some(model::comms::ParticipantRole::Member),- },- )- .await- .map_err(|e| {- tracing::error!(error=?e, "unable to add participant to channel");- (- StatusCode::INTERNAL_SERVER_ERROR,- "unable to add participant to channel".to_string(),- )- })?;- }-- // There should always be participants, but better safe than sorry- let metadata = CommonChannelMetadata {- channel_type: model_notifications::ChannelType::mirror(channel_type),- channel_name: channel_name.clone(),- };-- let sender_profile_picture_url =- comms_notification::get_sender_profile_picture_url(&ctx.db, &invited_by_user_id).await;-- let parsed_recipients: Vec<_> = participants- .iter()- .filter_map(|id| MacroUserIdStr::parse_from_str(id).ok())- .collect();-- let parsed_ids: Vec<_> = parsed_recipients.iter().map(|u| u.0.clone()).collect();-- let existing_user_ids: std::collections::HashSet<String> =- macro_db_client::user::get_all::get_existing_users(&ctx.db, &parsed_ids)- .await- .inspect_err(|e| {- tracing::error!(error=?e, "unable to get existing users for invite");- })- .unwrap_or_default()- .into_iter()- .collect();-- comms_notification::dispatch_notifications_for_invite(- &*ctx.notification_ingress_service,- &channel_id,- &invited_by_user_id,- parsed_recipients,- existing_user_ids,- sender_profile_picture_url,- None,- metadata,- )- .await- .inspect_err(|e| {- tracing::error!(error=?e, "unable to send channel invite notification");- })- .ok();-- if matches!(channel_type, ChannelType::Private | ChannelType::Team)- && !channel_participants.is_empty()- {- // Contacts: add participants to social graph- let channel_participants: Vec<String> = channel_participants- .iter()- .map(|p| p.user_id.to_string())- .collect();- let contacts_users = [participants.clone(), channel_participants]- .concat()- .into_iter()- .map(MacroUserIdStr::try_from)- .collect::<Result<HashSet<_>, _>>()- .map_err(|e| {- tracing::error!(error=?e, "invalid user id for contacts");- (StatusCode::BAD_REQUEST, "invalid user id".to_string())- })?;- ctx.contacts_ingress- .enqueue_contacts(contacts_users)- .await- .map_err(|e| {- tracing::error!(error=?e, "unable to create 'add participant' SQS message");- (- StatusCode::INTERNAL_SERVER_ERROR,- "unable to create 'add participant' SQS message".to_string(),- )- })?;- }-- Ok(StatusCode::OK)-}diff --git a/rust/cloud-storage/comms_service/src/api/channels/create_channel.rs b/rust/cloud-storage/comms_service/src/api/channels/create_channel.rsdeleted file mode 100644index 927dca0dba..0000000000--- a/rust/cloud-storage/comms_service/src/api/channels/create_channel.rs+++ /dev/null@@ -1,174 +0,0 @@-use std::collections::HashSet;--use crate::api::context::AppState;-use anyhow::Result;-use axum::{- Json,- extract::{self, Extension, State},- http::StatusCode,-};-use comms_db_client::channels::create_channel::{CreateChannelOptions, create_channel};-use contacts::domain::ports::ContactsIngress;-use macro_user_id::user_id::MacroUserIdStr;-use model::comms::ChannelType;-use model::user::UserContext;-use serde::{Deserialize, Serialize};-use utoipa::ToSchema;--#[derive(Debug, Serialize, Deserialize, ToSchema)]-pub struct CreateChannelRequest {- /// Optionally a name for the channel- pub name: Option<String>,- /// The type of channel- pub channel_type: ChannelType,- /// If the channel_type is team, provide the id of the team you are creating the channel for- pub team_id: Option<uuid::Uuid>,- /// list of participants not including the owner- pub participants: Vec<String>,-}--#[derive(Debug, Serialize, Deserialize, ToSchema)]-pub struct CreateChannelResponse {- pub id: String,-}--// TODO: move to a utility file somewhere?-pub fn to_lowercase(strings: &[String]) -> Vec<String> {- strings.iter().map(|s| s.to_lowercase()).collect()-}--#[utoipa::path(- post,- tag = "channels",- path = "/comms/channels",- operation_id = "create_channel",- responses(- (status = 201, body=CreateChannelResponse),- (status = 400, body=String),- (status = 401, body=String),- (status = 403, body=String),- (status = 404, body=String),- (status = 500, body=String),- )- )]-#[tracing::instrument(skip(ctx, user_context), fields(user_id=?user_context.user_id))]-pub async fn create_channel_handler(- State(ctx): State<AppState>,- user_context: Extension<UserContext>,- extract::Json(req): extract::Json<CreateChannelRequest>,-) -> Result<(StatusCode, Json<CreateChannelResponse>), (StatusCode, String)> {- if req.channel_type == ChannelType::Team {- let team_id = if let Some(team_id) = req.team_id.as_ref() {- team_id- } else {- return Err((- StatusCode::BAD_REQUEST,- "team id missing for team channel type".to_string(),- ));- };-- let teams = macro_db_client::team::get::get_user_teams(&ctx.db, &user_context.user_id)- .await- .map_err(|e| {- tracing::error!(error=?e, "unable to get_user_teams");- (- StatusCode::INTERNAL_SERVER_ERROR,- "unable to validate team".to_string(),- )- })?;-- if !teams.into_iter().any(|t| team_id.eq(&t.id)) {- return Err((- StatusCode::FORBIDDEN,- "you do not have access to that team".to_string(),- ));- }- }-- if req.team_id.is_some() && req.channel_type != ChannelType::Team {- return Err((- StatusCode::BAD_REQUEST,- "team channels need team channel type".to_string(),- ));- }-- // safety check to make sure you don't provide a team id in a non-team id channel-- // We only need to define the org_id for organization channels- let org_id_for_channel = match req.channel_type {- ChannelType::Organization => user_context.organization_id.map(|org_id| org_id as i64),- _ => None,- };-- let participants = to_lowercase(&req.participants);- let participants = participants- .into_iter()- .filter(|p| p.starts_with("macro|"))- .collect::<Vec<String>>();-- if participants.is_empty() {- return Err((- StatusCode::BAD_REQUEST,- "participants must be a non-empty list of 'macro|<email>'".to_string(),- ));- }-- // Make a copy of the participants to be used after making the channel- let participants_copy: Option<Vec<String>> = if req.channel_type == ChannelType::Private {- Some(participants.clone())- } else {- None- };-- let id = create_channel(- &ctx.db,- CreateChannelOptions {- name: req.name.clone(),- owner_id: user_context.user_id.clone(),- org_id: org_id_for_channel,- channel_type: req.channel_type,- team_id: req.team_id,- participants: participants.clone(),- },- )- .await- .map_err(|e| {- tracing::error!(error=?e, "unable to create channel");- (- StatusCode::INTERNAL_SERVER_ERROR,- "unable to create channel".to_string(),- )- })?;-- // There should always be participants, but better safe than sorry- if !participants.is_empty() && req.channel_type == ChannelType::Private {- // Contacts: send message create channel SQS message to Contacts Service- let mut all_users = participants_copy.unwrap_or_default();- if !all_users.contains(&user_context.user_id) {- all_users.push(user_context.user_id.clone());- }- let contacts_users = all_users- .into_iter()- .map(MacroUserIdStr::try_from)- .collect::<Result<HashSet<_>, _>>()- .map_err(|e| {- tracing::error!(error=?e, "invalid user id for contacts");- (StatusCode::BAD_REQUEST, "invalid user id".to_string())- })?;- ctx.contacts_ingress- .enqueue_contacts(contacts_users)- .await- .map_err(|e| {- tracing::error!(error=?e, "unable to create 'add participant' SQS message");- (- StatusCode::INTERNAL_SERVER_ERROR,- "unable to create 'add participant' SQS message".to_string(),- )- })?;- }-- Ok((- StatusCode::OK,- Json(CreateChannelResponse { id: id.to_string() }),- ))-}diff --git a/rust/cloud-storage/comms_service/src/api/channels/delete_channel.rs b/rust/cloud-storage/comms_service/src/api/channels/delete_channel.rsdeleted file mode 100644index 1eeefb15a4..0000000000--- a/rust/cloud-storage/comms_service/src/api/channels/delete_channel.rs+++ /dev/null@@ -1,52 +0,0 @@-use crate::{- api::{- context::AppState,- extractors::{ChannelId, ChannelOwner},- },- service,-};-use anyhow::Result;-use axum::{extract::State, http::StatusCode};-use comms_db_client::channels::delete_channel::delete_channel;--#[utoipa::path(- delete,- tag = "channels",- operation_id = "delete_channel",- path = "/comms/channels/{channel_id}",- params(- ("channel_id" = String, Path, description = "id of the channel"),- ),- responses(- (status = 204, body=String),- (status = 400, body=String),- (status = 404, body=String),- (status = 500, body=String),- )- )]-#[tracing::instrument(skip(ctx))]-pub async fn delete_channel_handler(- State(ctx): State<AppState>,- ChannelOwner(channel_owner): ChannelOwner,- ChannelId(channel_id): ChannelId,-) -> Result<(StatusCode, String), (StatusCode, String)> {- tracing::info!("delete_channel");-- delete_channel(&ctx.db, channel_id, &channel_owner.context.user_id)- .await- .map_err(|e| {- tracing::error!(error=?e, "error deleting channel");- (StatusCode::INTERNAL_SERVER_ERROR, e.to_string())- })?;-- service::search::send_remove_channel_message_to_search_extractor_queue(- &ctx.sqs_client,- channel_id,- None::<&str>,- );-- Ok((- StatusCode::NOT_FOUND,- "channel successfully deleted".to_string(),- ))-}diff --git a/rust/cloud-storage/comms_service/src/api/channels/delete_message.rs b/rust/cloud-storage/comms_service/src/api/channels/delete_message.rsdeleted file mode 100644index 76f7c91021..0000000000--- a/rust/cloud-storage/comms_service/src/api/channels/delete_message.rs+++ /dev/null@@ -1,91 +0,0 @@-use crate::{- api::{- context::AppState,- extractors::{ChannelParticipants, MessageId, MessageSenderOrAdmin},- },- service::{- self,- sender::notify::{WithNonce, notify_message},- },-};-use anyhow::Result;-use axum::{- extract::{Path, Query, State},- http::StatusCode,-};-use comms_db_client::messages::delete_message::delete_message;-use serde::{Deserialize, Serialize};-use utoipa::ToSchema;--#[derive(Debug, Serialize, Deserialize, ToSchema)]-pub struct DeleteMessageParams {- pub channel_id: String,- pub message_id: String,-}--#[derive(Debug, Deserialize, ToSchema)]-pub struct DeleteMessageQuery {- pub nonce: Option<String>,-}--#[utoipa::path(- delete,- tag = "channels",- operation_id = "delete_message",- path = "/comms/channels/{channel_id}/message/{message_id}",- params(- ("channel_id" = String, Path, description = "id of the channel"),- ("message_id" = String, Path, description = "id of the message")- ),- responses(- (status = 201, body=String),- (status = 401, body=String),- (status = 404, body=String),- (status = 500, body=String),- )- )]-#[tracing::instrument(skip(ctx, participants))]-pub async fn delete_message_handler(- State(ctx): State<AppState>,- _message_sender_or_admin: MessageSenderOrAdmin,- ChannelParticipants(participants): ChannelParticipants,- MessageId(message_id): MessageId,- Path(params): Path<DeleteMessageParams>,- Query(query): Query<DeleteMessageQuery>,-) -> Result<(StatusCode, String), (StatusCode, String)> {- tracing::info!("delete_message");-- let message = delete_message(&ctx.db, message_id).await.map_err(|e| {- tracing::error!(error=?e, "unable to delete message");- (- StatusCode::INTERNAL_SERVER_ERROR,- "unable to delete message".to_string(),- )- })?;- let participants: Vec<_> = participants.iter().map(|p| p.user_id.clone()).collect();-- notify_message(- &ctx,- WithNonce {- data: &message,- nonce: query.nonce.as_deref(),- },- &participants,- )- .await- .map_err(|e| {- tracing::error!(error=?e, "unable to notify message");- (- StatusCode::INTERNAL_SERVER_ERROR,- "failed to deliver message".to_string(),- )- })?;-- service::search::send_remove_channel_message_to_search_extractor_queue(- &ctx.sqs_client,- params.channel_id,- Some(params.message_id),- );-- Ok((StatusCode::OK, "message sent".to_string()))-}diff --git a/rust/cloud-storage/comms_service/src/api/channels/get_channel.rs b/rust/cloud-storage/comms_service/src/api/channels/get_channel.rsdeleted file mode 100644index dace6dfc57..0000000000--- a/rust/cloud-storage/comms_service/src/api/channels/get_channel.rs+++ /dev/null@@ -1,115 +0,0 @@-use crate::api::{- context::{AppState, ChannelImpl},- extractors::{ChannelId, ChannelMember, ChannelName, ChannelParticipants, ParticipantAccess},-};-use anyhow::Result;-use axum::{- Json,- extract::{Query, State},- http::StatusCode,-};-use axum_extra::extract::Cached;-use comms_db_client::{- activity::get_activity::get_activity_for_channel,- attachments::get_attachments::get_attachments,- channels::get_channel::get_channel,- messages::get_messages::get_messages,- model::{Activity, Attachment, CountedReaction, Message},- reactions::{get_reactions::get_messages_reactions, group_reactions_by_message},-};-use doppleganger::Mirror;-use futures::try_join;-use model::comms::{Channel, ChannelParticipant};-use serde::{Deserialize, Serialize};-use std::collections::HashMap;-use utoipa::ToSchema;--#[derive(Debug, Serialize, Deserialize, ToSchema)]-pub struct GetChannelResponse {- /// information about the channel- pub channel: Channel,- /// list of participants- pub participants: Vec<ChannelParticipant>,- /// messages- pub messages: Vec<Message>,- /// reactions grouped by message- pub reactions: HashMap<String, Vec<CountedReaction>>,- /// the last activity for the given user on this channel- pub activity: Option<Activity>,- /// Attachments that are linked to messages in this channel- pub attachments: Vec<Attachment>,- /// What kind of access the user has to the channel- /// almost always this should be [Access(ParticipantType)]- pub access: ParticipantAccess,-}--#[derive(Debug, Deserialize)]-pub struct GetChannelQuery {- pub since: Option<chrono::DateTime<chrono::Utc>>,- pub limit: Option<i64>,-}--#[utoipa::path(- get,- path = "/comms/channels/{channel_id}",- tag = "channels",- operation_id = "get_channel",- params(- ("channel_id" = String, Path, description = "id of the channel"),- ("since" = Option<String>, Query, description = "ISO8601 timestamp to fetch messages since"),- ("limit" = Option<i64>, Query, description = "Maximum number of messages to fetch")- ),- responses(- (status = 200, body=GetChannelResponse),- (status = 401, body=String),- (status = 404, body=String),- (status = 500, body=String),- )- )]-#[tracing::instrument(skip(app_state, participants))]-pub async fn get_channel_handler(- State(app_state): State<AppState>,- ChannelId(channel_id): ChannelId,- ChannelParticipants(participants): ChannelParticipants,- ChannelMember(channel_member): ChannelMember,- ChannelName(channel_name, ..): ChannelName<ChannelImpl>,- Cached(access): Cached<ParticipantAccess>,- Query(query): Query<GetChannelQuery>,-) -> Result<(StatusCode, Json<GetChannelResponse>), (StatusCode, String)> {- let db = &app_state.db;-- let (mut channel, messages, activity, attachments) = try_join!(- get_channel(db, &channel_id),- get_messages(db, &channel_id, query.since, query.limit),- get_activity_for_channel(db, &channel_id, &channel_member.context.user_id),- get_attachments(db, &channel_id),- )- .map_err(|err| {- tracing::error!(error=?err, "unable to get channel data");- (StatusCode::INTERNAL_SERVER_ERROR, err.to_string())- })?;-- let reactions = get_messages_reactions(db, messages.iter().map(|m| m.id).collect())- .await- .map_err(|err| {- tracing::error!("unable to get reactions: {:?}", err);- (StatusCode::INTERNAL_SERVER_ERROR, err.to_string())- })?;-- let reactions = group_reactions_by_message(reactions);-- channel.name = Some(channel_name);-- return Ok((- StatusCode::OK,- Json(GetChannelResponse {- channel,- participants: <Vec<model::comms::ChannelParticipant>>::mirror(participants),- messages,- reactions,- activity,- attachments,- access: access.clone(),- }),- ));-}diff --git a/rust/cloud-storage/comms_service/src/api/channels/get_channel_metadata.rs b/rust/cloud-storage/comms_service/src/api/channels/get_channel_metadata.rsdeleted file mode 100644index c88ed643a4..0000000000--- a/rust/cloud-storage/comms_service/src/api/channels/get_channel_metadata.rs+++ /dev/null@@ -1,116 +0,0 @@-use crate::api::{- context::AppState,- extractors::{ChannelId, ChannelMember},-};-use anyhow::Result;-use axum::{- extract::State,- http::StatusCode,- response::{IntoResponse, Json, Response},-};-use axum_extra::extract::Cached;-use comms::domain::models::channel_name::resolve_channel_name;-use comms_db_client::participants::get_participants::get_participants;-use macro_user_id::{cowlike::CowLike, user_id::MacroUserIdStr};-use models_comms::channel::OrganizationId;-use serde::{Deserialize, Serialize};-use sqlx::{Pool, Postgres};-use utoipa::ToSchema;--#[derive(Debug, Serialize, Deserialize, ToSchema)]-pub struct ChannelMetadataResponse {- pub channel_name: String,- pub channel_type: model::comms::ChannelType,-}--#[tracing::instrument(skip(db))]-pub async fn get_channel_name_and_type(- db: &Pool<Postgres>,- channel_id: &models_comms::channel::ChannelId,- user_id: MacroUserIdStr<'_>,-) -> Result<(String, model::comms::ChannelType)> {- let channel = sqlx::query!(- r#"- SELECT- id,- name,- channel_type AS "channel_type: model::comms::ChannelType",- org_id,- created_at,- updated_at,- owner_id- FROM comms_channels- WHERE id = $1- "#,- channel_id.0- )- .try_map(|channel_row| {- Ok(model::comms::Channel {- id: models_comms::channel::ChannelId(channel_row.id),- name: channel_row.name,- channel_type: channel_row.channel_type,- org_id: channel_row.org_id.map(|i| OrganizationId(i as u32)),- created_at: channel_row.created_at,- updated_at: channel_row.updated_at,- owner_id: MacroUserIdStr::parse_from_str(&channel_row.owner_id)- .map_err(|e| sqlx::Error::Decode(Box::new(e)))?- .into_owned(),- })- })- .fetch_one(db)- .await?;-- let participants = get_participants(db, &channel_id.0).await?;-- let channel_name = resolve_channel_name(- &match channel.channel_type {- model::comms::ChannelType::Public => models_comms::channel::ChannelType::Public,- model::comms::ChannelType::Organization => {- models_comms::channel::ChannelType::Organization- }- model::comms::ChannelType::Private => models_comms::channel::ChannelType::Private,- model::comms::ChannelType::DirectMessage => {- models_comms::channel::ChannelType::DirectMessage- }- model::comms::ChannelType::Team => models_comms::channel::ChannelType::Team,- },- channel.name.as_deref(),- &participants,- channel_id,- user_id,- &Default::default(),- );-- Ok((channel_name, channel.channel_type))-}--/// External handler with channel access middleware-#[tracing::instrument(skip(ctx))]-#[axum::debug_handler]-pub async fn handler_external(- State(ctx): State<AppState>,- Cached(ChannelMember(channel_member)): Cached<ChannelMember>,- Cached(ChannelId(channel_id)): Cached<ChannelId>,-) -> Result<Response, Response> {- let (channel_name, channel_type) = get_channel_name_and_type(- &ctx.db,- &models_comms::channel::ChannelId(channel_id),- channel_member.user_id,- )- .await- .map_err(|e| {- tracing::error!(error=?e, "unable to get channel metadata");- (- StatusCode::INTERNAL_SERVER_ERROR,- "unable to get channel metadata",- )- .into_response()- })?;-- let response = ChannelMetadataResponse {- channel_name,- channel_type,- };-- Ok((StatusCode::OK, Json(response)).into_response())-}diff --git a/rust/cloud-storage/comms_service/src/api/channels/get_mentions.rs b/rust/cloud-storage/comms_service/src/api/channels/get_mentions.rsdeleted file mode 100644index ccdbe4a0bb..0000000000--- a/rust/cloud-storage/comms_service/src/api/channels/get_mentions.rs+++ /dev/null@@ -1,47 +0,0 @@-#[allow(unused_imports)]-use crate::api::context::AppState;-use crate::api::extractors::{ChannelId, ChannelMember};-use axum::http::StatusCode;-use axum::{Json, extract::State};-use axum_extra::extract::Cached;-use axum_macros::debug_handler;-use comms_db_client::channels::get_mentions_for_channel::get_mentions_for_channel;-use comms_db_client::model::MessageMention;-use sqlx::PgPool;--#[derive(Debug, serde::Serialize, serde::Deserialize, utoipa::ToSchema)]-pub struct GetMentionsResponse {- mentions: Vec<MessageMention>,-}--#[utoipa::path(- get,- path = "/comms/channels/{channel_id}/mentions",- tag = "channels",- operation_id = "get_mentions_for_channel",- params(- ("channel_id" = String, Path, description = "id of the channel")- ),- responses(- (status = 200, body=GetMentionsResponse),- (status = 401, body=String),- (status = 404, body=String),- (status = 500, body=String),- )- )]-#[tracing::instrument(skip(db))]-#[debug_handler(state = AppState)]-pub async fn handler(- State(db): State<PgPool>,- ChannelMember(_channel_member): ChannelMember,- Cached(ChannelId(channel_id)): Cached<ChannelId>,-) -> anyhow::Result<(StatusCode, Json<GetMentionsResponse>), (StatusCode, String)> {- let mentions = get_mentions_for_channel(&db, &channel_id)- .await- .map_err(|err| {- tracing::error!(error=?err,"unable to get mentions for channel");- (StatusCode::INTERNAL_SERVER_ERROR, err.to_string())- })?;-- Ok((StatusCode::OK, Json(GetMentionsResponse { mentions })))-}diff --git a/rust/cloud-storage/comms_service/src/api/channels/get_message_with_context.rs b/rust/cloud-storage/comms_service/src/api/channels/get_message_with_context.rsdeleted file mode 100644index 86f7ec286d..0000000000--- a/rust/cloud-storage/comms_service/src/api/channels/get_message_with_context.rs+++ /dev/null@@ -1,84 +0,0 @@-use crate::api::context::AppState;-use axum::{- Json,- extract::{Query, State},- http::StatusCode,-};-use comms_db_client::messages::read_message_with_context::get_messages_with_context;-use model::comms::GetMessageWithContextResponse;-use serde::Deserialize;-use utoipa::ToSchema;-use uuid::Uuid;--#[derive(Debug, Deserialize, ToSchema)]-pub struct GetMessageWithContextParams {- /// The ID of the message to get context around- pub message_id: Uuid,- /// Number of messages to fetch before the target message- #[serde(default)]- pub before: i64,- /// Number of messages to fetch after the target message- #[serde(default)]- pub after: i64,-}--#[utoipa::path(- get,- path = "/comms/channels/messages/context",- tag = "channels",- operation_id = "get_message_with_context",- params(- ("message_id" = String, Query, description = "ID of the message to get context around"),- ("before" = Option<i64>, Query, description = "Number of messages to fetch before the target message (defaults to 0)"),- ("after" = Option<i64>, Query, description = "Number of messages to fetch after the target message (defaults to 0)"),- ),- responses(- (status = 200, body = GetMessageWithContextResponse, description = "Successfully retrieved messages with context"),- (status = 400, body = String, description = "Invalid request parameters"),- (status = 401, body = String, description = "Unauthorized"),- (status = 500, body = String, description = "Internal server error"),- )-)]-#[tracing::instrument(skip(app_state))]-pub async fn handler(- State(app_state): State<AppState>,- Query(params): Query<GetMessageWithContextParams>,-) -> Result<(StatusCode, Json<GetMessageWithContextResponse>), (StatusCode, String)> {- tracing::info!(- message_id = ?params.message_id,- before = params.before,- after = params.after,- "get_message_with_context"- );-- let ctx = &app_state;-- let db_messages =- get_messages_with_context(&ctx.db, ¶ms.message_id, params.before, params.after)- .await- .map_err(|err| {- tracing::error!(error = ?err, "unable to get messages with context");- (StatusCode::INTERNAL_SERVER_ERROR, err.to_string())- })?;-- // Convert from comms_db_client::model::Message to model::comms::Message- let messages = db_messages- .into_iter()- .map(|m| model::comms::Message {- id: m.id,- channel_id: m.channel_id,- thread_id: m.thread_id,- sender_id: m.sender_id,- content: m.content,- created_at: m.created_at,- updated_at: m.updated_at,- edited_at: m.edited_at,- deleted_at: m.deleted_at,- })- .collect();-- Ok((- StatusCode::OK,- Json(GetMessageWithContextResponse { messages }),- ))-}diff --git a/rust/cloud-storage/comms_service/src/api/channels/get_or_create_dm.rs b/rust/cloud-storage/comms_service/src/api/channels/get_or_create_dm.rsdeleted file mode 100644index 5f51e26ff9..0000000000--- a/rust/cloud-storage/comms_service/src/api/channels/get_or_create_dm.rs+++ /dev/null@@ -1,142 +0,0 @@-use crate::api::context::AppState;-use anyhow::Result;-use axum::{- Json,- extract::{self, Extension, State},- http::StatusCode,-};-use comms_db_client::channels::{- create_channel::{CreateChannelOptions, create_channel},- get_dm,-};-use contacts::domain::ports::ContactsIngress;-use macro_user_id::user_id::MacroUserIdStr;-use model::{- comms::{ChannelType, GetOrCreateAction},- user::UserContext,-};-use serde::{Deserialize, Serialize};-use utoipa::ToSchema;--#[derive(Debug, Serialize, Deserialize, ToSchema)]-pub struct GetOrCreateDmResponse {- pub channel_id: String,- pub action: GetOrCreateAction,-}--#[derive(Debug, Serialize, Deserialize, ToSchema)]-pub struct GetOrCreateDmRequest {- pub recipient_id: String,-}--#[utoipa::path(- post,- tag = "channels",- operation_id = "get_or_create_dm",- description = "given a user and a recipient, either finds or creates a direct message channel",- path = "/comms/channels/get_or_create_dm",- responses(- (status = 200, body=GetOrCreateDmResponse),- (status = 400, body=String),- (status = 401, body=String),- (status = 404, body=String),- (status = 500, body=String),- )-)]-#[tracing::instrument(- skip(ctx, user_context),- fields(user_id=?user_context.user_id, recipient_id=?req.recipient_id)-)]-pub async fn handler(- State(ctx): State<AppState>,- user_context: Extension<UserContext>,- extract::Json(req): extract::Json<GetOrCreateDmRequest>,-) -> Result<(StatusCode, Json<GetOrCreateDmResponse>), (StatusCode, String)> {- // You cannot make a DM with yourself- let recipient_id = req.recipient_id.to_lowercase();- let user_id = user_context.user_id.to_lowercase();-- if recipient_id.is_empty() {- return Err((- StatusCode::BAD_REQUEST,- "recipient_id must be a non-empty string".to_string(),- ));- }-- if !recipient_id.starts_with("macro|") {- return Err((- StatusCode::BAD_REQUEST,- "recipient_id must be 'macro|<email>'".to_string(),- ));- }-- if recipient_id == user_id {- return Err((- StatusCode::BAD_REQUEST,- "recipient_id cannot be the same as the user_id".to_string(),- ));- }-- let maybe_dm = get_dm::maybe_get_dm(&ctx.db, &user_id, &recipient_id)- .await- .map_err(|e| {- tracing::error!(error=?e, "unable to get direct message channel");- (- StatusCode::INTERNAL_SERVER_ERROR,- "unable to get direct message channel".to_string(),- )- })?;-- let (dm_id, action) = match maybe_dm {- Some(private_id) => (private_id, GetOrCreateAction::Get),- None => {- let id = create_channel(- &ctx.db,- CreateChannelOptions {- name: None,- owner_id: user_id.clone(),- org_id: None,- channel_type: ChannelType::DirectMessage,- participants: vec![user_id.clone(), recipient_id.clone()],- team_id: None,- },- )- .await- .map_err(|e| {- tracing::error!(error=?e, "unable to create channel");- (- StatusCode::INTERNAL_SERVER_ERROR,- "unable to create channel".to_string(),- )- })?;- // Contacts: create connections- let contacts_users = vec![user_id.clone(), recipient_id.clone()]- .into_iter()- .map(MacroUserIdStr::try_from)- .collect::<Result<std::collections::HashSet<_>, _>>()- .map_err(|e| {- tracing::error!(error=?e, "invalid user id for contacts");- (StatusCode::BAD_REQUEST, "invalid user id".to_string())- })?;- ctx.contacts_ingress- .enqueue_contacts(contacts_users)- .await- .map_err(|e| {- tracing::error!(error=?e, "unable to create 'add participant' SQS message");- (- StatusCode::INTERNAL_SERVER_ERROR,- "unable to create 'add participant' SQS message".to_string(),- )- })?;- (id, GetOrCreateAction::Create)- }- };-- Ok((- StatusCode::OK,- Json(GetOrCreateDmResponse {- channel_id: dm_id.to_string(),- action,- }),- ))-}diff --git a/rust/cloud-storage/comms_service/src/api/channels/get_or_create_private.rs b/rust/cloud-storage/comms_service/src/api/channels/get_or_create_private.rsdeleted file mode 100644index d3246681f3..0000000000--- a/rust/cloud-storage/comms_service/src/api/channels/get_or_create_private.rs+++ /dev/null@@ -1,146 +0,0 @@-use crate::api::channels::create_channel::to_lowercase;-use crate::api::context::AppState;-use contacts::domain::ports::ContactsIngress;-use macro_user_id::user_id::MacroUserIdStr;-use std::iter;--use anyhow::Result;-use axum::{- Json,- extract::{self, Extension, State},- http::StatusCode,-};-use comms_db_client::channels::{- create_channel::{CreateChannelOptions, create_channel},- get_private,-};-use model::{- comms::{ChannelType, GetOrCreateAction},- user::UserContext,-};-use serde::{Deserialize, Serialize};-use utoipa::ToSchema;--#[derive(Debug, Serialize, Deserialize, ToSchema)]-pub struct GetOrCreatePrivateResponse {- pub channel_id: String,- pub action: GetOrCreateAction,-}--#[derive(Debug, Serialize, Deserialize, ToSchema)]-pub struct GetOrCreatePrivateRequest {- pub recipients: Vec<String>,-}--#[utoipa::path(- post,- tag = "channels",- operation_id = "get_or_create_private",- description = "given a list of partiicpants, either fetch an existing private channel with the permtation or create a new one",- path = "/comms/channels/get_or_create_private",- responses(- (status = 200, body=GetOrCreatePrivateResponse),- (status = 400, body=String),- (status = 401, body=String),- (status = 404, body=String),- (status = 500, body=String),- )-)]-#[tracing::instrument(- skip(ctx, user_context),- fields(user_id=?user_context.user_id, recipients=?req.recipients)-)]-pub async fn handler(- State(ctx): State<AppState>,- user_context: Extension<UserContext>,- extract::Json(mut req): extract::Json<GetOrCreatePrivateRequest>,-) -> Result<(StatusCode, Json<GetOrCreatePrivateResponse>), (StatusCode, String)> {- // Filter out all invalidly formatted recipients- req.recipients = req- .recipients- .into_iter()- .filter_map(|r| r.starts_with("macro|").then_some(r.to_lowercase()))- .collect();-- if req.recipients.is_empty() {- return Err((- StatusCode::BAD_REQUEST,- "recipients must be a non-empty list of 'macro|<email>'".to_string(),- ));- }-- let user_id = user_context.user_id.to_lowercase();- let maybe_private = get_private::maybe_get_private_channel(- &ctx.db,- // When requesting the private channel,- // we also need to include the id of the user making the request- &req.recipients- .clone()- .into_iter()- .chain(iter::once(user_id.clone()))- .collect::<Vec<_>>(),- )- .await- .map_err(|e| {- tracing::error!(error=?e, "unable to get private channel");- (- StatusCode::INTERNAL_SERVER_ERROR,- "unable to get private message channel".to_string(),- )- })?;-- let (private_id, action) = match maybe_private {- Some(private_id) => (private_id, GetOrCreateAction::Get),- None => {- let recipients = to_lowercase(&req.recipients);- let id = create_channel(- &ctx.db,- CreateChannelOptions {- name: None,- owner_id: user_id.clone(),- org_id: None,- channel_type: ChannelType::Private,- participants: recipients.clone(),- team_id: None,- },- )- .await- .map_err(|e| {- tracing::error!(error=?e, "unable to create private channel");- (- StatusCode::INTERNAL_SERVER_ERROR,- "unable to create private channel".to_string(),- )- })?;- let mut recipients = recipients.clone();- recipients.push(user_id.clone());- let contacts_users = recipients- .into_iter()- .map(MacroUserIdStr::try_from)- .collect::<Result<std::collections::HashSet<_>, _>>()- .map_err(|e| {- tracing::error!(error=?e, "invalid user id for contacts");- (StatusCode::BAD_REQUEST, "invalid user id".to_string())- })?;- ctx.contacts_ingress- .enqueue_contacts(contacts_users)- .await- .map_err(|e| {- tracing::error!(error=?e, "unable to create 'add participant' SQS message");- (- StatusCode::INTERNAL_SERVER_ERROR,- "unable to create 'add participant' SQS message".to_string(),- )- })?;- (id, GetOrCreateAction::Create)- }- };-- Ok((- StatusCode::OK,- Json(GetOrCreatePrivateResponse {- channel_id: private_id.to_string(),- action,- }),- ))-}diff --git a/rust/cloud-storage/comms_service/src/api/channels/join_channel.rs b/rust/cloud-storage/comms_service/src/api/channels/join_channel.rsdeleted file mode 100644index 3f306c7fa7..0000000000--- a/rust/cloud-storage/comms_service/src/api/channels/join_channel.rs+++ /dev/null@@ -1,101 +0,0 @@-use std::collections::HashSet;--use crate::api::context::AppState;-use crate::api::extractors::{ChannelId, ChannelParticipants, ChannelTypeExtractor};-use anyhow::Result;-use axum::{- extract::{Extension, State},- http::StatusCode,-};-use axum_extra::extract::Cached;-use comms_db_client::participants::add_participant::{AddParticipantOptions, add_participant};-use contacts::domain::ports::ContactsIngress;-use macro_user_id::user_id::MacroUserIdStr;-use model::comms::ParticipantRole;-use model::user::UserContext;--#[utoipa::path(- post,- tag = "channels",- operation_id = "join_channel",- description = "allows a user to attempt to join a channel",- path = "/comms/channels/{channel_id}/join",- params(- ("channel_id" = String, Path, description = "channel id"),- ),- responses(- (status = 200),- (status = 401, body=String),- (status = 404, body=String),- (status = 500, body=String),- )-)]-#[tracing::instrument(- skip(ctx),- fields(user_id=?user_ctx.user_id)-)]-pub async fn join_channel_handler(- State(ctx): State<AppState>,- Cached(ChannelTypeExtractor(channel_type)): Cached<ChannelTypeExtractor>,- Cached(ChannelParticipants(channel_participants)): Cached<ChannelParticipants>,- Cached(ChannelId(channel_id)): Cached<ChannelId>,- user_ctx: Extension<UserContext>,-) -> Result<StatusCode, (StatusCode, String)> {- if let models_comms::channel::ChannelType::DirectMessage = channel_type {- tracing::error!("user tried to join a direct message channel");- return Err((- StatusCode::BAD_REQUEST,- "cannot join direct message channel".to_string(),- ));- }-- add_participant(- &ctx.db,- AddParticipantOptions {- channel_id: &channel_id,- user_id: &user_ctx.user_id,- participant_role: Some(ParticipantRole::Member),- },- )- .await- .map_err(|e| {- tracing::error!(error=?e, "unable to add participant to channel");- (- StatusCode::INTERNAL_SERVER_ERROR,- "unable to add participant to channel".to_string(),- )- })?;-- if !matches!(- channel_type,- models_comms::channel::ChannelType::DirectMessage- | models_comms::channel::ChannelType::Organization- ) && !channel_participants.is_empty()- {- let joiner = MacroUserIdStr::try_from(user_ctx.user_id.clone()).map_err(|e| {- tracing::error!(error=?e, "invalid user id for contacts");- (StatusCode::BAD_REQUEST, "invalid user id".to_string())- })?;-- let mut contacts_users: HashSet<MacroUserIdStr<'static>> = channel_participants- .iter()- .map(|p| p.user_id.to_string())- .map(MacroUserIdStr::try_from)- .collect::<Result<_, _>>()- .map_err(|e| {- tracing::error!(error=?e, "invalid user id for contacts");- (StatusCode::BAD_REQUEST, "invalid user id".to_string())- })?;- contacts_users.insert(joiner);-- ctx.contacts_ingress- .enqueue_contacts(contacts_users)- .await- .inspect_err(|e| {- tracing::error!(error=?e, "unable to create 'join channel' contacts message");- })- .ok();- }-- Ok(StatusCode::OK)-}diff --git a/rust/cloud-storage/comms_service/src/api/channels/leave_channel.rs b/rust/cloud-storage/comms_service/src/api/channels/leave_channel.rsdeleted file mode 100644index 6873cf2d0c..0000000000--- a/rust/cloud-storage/comms_service/src/api/channels/leave_channel.rs+++ /dev/null@@ -1,72 +0,0 @@-use crate::api::{- context::AppState,- extractors::{ChannelId, ChannelMember, ChannelParticipants, ChannelTypeExtractor},-};-use anyhow::Result;-use axum::{extract::State, http::StatusCode};-use axum_extra::extract::Cached;-use comms_db_client::participants::remove_participant::{- RemoveParticipantOptions, remove_participant,-};--#[utoipa::path(- post,- tag = "channels",- operation_id = "leave_channel",- description = "allows a user to attempt to leave a channel",- path = "/comms/channels/{channel_id}/leave",- params(- ("channel_id" = String, Path, description = "channel id"),- ),- responses(- (status = 200),- (status = 401, body=String),- (status = 404, body=String),- (status = 500, body=String),- )-)]-#[tracing::instrument(skip(ctx))]-pub async fn leave_channel_handler(- State(ctx): State<AppState>,- Cached(ChannelTypeExtractor(channel_type)): Cached<ChannelTypeExtractor>,- Cached(ChannelId(channel_id)): Cached<ChannelId>,- Cached(ChannelParticipants(participants)): Cached<ChannelParticipants>,- Cached(ChannelMember(channel_member)): Cached<ChannelMember>,-) -> Result<StatusCode, (StatusCode, String)> {- match (channel_type, participants.len()) {- (models_comms::channel::ChannelType::Organization, _) => {- tracing::warn!("user tried to leave organization channel");- return Err((- StatusCode::BAD_REQUEST,- "cannot leave organization channel".to_string(),- ));- }- (models_comms::channel::ChannelType::Private, 2)- | (models_comms::channel::ChannelType::DirectMessage, _) => {- tracing::warn!("user tried to leave private channel with only 2 participants");- return Err((- StatusCode::BAD_REQUEST,- "cannot leave channel with only 2 participants".to_string(),- ));- }- _ => {}- };-- remove_participant(- &ctx.db,- RemoveParticipantOptions {- channel_id: &channel_id,- user_id: &channel_member.context.user_id,- },- )- .await- .map_err(|e| {- tracing::error!(error=?e, "unable to remove participant from channel");- (- StatusCode::INTERNAL_SERVER_ERROR,- "unable to remove participant from channel".to_string(),- )- })?;-- Ok(StatusCode::OK)-}diff --git a/rust/cloud-storage/comms_service/src/api/channels/mod.rs b/rust/cloud-storage/comms_service/src/api/channels/mod.rsdeleted file mode 100644index 03491ac322..0000000000--- a/rust/cloud-storage/comms_service/src/api/channels/mod.rs+++ /dev/null@@ -1,82 +0,0 @@-use axum::{- Router,- routing::{delete, get, patch, post},-};--pub mod add_participants;-pub mod create_channel;-pub mod delete_channel;-pub mod delete_message;-pub mod get_channel;-pub mod get_channel_metadata;-pub mod get_mentions;-pub mod get_message_with_context;-pub mod get_or_create_dm;-pub mod get_or_create_private;-pub mod join_channel;-pub mod leave_channel;-pub mod patch_channel;-pub mod patch_message;-pub mod post_message;-pub mod post_reaction;-pub mod post_typing;-pub mod remove_participants;-use crate::api::context::AppState;--pub fn router() -> Router<AppState> {- Router::new()- .route("/", post(create_channel::create_channel_handler))- .route("/{channel_id}", get(get_channel::get_channel_handler))- .route(- "/{channel_id}",- delete(delete_channel::delete_channel_handler),- )- .route("/{channel_id}", patch(patch_channel::patch_channel_handler))- .route(- "/{channel_id}/message",- post(post_message::post_message_handler),- )- .route(- "/{channel_id}/typing",- post(post_typing::post_typing_handler),- )- .route(- "/{channel_id}/reaction",- post(post_reaction::post_reaction_handler),- )- .route(- "/{channel_id}/message/{message_id}",- patch(patch_message::patch_message_handler),- )- .route(- "/{channel_id}/message/{message_id}",- delete(delete_message::delete_message_handler),- )- .route(- "/{channel_id}/join",- post(join_channel::join_channel_handler),- )- .route(- "/{channel_id}/leave",- post(leave_channel::leave_channel_handler),- )- .route(- "/{channel_id}/participants",- post(add_participants::handler),- )- .route(- "/{channel_id}/participants",- delete(remove_participants::handler),- )- .route("/get_or_create_dm", post(get_or_create_dm::handler))- .route(- "/get_or_create_private",- post(get_or_create_private::handler),- )- .route("/{channel_id}/mentions", get(get_mentions::handler))- .route(- "/{channel_id}/metadata",- get(get_channel_metadata::handler_external),- )- .route("/messages/context", get(get_message_with_context::handler))-}diff --git a/rust/cloud-storage/comms_service/src/api/channels/patch_channel.rs b/rust/cloud-storage/comms_service/src/api/channels/patch_channel.rsdeleted file mode 100644index f2f42bfa31..0000000000--- a/rust/cloud-storage/comms_service/src/api/channels/patch_channel.rs+++ /dev/null@@ -1,54 +0,0 @@-use crate::api::{- context::AppState,- extractors::{ChannelId, ChannelOwner, ChannelTypeExtractor},-};-use anyhow::Result;-use axum::{Json, extract::State, http::StatusCode};-use axum_extra::extract::Cached;-use comms_db_client::channels::patch_channel::{self, PatchChannelOptions};--#[utoipa::path(- patch,- tag = "channels",- operation_id = "patch_channel",- path = "/comms/channels/{channel_id}",- params(- ("channel_id" = String, Path, description = "id of the channel"),- ),- responses(- (status = 200, body=String),- (status = 500, body=String),- )- )]-#[tracing::instrument(skip(ctx))]-pub async fn patch_channel_handler(- State(ctx): State<AppState>,- ChannelOwner(channel_owner): ChannelOwner,- Cached(ChannelId(channel_id)): Cached<ChannelId>,- Cached(ChannelTypeExtractor(channel_type)): Cached<ChannelTypeExtractor>,- Json(req): Json<PatchChannelOptions>,-) -> Result<(StatusCode, String), (StatusCode, String)> {- if matches!(- channel_type,- models_comms::channel::ChannelType::DirectMessage- ) && req.channel_name.is_some()- {- return Err((- StatusCode::BAD_REQUEST,- "cannot change channel_name for direct message channels".to_string(),- ));- }-- patch_channel::patch_channel(&ctx.db, &channel_id, &channel_owner.context.user_id, req)- .await- .map_err(|e| {- tracing::error!("error patching channel: {e}");-- (- StatusCode::INTERNAL_SERVER_ERROR,- "error patching channel".to_string(),- )- })?;-- Ok((StatusCode::OK, "patched channel".to_string()))-}diff --git a/rust/cloud-storage/comms_service/src/api/channels/patch_message.rs b/rust/cloud-storage/comms_service/src/api/channels/patch_message.rsdeleted file mode 100644index 64dcac145f..0000000000--- a/rust/cloud-storage/comms_service/src/api/channels/patch_message.rs+++ /dev/null@@ -1,387 +0,0 @@-use crate::{- api::{- context::AppState,- extractors::{ChannelId, ChannelParticipants, MessageId, MessageSender},- },- service::{- self,- sender::notify::{self, AttachmentData, WithNonce},- },-};-use anyhow::Result;-use axum::{- extract::{self, Path, State},- http::StatusCode,-};-use axum_extra::extract::Cached;-use comms_db_client::{- activity::upsert_activity::upsert_activity,- entity_mentions::delete_entity_mentions_by_source::delete_entity_mentions_by_source,- messages::add_attachments,- messages::create_message_mentions::{CreateMessageMentionOptions, create_message_mentions},- messages::patch_message::{patch_message, patch_message_attachments},- model::{ActivityType, NewAttachment, SimpleMention},-};-use macro_user_id::cowlike::CowLike;-use serde::{Deserialize, Serialize};-use utoipa::ToSchema;-use uuid::Uuid;--#[derive(Debug, Serialize, Deserialize, ToSchema)]-pub struct PatchMessageRequest {- pub content: Option<String>,- pub mentions: Option<Vec<SimpleMention>>,- pub attachment_ids_to_delete: Option<Vec<String>>,- pub attachments_to_add: Option<Vec<NewAttachment>>,- pub nonce: Option<String>,-}--#[derive(Debug, Serialize, Deserialize, ToSchema)]-pub struct PatchMessageParams {- pub channel_id: String,- pub message_id: String,-}--#[utoipa::path(- patch,- tag = "channels",- operation_id = "patch_message",- path = "/comms/channels/{channel_id}/message/{message_id}",- params(- ("channel_id" = String, Path, description = "id of the channel"),- ("message_id" = String, Path, description = "id of the message")- ),- responses(- (status = 201, body=String),- (status = 401, body=String),- (status = 404, body=String),- (status = 500, body=String),- )- )]-#[tracing::instrument(skip(app_state, participants))]-pub async fn patch_message_handler(- State(app_state): State<AppState>,- Cached(MessageSender(message_sender)): Cached<MessageSender>,- Cached(ChannelId(channel_id)): Cached<ChannelId>,- Cached(MessageId(message_id)): Cached<MessageId>,- Cached(ChannelParticipants(participants)): Cached<ChannelParticipants>,- Path(params): Path<PatchMessageParams>,- extract::Json(mut req): extract::Json<PatchMessageRequest>,-) -> Result<(StatusCode, String), (StatusCode, String)> {- tracing::info!("patch_message");-- let attachment_ids_to_delete = req.attachment_ids_to_delete.clone().unwrap_or_default();- let attachments_to_add = req.attachments_to_add.clone().unwrap_or_default();- let attachments_changed =- !attachment_ids_to_delete.is_empty() || !attachments_to_add.is_empty();-- if attachments_changed {- patch_message_attachments_state(- &app_state,- attachment_ids_to_delete,- attachments_to_add,- message_id,- channel_id,- &message_sender.user_id,- req.nonce.as_deref(),- )- .await?;- }-- if let Some(content) = &req.content {- let message = patch_message(&app_state.db, message_id, content)- .await- .map_err(|e| {- tracing::error!(error=?e, "unable to patch message");- (- StatusCode::INTERNAL_SERVER_ERROR,- "unable to patch message".to_string(),- )- })?;-- if let Some(mentions) = req.mentions.take() {- sync_message_mentions(- &app_state,- message_id,- mentions,- channel_id,- &message_sender.user_id,- )- .await- .map_err(|e| {- tracing::error!(error=?e, "unable to sync message mentions");- (- StatusCode::INTERNAL_SERVER_ERROR,- "unable to sync message mentions".to_string(),- )- })?;- }-- let participants = participants;- let participants: Vec<_> = if let Some(thread_id) = message.thread_id.as_ref() {- comms_db_client::participants::get_participants::get_channel_participants_for_thread_id(- &app_state.db,- thread_id,- )- .await- .map_err(|e| {- tracing::error!(error=?e, "unable to get participants for thread");- (- StatusCode::INTERNAL_SERVER_ERROR,- "Unable to get participants for thread".to_string(),- )- })?- } else {- participants.iter().map(|p| p.user_id.copied()).collect()- };- notify::notify_message(- &app_state,- WithNonce {- data: &message,- nonce: req.nonce.as_deref(),- },- &participants,- )- .await- .map_err(|e| {- tracing::error!(error=?e, "unable to notify message");- (- StatusCode::INTERNAL_SERVER_ERROR,- "failed to deliver message".to_string(),- )- })?;-- upsert_activity(- &app_state.db,- &message_sender.user_id,- &channel_id,- &ActivityType::Interact,- )- .await- .inspect_err(|err| {- tracing::error!(error=?err, "unable to upsert activity for message");- })- .ok();-- service::search::send_channel_message_to_search_extractor_queue(- &app_state.sqs_client,- channel_id,- ¶ms.message_id,- );- }-- if attachments_changed && req.content.is_none() {- upsert_activity(- &app_state.db,- &message_sender.user_id,- &channel_id,- &ActivityType::Interact,- )- .await- .inspect_err(|err| {- tracing::error!(error=?err, "unable to upsert activity for message attachment patch");- })- .ok();-- service::search::send_channel_message_to_search_extractor_queue(- &app_state.sqs_client,- channel_id,- params.message_id,- );- }-- Ok((StatusCode::OK, "message sent".to_string()))-}--#[tracing::instrument(skip(app_state, mentions, sender_id), err(Debug))]-async fn sync_message_mentions(- app_state: &AppState,- message_id: Uuid,- mentions: Vec<SimpleMention>,- channel_id: Uuid,- sender_id: &str,-) -> Result<(), anyhow::Error> {- let mut tx = app_state.db.begin().await?;-- delete_entity_mentions_by_source(&mut *tx, vec![message_id.to_string()]).await?;- create_message_mentions(- &mut *tx,- CreateMessageMentionOptions {- message_id,- mentions: mentions.clone(),- },- )- .await?;-- tx.commit().await?;-- let items_to_share: Vec<(String, String)> = mentions- .into_iter()- .filter(|m| m.entity_type != "user")- .map(|m| (m.entity_id, m.entity_type))- .collect();-- if !items_to_share.is_empty() {- let channel_id_str = channel_id.to_string();- let user_id = sender_id.to_owned();- let db = app_state.db.clone();- let entity_access_service = app_state.entity_access_service.clone();- tokio::spawn(async move {- super::post_message::update_channel_share_permissions_for_items(- &db,- &*entity_access_service,- &user_id,- &channel_id_str,- items_to_share,- )- .await;- });- }-- Ok(())-}--#[tracing::instrument(skip(ctx, attachment_ids_to_delete, attachments, user_id), err(Debug))]-async fn patch_message_attachments_state(- ctx: &AppState,- attachment_ids_to_delete: Vec<String>,- attachments: Vec<NewAttachment>,- message_id: Uuid,- channel_id: Uuid,- user_id: &str,- nonce: Option<&str>,-) -> Result<(), (StatusCode, String)> {- let attachment_uuids = attachment_ids_to_delete- .iter()- .map(|id| Uuid::parse_str(id))- .collect::<Result<Vec<Uuid>, _>>()- .map_err(|err| {- tracing::error!(error=?err, "unable to parse attachment ids");- (StatusCode::BAD_REQUEST, err.to_string())- })?;-- let existing_attachments =- comms_db_client::attachments::get_attachments::get_attachments_by_message_id(- &ctx.db, message_id,- )- .await- .map_err(|err| {- tracing::error!(error=?err, "unable to fetch attachments");- (StatusCode::INTERNAL_SERVER_ERROR, err.to_string())- })?;-- let attachments_to_delete = existing_attachments- .iter()- .filter(|a| attachment_uuids.contains(&a.id))- .cloned()- .collect::<Vec<_>>();-- if attachments_to_delete.len() != attachment_uuids.len() {- tracing::error!(attachment_ids=?attachment_uuids, "some attachments were not found");- }-- let fetched_attachment_ids: Vec<Uuid> = attachments_to_delete.iter().map(|a| a.id).collect();- let fetched_attachments_entity_ids: Vec<String> = attachments_to_delete- .iter()- .map(|a| a.entity_id.clone())- .collect();-- if !fetched_attachment_ids.is_empty() {- comms_db_client::attachments::delete_attachments::delete_attachments_by_ids(- &ctx.db,- fetched_attachment_ids,- )- .await- .map_err(|err| {- tracing::error!(error=?err, "unable to delete attachments");- (StatusCode::INTERNAL_SERVER_ERROR, err.to_string())- })?;-- comms_db_client::entity_mentions::delete_entity_mentions_by_entity(- &ctx.db,- fetched_attachments_entity_ids,- message_id.to_string(),- )- .await- .map_err(|err| {- tracing::error!(error=?err, "unable to delete entity mentions");- (StatusCode::INTERNAL_SERVER_ERROR, err.to_string())- })?;- }-- if !attachments.is_empty() {- add_attachments::add_attachments_to_message(- &ctx.db,- &message_id,- &channel_id,- attachments.clone(),- )- .await- .map_err(|err| {- tracing::error!(error=?err, "unable to add attachments to message");- (- StatusCode::INTERNAL_SERVER_ERROR,- "unable to add attachments to message".to_string(),- )- })?;- }-- let items_to_share: Vec<(String, String)> = attachments- .iter()- .filter(|a| a.entity_type != "user")- .map(|a| (a.entity_id.clone(), a.entity_type.clone()))- .collect();-- if !items_to_share.is_empty() {- let channel_id_str = channel_id.to_string();- let user_id = user_id.to_owned();- let db = ctx.db.clone();- let entity_access_service = ctx.entity_access_service.clone();- tokio::spawn(async move {- super::post_message::update_channel_share_permissions_for_items(- &db,- &*entity_access_service,- &user_id,- &channel_id_str,- items_to_share,- )- .await;- });- }-- let all_attachments =- comms_db_client::attachments::get_attachments::get_attachments_by_message_id(- &ctx.db, message_id,- )- .await- .map_err(|err| {- tracing::error!(error=?err, "unable to fetch attachments after patch");- (StatusCode::INTERNAL_SERVER_ERROR, err.to_string())- })?;-- notify::notify_attachments(- ctx,- WithNonce {- data: AttachmentData {- channel_id: &channel_id,- message_id: &message_id,- attachments: &all_attachments,- },- nonce,- },- )- .await- .map_err(|err| {- tracing::error!(error=?err, "unable to notify attachments");- (StatusCode::INTERNAL_SERVER_ERROR, err.to_string())- })?;-- patch_message_attachments(&ctx.db, message_id, all_attachments)- .await- .map_err(|err| {- tracing::error!(error=?err, "unable to patch message attachments");- (StatusCode::INTERNAL_SERVER_ERROR, err.to_string())- })?;-- Ok(())-}diff --git a/rust/cloud-storage/comms_service/src/api/channels/post_message.rs b/rust/cloud-storage/comms_service/src/api/channels/post_message.rsdeleted file mode 100644index bc894dded7..0000000000--- a/rust/cloud-storage/comms_service/src/api/channels/post_message.rs+++ /dev/null@@ -1,319 +0,0 @@-use crate::api::context::ChannelImpl;-use crate::api::{context::AppState, extractors::ChannelName};-use crate::channel_permissions;-use crate::notification as comms_notification;-use crate::service::sender::notify::WithNonce;-use crate::{- api::extractors::{ChannelId, ChannelMember, ChannelParticipants, ChannelTypeExtractor},- service::{- self,- sender::notify::{self, AttachmentData},- },-};-use anyhow::Result;-use axum::{- Json,- extract::{self, State},- http::StatusCode,-};-use axum_extra::extract::Cached;-use comms_db_client::model::Message;-use comms_db_client::{- activity::upsert_activity::upsert_activity,- channels::updated_at,- messages::{add_attachments, create_message, create_message_mentions},- model::{ActivityType, NewAttachment, SimpleMention},-};-use doppleganger::Mirror;-use macro_user_id::cowlike::CowLike;-use model::comms::ChannelParticipant;-use model_notifications::CommonChannelMetadata;-use serde::{Deserialize, Serialize};-use sqlx::PgPool;-use std::time::Instant;-use utoipa::ToSchema;-use uuid::Uuid;--#[derive(Debug, Serialize, Deserialize, ToSchema)]-pub struct PostMessageRequest {- pub content: String,- pub mentions: Vec<SimpleMention>,- pub thread_id: Option<Uuid>,- pub attachments: Vec<NewAttachment>,- pub nonce: Option<String>,-}--#[derive(Debug, Serialize, Deserialize, ToSchema)]-pub struct PostMessageResponse {- pub id: String,- pub nonce: Option<String>,-}--#[utoipa::path(- post,- tag = "channels",- operation_id = "post_message",- path = "/comms/channels/{channel_id}/message",- params(- ("channel_id" = String, Path, description = "id of the channel")- ),- responses(- (status = 201, body=PostMessageResponse),- (status = 401, body=String),- (status = 404, body=String),- (status = 500, body=String),- )- )]-#[tracing::instrument(skip(ctx, channel_participants))]-pub async fn post_message_handler(- State(ctx): State<AppState>,- ChannelMember(channel_member): ChannelMember,- Cached(ChannelParticipants(channel_participants)): Cached<ChannelParticipants>,- Cached(ChannelName(channel_name, ..)): Cached<ChannelName<ChannelImpl>>,- Cached(ChannelId(channel_id)): Cached<ChannelId>,- Cached(ChannelTypeExtractor(channel_type)): Cached<ChannelTypeExtractor>,- extract::Json(req): extract::Json<PostMessageRequest>,-) -> Result<(StatusCode, Json<PostMessageResponse>), (StatusCode, String)> {- let mut connection = ctx.db.acquire().await.map_err(|e| {- tracing::error!(error=?e, "unable to acquire connection");- (- StatusCode::INTERNAL_SERVER_ERROR,- "unable to acquire connection".to_string(),- )- })?;-- let message = create_message::create_message(- &mut *connection,- create_message::CreateMessageOptions {- channel_id,- sender_id: channel_member.context.user_id.clone(),- content: req.content.clone(),- thread_id: req.thread_id,- },- )- .await- .map_err(|e| {- tracing::error!(error=?e, "unable to create message");- (- StatusCode::INTERNAL_SERVER_ERROR,- "unable to create message".to_string(),- )- })?;-- updated_at::updated_at(&mut *connection, &message.channel_id)- .await- .inspect_err(|e| {- tracing::error!(error=?e, "unable to update channel updated_at");- })- .ok();-- create_message_mentions::create_message_mentions(- &mut *connection,- create_message_mentions::CreateMessageMentionOptions {- message_id: message.id,- mentions: req.mentions.clone(),- },- )- .await- .map_err(|e| {- tracing::error!(error=?e, "unable to create mentions");- (- StatusCode::INTERNAL_SERVER_ERROR,- "unable to create mentions".to_string(),- )- })- .ok();-- // Update channel share permissions for attachments and mentions- let items_to_share: Vec<(String, String)> = req- .attachments- .iter()- .filter(|a| a.entity_type != "user")- .map(|a| (a.entity_id.clone(), a.entity_type.clone()))- .chain(- req.mentions- .iter()- .filter(|m| m.entity_type != "user")- .map(|m| (m.entity_id.clone(), m.entity_type.clone())),- )- .collect();-- if !items_to_share.is_empty() {- let channel_id_str = channel_id.to_string();- let user_id = message.sender_id.clone();- let db = ctx.db.clone();- let entity_access_service = ctx.entity_access_service.clone();- tokio::spawn(async move {- update_channel_share_permissions_for_items(- &db,- &*entity_access_service,- user_id.0.as_ref(),- &channel_id_str,- items_to_share,- )- .await;- });- }-- let participants: Vec<_> = channel_participants- .iter()- .map(|p| p.user_id.copied())- .collect();-- let start_time = Instant::now();- notify::notify_message(- &ctx,- WithNonce {- data: &message,- nonce: req.nonce.as_deref(),- },- &participants,- )- .await- .map_err(|e| {- tracing::error!(error=?e, "unable to notify message");- (- StatusCode::INTERNAL_SERVER_ERROR,- "failed to deliver message".to_string(),- )- })?;- tracing::debug!("message notification took {:?}ms", start_time.elapsed());-- let start_time = Instant::now();- upsert_activity(- &ctx.db,- &channel_member.context.user_id,- &channel_id,- &ActivityType::Interact,- )- .await- .inspect_err(|err| {- tracing::error!(error=?err, "unable to upsert activity for message");- })- .ok();- tracing::debug!("activity upsert took {:?}ms", start_time.elapsed());-- let has_attachments = !req.attachments.is_empty();- let start_time = Instant::now();- let maybe_attachments = add_attachments::add_attachments_to_message(- &ctx.db,- &message.id,- &channel_id,- req.attachments,- )- .await- .map_err(|err| {- tracing::error!(error=?err, "unable to add attachments to message");- (- StatusCode::INTERNAL_SERVER_ERROR,- "unable to add attachments to message".to_string(),- )- })- .ok();- tracing::debug!("attachments upsert took {:?}ms", start_time.elapsed());-- if let Some(attachments) = maybe_attachments.filter(|attachments| !attachments.is_empty()) {- let start_time = Instant::now();- notify::notify_attachments(- &ctx,- WithNonce {- data: AttachmentData {- channel_id: &channel_id,- message_id: &message.id,- attachments: &attachments,- },- nonce: req.nonce.as_deref(),- },- )- .await- .map_err(|err| {- tracing::error!(error=?err, "failed to notify about attachment");- (- StatusCode::INTERNAL_SERVER_ERROR,- "failed to deliver message".to_string(),- )- })?;- tracing::debug!("attachment notification took {:?}ms", start_time.elapsed());- }-- dispatch_notification_task(- &ctx,- channel_id,- CommonChannelMetadata {- channel_type: model_notifications::ChannelType::mirror(channel_type),- channel_name: channel_name.clone(),- },- <Vec<model::comms::ChannelParticipant>>::mirror(channel_participants),- message.clone(),- req.mentions.clone(),- has_attachments,- );-- service::search::send_channel_message_to_search_extractor_queue(- &ctx.sqs_client,- channel_id,- message.id,- );-- Ok((- StatusCode::OK,- Json(PostMessageResponse {- id: message.id.to_string(),- nonce: req.nonce.clone(),- }),- ))-}--pub fn dispatch_notification_task(- ctx: &AppState,- channel_id: Uuid,- channel_metadata: CommonChannelMetadata,- participants: Vec<ChannelParticipant>,- message: Message,- mentions: Vec<SimpleMention>,- has_attachments: bool,-) {- // Safe to clone, context conains a bunch of Arcs- let api_context = ctx.clone();-- tokio::spawn(async move {- if let Err(e) = comms_notification::dispatch_notifications_for_message(- &api_context,- &channel_id,- channel_metadata,- participants,- message,- mentions,- has_attachments,- )- .await- {- tracing::error!(error = ?e, "Failed to dispatch notifications");- }- });-}--/// Updates channel share permissions for a list of items shared in a message.-pub(super) async fn update_channel_share_permissions_for_items(- db: &PgPool,- entity_access_service: &impl entity_access::domain::ports::EntityAccessService,- user_id: &str,- channel_id: &str,- items: Vec<(String, String)>,-) {- tracing::trace!(items=?items, "updating channel share permissions for items");- for (item_id, item_type) in items {- if let Err(e) = channel_permissions::update_channel_share_permission(- db,- entity_access_service,- user_id,- channel_id,- &item_id,- &item_type,- )- .await- {- tracing::error!(error=?e, "unable to update channel share permission");- }- }-}diff --git a/rust/cloud-storage/comms_service/src/api/channels/post_reaction.rs b/rust/cloud-storage/comms_service/src/api/channels/post_reaction.rsdeleted file mode 100644index 6e10cea201..0000000000--- a/rust/cloud-storage/comms_service/src/api/channels/post_reaction.rs+++ /dev/null@@ -1,139 +0,0 @@-use axum::{- extract::{self, State},- http::StatusCode,-};-use serde::{Deserialize, Serialize};-use utoipa::ToSchema;-use uuid::Uuid;--use crate::{- api::{- context::AppState,- extractors::{ChannelId, ChannelMember},- },- service::sender::notify::{ReactionData, WithNonce, notify_reactions},-};--use comms_db_client::{- activity::upsert_activity::upsert_activity,- model::ActivityType,- reactions::{- add_reaction::add_reaction, get_reactions::get_message_reactions, group_reactions,- remove_reaction::remove_reaction,- },-};--#[derive(Debug, Serialize, Deserialize, ToSchema)]-pub enum ReactionAction {- Add,- Remove,-}--#[derive(Debug, Serialize, Deserialize, ToSchema)]-pub struct PostReactionRequest {- // the reaction emoji in question- pub emoji: String,- // the id of the message that is being reacted to- pub message_id: String,- // wether we are adding or removing the reaction- pub action: ReactionAction,-- // nonce to help optimistic updating on the frontend- pub nonce: Option<String>,-}--#[utoipa::path(- post,- tag = "channels",- operation_id = "post_reaction",- path = "/comms/channels/{channel_id}/reaction",- params(- ("channel_id" = String, Path, description = "id of the channel")- ),- responses(- (status = 201, body=String),- (status = 401, body=String),- (status = 404, body=String),- (status = 500, body=String),- )- )]-#[tracing::instrument(skip(ctx))]-pub async fn post_reaction_handler(- State(ctx): State<AppState>,- ChannelMember(channel_member): ChannelMember,- ChannelId(channel_id): ChannelId,- extract::Json(req): extract::Json<PostReactionRequest>,-) -> Result<(StatusCode, String), (StatusCode, String)> {- let message_id = Uuid::parse_str(&req.message_id).map_err(|err| {- tracing::error!(error=?err, "unable to parse message id");- (StatusCode::BAD_REQUEST, err.to_string())- })?;-- let req_action = match req.action {- ReactionAction::Add => {- add_reaction(- &ctx.db,- message_id,- req.emoji,- channel_member.context.user_id.clone(),- )- .await- }- ReactionAction::Remove => {- remove_reaction(- &ctx.db,- message_id,- req.emoji,- channel_member.context.user_id.clone(),- )- .await- }- };-- let reactions = get_message_reactions(&ctx.db, message_id)- .await- .map_err(|err| {- tracing::error!(error=?err, "unable to get reactions");- (StatusCode::INTERNAL_SERVER_ERROR, err.to_string())- })?;-- let counted_reactions = group_reactions(reactions);-- req_action.map_err(|err| {- tracing::error!(error=?err, "unable to process reaction");- (StatusCode::INTERNAL_SERVER_ERROR, err.to_string())- })?;-- notify_reactions(- &ctx,- WithNonce {- data: ReactionData {- channel_id: &channel_id,- message_id: &message_id,- reactions: &counted_reactions,- },- nonce: req.nonce.as_deref(),- },- )- .await- .map_err(|err| {- tracing::error!(error=?err, "failed to notify about reaction");- (StatusCode::INTERNAL_SERVER_ERROR, err.to_string())- })?;-- tokio::spawn(async move {- upsert_activity(- &ctx.db,- &channel_member.context.user_id,- &channel_id,- &ActivityType::Interact,- )- .await- .inspect_err(|err| {- tracing::error!(error=?err, "unable to upsert activity for message");- })- .ok();- });-- Ok((StatusCode::OK, "Reaction added".to_string()))-}diff --git a/rust/cloud-storage/comms_service/src/api/channels/post_typing.rs b/rust/cloud-storage/comms_service/src/api/channels/post_typing.rsdeleted file mode 100644index 5ec65fbbf9..0000000000--- a/rust/cloud-storage/comms_service/src/api/channels/post_typing.rs+++ /dev/null@@ -1,78 +0,0 @@-use crate::{- api::{- context::AppState,- extractors::{ChannelId, ChannelMember},- },- service::sender::notify::{TypingData, WithNonce, notify_typing},-};--use anyhow::Result;-use axum::extract::{Json, State};-use axum::http::StatusCode;-use comms_db_client::model::TypingAction;-use serde::{Deserialize, Serialize};-use utoipa::ToSchema;-use uuid::Uuid;--#[derive(Debug, Serialize, Deserialize, ToSchema)]-pub struct PostTypingRequest {- pub action: TypingAction,- pub thread_id: Option<String>,- pub nonce: Option<String>,-}--#[utoipa::path(- post,- tag = "channels",- operation_id = "post_typing",- path = "/comms/channels/{channel_id}/typing",- params(- ("channel_id" = String, Path, description = "id of the channel")- ),- responses(- (status = 201, body=String),- (status = 401, body=String),- (status = 404, body=String),- (status = 500, body=String),- )- )]-#[tracing::instrument(skip(app_state))]-pub async fn post_typing_handler(- State(app_state): State<AppState>,- ChannelMember(channel_member): ChannelMember,- ChannelId(channel_id): ChannelId,- Json(req): Json<PostTypingRequest>,-) -> Result<(StatusCode, String), (StatusCode, String)> {- let thread_id = req- .thread_id- .map(|id| {- Uuid::parse_str(&id).map_err(|err| {- tracing::error!("unable to parse thread id: {:?}", err);- (StatusCode::BAD_REQUEST, err.to_string())- })- })- .transpose()?;-- notify_typing(- &app_state,- WithNonce {- data: TypingData {- channel_id: &channel_id,- user_id: &channel_member.context.user_id,- action: req.action,- thread_id: thread_id.as_ref(),- },- nonce: req.nonce.as_deref(),- },- )- .await- .map_err(|e| {- tracing::error!(error=?e, "unable to notify message");- (- StatusCode::INTERNAL_SERVER_ERROR,- "failed to deliver message".to_string(),- )- })?;-- Ok((StatusCode::OK, "message sent".to_string()))-}diff --git a/rust/cloud-storage/comms_service/src/api/channels/remove_participants.rs b/rust/cloud-storage/comms_service/src/api/channels/remove_participants.rsdeleted file mode 100644index 04efbeef8c..0000000000--- a/rust/cloud-storage/comms_service/src/api/channels/remove_participants.rs+++ /dev/null@@ -1,69 +0,0 @@-use crate::api::context::AppState;-use crate::api::extractors::{ChannelId, ChannelMember, ChannelTypeExtractor};-use anyhow::Result;-use axum::extract::Json;-use axum::{extract::State, http::StatusCode};-use axum_extra::extract::Cached;-use comms_db_client::participants::remove_participant::{- RemoveParticipantOptions, remove_participant,-};-use serde::{Deserialize, Serialize};-use utoipa::ToSchema;--#[derive(Deserialize, Serialize, ToSchema, Debug)]-pub struct RemoveParticipantsRequest {- participants: Vec<String>,-}--#[utoipa::path(- delete,- tag = "channels",- operation_id = "remove_participants",- description = "removes a list of participants from the channel, user must be a participant",- path = "/comms/channels/{channel_id}/participants",- params(- ("channel_id" = String, Path, description = "channel id"),- ),- responses(- (status = 200),- (status = 401, body=String),- (status = 404, body=String),- (status = 500, body=String),- )-)]-#[tracing::instrument(skip(ctx))]-pub async fn handler(- State(ctx): State<AppState>,- ChannelMember(_channel_member): ChannelMember,- Cached(ChannelTypeExtractor(channel_type)): Cached<ChannelTypeExtractor>,- Cached(ChannelId(channel_id)): Cached<ChannelId>,- req: Json<RemoveParticipantsRequest>,-) -> Result<StatusCode, (StatusCode, String)> {- if let models_comms::channel::ChannelType::DirectMessage = channel_type {- tracing::error!("cannot add or remove participants from direct message channel");- return Err((- StatusCode::BAD_REQUEST,- "cannot add or remove participants from direct message channel".to_string(),- ));- }-- for participant in req.participants.iter() {- remove_participant(- &ctx.db,- RemoveParticipantOptions {- channel_id: &channel_id,- user_id: participant.as_str(),- },- )- .await- .map_err(|e| {- tracing::error!(error=?e, "unable to remove participant from channel");- (- StatusCode::INTERNAL_SERVER_ERROR,- "unable to remove participant from channel".to_string(),- )- })?;- }-- Ok(StatusCode::OK)-}diff --git a/rust/cloud-storage/comms_service/src/api/context.rs b/rust/cloud-storage/comms_service/src/api/context.rsdeleted file mode 100644index 0006b43112..0000000000--- a/rust/cloud-storage/comms_service/src/api/context.rs+++ /dev/null@@ -1,43 +0,0 @@-use axum_macros::FromRef;-use comms::{- domain::service::ChannelServiceImpl,- inbound::router::CommsRouterState,- outbound::postgres::{comms_repo::PgCommsRepo, user_repo::PgUserRepo},-};-use connection_gateway_client::client::ConnectionGatewayClient;-use contacts::domain::service::SqsContactsIngress;-use contacts::outbound::ingress::SqsContactsQueue;-use entity_access::domain::service::EntityAccessServiceImpl;-use entity_access::outbound::PgAccessRepository;-use frecency::outbound::postgres::FrecencyPgStorage;-use macro_auth::middleware::decode_jwt::JwtValidationArgs;-use macro_env_var::env_var;-use notification_hex::domain::service::SqsNotificationIngress;-use notification_hex::outbound::queue::SqsQueue;-use secretsmanager_client::LocalOrRemoteSecret;-use sqlx::PgPool;-use std::sync::Arc;--pub type NotificationIngressType = SqsNotificationIngress<SqsQueue>;-pub type EntityAccessServiceType = EntityAccessServiceImpl<PgAccessRepository>;--env_var! {- #[derive(Clone)]- pub struct DocumentPermissionJwtSecretKey;-}--#[derive(Clone, FromRef)]-pub struct AppState {- pub jwt_validation_args: JwtValidationArgs,- pub db: PgPool,- pub connection_gateway_client: Arc<ConnectionGatewayClient>,- pub notification_ingress_service: Arc<NotificationIngressType>,- pub sqs_client: Arc<sqs_client::SQS>,- pub contacts_ingress: Arc<SqsContactsIngress<SqsContactsQueue>>,- pub permissions_token_secret: LocalOrRemoteSecret<DocumentPermissionJwtSecretKey>,- pub frecency_storage: FrecencyPgStorage,- pub comms_state: CommsRouterState<ChannelImpl>,- pub entity_access_service: Arc<EntityAccessServiceType>,-}--pub type ChannelImpl = ChannelServiceImpl<PgCommsRepo, PgUserRepo, FrecencyPgStorage>;diff --git a/rust/cloud-storage/comms_service/src/api/extractors.rs b/rust/cloud-storage/comms_service/src/api/extractors.rsdeleted file mode 100644index 2099f70ed9..0000000000--- a/rust/cloud-storage/comms_service/src/api/extractors.rs+++ /dev/null@@ -1,485 +0,0 @@-use axum::{- RequestPartsExt,- extract::{FromRef, FromRequestParts, Path},- http::{StatusCode, request::Parts},- response::{IntoResponse, Response},-};-use axum_extra::extract::Cached;-use comms::{- domain::{models::channel_name::resolve_channel_name, ports::ChannelsService},- inbound::router::CommsRouterState,-};-use comms_db_client::{- channels::get_channel_info::{ChannelInfo, get_channel_info},- messages::get_message_owner::get_message_owner,- participants::get_participants::get_participants,-};-use doppleganger::Mirror;-use macro_user_id::{cowlike::CowLike, user_id::MacroUserIdStr};-use model::{- comms::ParticipantRole,- user::{UserContext, axum_extractor::MacroUserExtractor},-};-use models_comms::channel::ChannelType;-use serde::{Deserialize, Serialize};-use sqlx::PgPool;-use std::{- collections::{HashMap, HashSet},- marker::PhantomData,-};-use utoipa::ToSchema;-use uuid::Uuid;--#[derive(Serialize, Deserialize, Debug)]-pub struct ChannelName<T>(pub String, pub PhantomData<T>);--impl<T> Clone for ChannelName<T> {- fn clone(&self) -> Self {- Self(self.0.clone(), PhantomData)- }-}--#[derive(Serialize, Deserialize, Clone, Debug)]-pub struct ChannelId(pub Uuid);--#[derive(Deserialize, Clone, Debug)]-pub struct ChannelParticipants(pub Vec<models_comms::channel::ChannelParticipant>);--#[derive(Debug, Clone, Copy)]-pub struct ChannelTypeExtractor(pub ChannelType);--#[derive(Serialize, Deserialize, Clone, Debug, ToSchema)]-pub enum ParticipantAccess {- Access { role: ParticipantRole },- NoAccess,-}--pub async fn extract_path_uuid_by_name(parts: &mut Parts, name: &str) -> Result<Uuid, Response> {- let Path(params): Path<HashMap<String, String>> = Path::from_request_parts(parts, &())- .await- .map_err(|_| (StatusCode::BAD_REQUEST, "Invalid path parameters").into_response())?;-- let param_str = params.get(name).ok_or_else(|| {- (- StatusCode::BAD_REQUEST,- format!("Missing {} parameter", name),- )- .into_response()- })?;-- Uuid::parse_str(param_str).map_err(|err| {- tracing::error!("Failed to parse {} as UUID: {}", name, err);- (StatusCode::BAD_REQUEST, format!("Invalid {} format", name)).into_response()- })-}--async fn extract_cached<T, S>(parts: &mut Parts, state: &S) -> Result<T, Response>-where- T: 'static,- Cached<T>: FromRequestParts<S>,- S: Send + Sync,-{- Cached::<T>::from_request_parts(parts, state)- .await- .map(|Cached(val)| val)- .map_err(|e| e.into_response())-}--fn unauthorized(msg: &'static str) -> Response {- (StatusCode::UNAUTHORIZED, msg).into_response()-}--impl<S> FromRequestParts<S> for ChannelId-where- S: Send + Sync,-{- type Rejection = Response;-- async fn from_request_parts(parts: &mut Parts, _state: &S) -> Result<Self, Self::Rejection> {- const CHANNEL_ID: &str = "channel_id";- let id = extract_path_uuid_by_name(parts, CHANNEL_ID).await?;- Ok(ChannelId(id))- }-}--impl<S> FromRequestParts<S> for ChannelParticipants-where- S: Send + Sync,- PgPool: FromRef<S>,-{- type Rejection = Response;-- async fn from_request_parts(parts: &mut Parts, state: &S) -> Result<Self, Self::Rejection> {- let db = PgPool::from_ref(state);- let Cached(ChannelId(channel_id)) =- Cached::<ChannelId>::from_request_parts(parts, state).await?;-- let participants = get_participants(&db, &channel_id).await.map_err(|err| {- tracing::error!(- "Failed to get participants for channel {:?}: {}",- channel_id,- err- );- (- StatusCode::INTERNAL_SERVER_ERROR,- "Failed to get participants",- )- .into_response()- })?;-- Ok(ChannelParticipants(participants))- }-}--#[derive(Clone)]-pub struct ChannelInfoExtractor(pub ChannelInfo);--impl<S> FromRequestParts<S> for ChannelInfoExtractor-where- S: Send + Sync,- PgPool: FromRef<S>,-{- type Rejection = Response;-- async fn from_request_parts(parts: &mut Parts, state: &S) -> Result<Self, Self::Rejection> {- let db = PgPool::from_ref(state);- let Cached(ChannelId(channel_id)) =- Cached::<ChannelId>::from_request_parts(parts, &()).await?;-- let info = get_channel_info(&db, &channel_id).await.map_err(|err| {- tracing::error!(error=?err, "unable to get channel info");- (StatusCode::INTERNAL_SERVER_ERROR, err.to_string()).into_response()- })?;-- Ok(ChannelInfoExtractor(info))- }-}--impl<S, U> FromRequestParts<S> for ChannelName<U>-where- S: Send + Sync,- PgPool: FromRef<S>,- CommsRouterState<U>: FromRef<S>,- U: ChannelsService,-{- type Rejection = Response;-- async fn from_request_parts(parts: &mut Parts, state: &S) -> Result<Self, Self::Rejection> {- let ChannelId(channel_id) = extract_cached::<ChannelId, _>(parts, state).await?;- let ChannelTypeExtractor(channel_type) =- extract_cached::<ChannelTypeExtractor, _>(parts, state).await?;- let ChannelParticipants(participants) =- extract_cached::<ChannelParticipants, _>(parts, state).await?;- let MacroUserExtractor { macro_user_id, .. } =- parts.extract().await.map_err(IntoResponse::into_response)?;-- let ChannelInfoExtractor(ChannelInfo { name, .. }) =- extract_cached::<ChannelInfoExtractor, _>(parts, state).await?;-- let user_ids = participants- .iter()- .map(|p| p.user_id.copied())- .collect::<HashSet<_>>();-- let service = <CommsRouterState<U>>::from_ref(state);- let name_lookup = service- .inner- .get_names(user_ids)- .await- .ok()- .map(|names| {- names- .into_iter()- .filter_map(|n| {- let display = n.display_name()?;- Some((n.id, display))- })- .collect::<HashMap<_, _>>()- })- .unwrap_or_default();-- let channel_name = resolve_channel_name(- &channel_type,- name.as_deref(),- &participants,- &models_comms::channel::ChannelId(channel_id),- macro_user_id,- &name_lookup,- );-- Ok(ChannelName(channel_name, PhantomData))- }-}--impl<S> FromRequestParts<S> for ChannelTypeExtractor-where- S: Send + Sync,- PgPool: FromRef<S>,-{- type Rejection = Response;-- async fn from_request_parts(parts: &mut Parts, state: &S) -> Result<Self, Self::Rejection> {- let db = PgPool::from_ref(state);- let ChannelId(channel_id) = extract_cached::<ChannelId, _>(parts, state).await?;-- let info = get_channel_info(&db, &channel_id).await.map_err(|err| {- tracing::error!(- "Failed to get channel info for channel {:?}: {}",- channel_id,- err- );- (- StatusCode::INTERNAL_SERVER_ERROR,- "Failed to get channel info",- )- .into_response()- })?;-- Ok(ChannelTypeExtractor(match info.channel_type {- model::comms::ChannelType::Public => models_comms::channel::ChannelType::Public,- model::comms::ChannelType::Organization => {- models_comms::channel::ChannelType::Organization- }- model::comms::ChannelType::Private => models_comms::channel::ChannelType::Private,- model::comms::ChannelType::DirectMessage => {- models_comms::channel::ChannelType::DirectMessage- }- model::comms::ChannelType::Team => models_comms::channel::ChannelType::Team,- }))- }-}--#[derive(Clone, Debug)]-pub struct UserContextWithRole {- pub context: UserContext,- pub user_id: MacroUserIdStr<'static>,- pub role: Option<models_comms::channel::ParticipantRole>,-}--pub async fn get_user_role(- user_context: &UserContext,- info: &ChannelInfo,- participants: &[models_comms::channel::ChannelParticipant],-) -> Option<models_comms::channel::ParticipantRole> {- let user_participant = participants- .iter()- .find(|p| p.user_id.as_ref() == user_context.user_id);-- match info.channel_type {- model::comms::ChannelType::Public => Some(- user_participant- .map(|p| p.role)- .unwrap_or(models_comms::channel::ParticipantRole::Member),- ),- model::comms::ChannelType::Organization => {- let org_match = user_context- .organization_id- .and_then(|user_org| info.org_id.map(|ch_org| ch_org == user_org as i64))- .unwrap_or(false);-- if org_match {- Some(- user_participant- .map(|p| p.role)- .unwrap_or(models_comms::channel::ParticipantRole::Member),- )- } else {- user_participant.map(|p| p.role)- }- }- _ => user_participant.map(|p| p.role),- }-}--impl<S> FromRequestParts<S> for UserContextWithRole-where- S: Send + Sync,- PgPool: FromRef<S>,-{- type Rejection = Response;-- async fn from_request_parts(parts: &mut Parts, state: &S) -> Result<Self, Self::Rejection> {- let Cached(ChannelId(channel_id)) =- Cached::<ChannelId>::from_request_parts(parts, state).await?;-- let Cached(ChannelParticipants(participants)) =- Cached::<ChannelParticipants>::from_request_parts(parts, state).await?;-- let MacroUserExtractor {- macro_user_id,- user_context,- ..- } = parts.extract().await.map_err(IntoResponse::into_response)?;- let info = get_channel_info(&PgPool::from_ref(state), &channel_id)- .await- .map_err(|err| {- tracing::error!(error=?err, "Failed to get channel info for channel {:?}", channel_id);- (- StatusCode::INTERNAL_SERVER_ERROR,- "Failed to get channel info",- ).into_response()- })?;-- let role = get_user_role(&user_context, &info, &participants).await;- Ok(UserContextWithRole {- context: user_context,- user_id: macro_user_id,- role,- })- }-}--#[derive(Clone, Debug)]-pub struct ChannelMember(pub UserContextWithRole);--impl<S> FromRequestParts<S> for ChannelMember-where- S: Send + Sync,- PgPool: FromRef<S>,-{- type Rejection = Response;-- async fn from_request_parts(parts: &mut Parts, state: &S) -> Result<Self, Self::Rejection> {- let user_context_with_role = UserContextWithRole::from_request_parts(parts, state).await?;-- match user_context_with_role.role {- Some(_) => Ok(ChannelMember(user_context_with_role)),- _ => Err(unauthorized("user is not authorized to view this channel")),- }- }-}--#[derive(Clone, Debug)]-pub struct ChannelOwner(pub UserContextWithRole);--impl<S> FromRequestParts<S> for ChannelOwner-where- S: Send + Sync,- PgPool: FromRef<S>,-{- type Rejection = Response;-- async fn from_request_parts(parts: &mut Parts, state: &S) -> Result<Self, Self::Rejection> {- let user_context_with_role = UserContextWithRole::from_request_parts(parts, state).await?;-- match user_context_with_role.role {- Some(models_comms::channel::ParticipantRole::Owner) => {- Ok(ChannelOwner(user_context_with_role))- }- _ => Err(unauthorized("user is not authorized to view this channel")),- }- }-}--#[derive(Clone, Debug)]-#[allow(dead_code)]-pub struct ChannelAdmin(pub UserContextWithRole);--impl<S> FromRequestParts<S> for ChannelAdmin-where- S: Send + Sync,- PgPool: FromRef<S>,-{- type Rejection = Response;-- async fn from_request_parts(parts: &mut Parts, state: &S) -> Result<Self, Self::Rejection> {- let user_context_with_role = UserContextWithRole::from_request_parts(parts, state).await?;-- match user_context_with_role.role {- Some(- models_comms::channel::ParticipantRole::Owner- | models_comms::channel::ParticipantRole::Admin,- ) => Ok(ChannelAdmin(user_context_with_role)),- _ => Err(unauthorized("user is not authorized to view this channel")),- }- }-}--#[derive(Serialize, Deserialize, Clone, Debug)]-pub struct MessageId(pub Uuid);--impl<S> FromRequestParts<S> for MessageId-where- S: Send + Sync,-{- type Rejection = Response;-- async fn from_request_parts(parts: &mut Parts, _state: &S) -> Result<Self, Self::Rejection> {- const MESSAGE_ID: &str = "message_id";- let id = extract_path_uuid_by_name(parts, MESSAGE_ID).await?;- Ok(MessageId(id))- }-}--#[derive(Serialize, Deserialize, Clone, Debug)]-pub struct MessageSender(pub UserContext);--impl<S> FromRequestParts<S> for MessageSender-where- S: Send + Sync,- PgPool: FromRef<S>,-{- type Rejection = Response;-- async fn from_request_parts(parts: &mut Parts, state: &S) -> Result<Self, Self::Rejection> {- let user_context_with_role = extract_cached::<UserContextWithRole, _>(parts, state).await?;- let MessageId(message_id) = extract_cached::<MessageId, _>(parts, state).await?;-- let message_owner = get_message_owner(&PgPool::from_ref(state), &message_id)- .await- .map_err(|err| {- tracing::error!(error=?err, "unable to get message owner");- (StatusCode::INTERNAL_SERVER_ERROR, err.to_string()).into_response()- })?;-- match user_context_with_role.role {- Some(_) if message_owner == user_context_with_role.context.user_id => {- Ok(MessageSender(user_context_with_role.context.clone()))- }- _ => Err(unauthorized("user is not authorized to view this channel")),- }- }-}--#[derive(Clone, Debug)]-pub enum MessageSenderOrAdmin {- MessageSender(MessageSender),- ChannelAdmin(ChannelAdmin),-}--impl<S> FromRequestParts<S> for MessageSenderOrAdmin-where- S: Send + Sync,- PgPool: FromRef<S>,-{- type Rejection = Response;-- async fn from_request_parts(parts: &mut Parts, state: &S) -> Result<Self, Self::Rejection> {- if let Ok(sender) = extract_cached::<MessageSender, _>(parts, state).await {- return Ok(Self::MessageSender(sender));- }-- extract_cached::<ChannelAdmin, _>(parts, state)- .await- .map(Self::ChannelAdmin)- }-}--impl<S> FromRequestParts<S> for ParticipantAccess-where- S: Send + Sync,- PgPool: FromRef<S>,-{- type Rejection = Response;-- async fn from_request_parts(parts: &mut Parts, state: &S) -> Result<Self, Self::Rejection> {- let user_context_with_role = extract_cached::<UserContextWithRole, _>(parts, state).await?;-- match user_context_with_role.role {- Some(role) => Ok(ParticipantAccess::Access {- role: ParticipantRole::mirror(role),- }),- _ => Ok(ParticipantAccess::NoAccess),- }- }-}diff --git a/rust/cloud-storage/comms_service/src/api/mentions/create_mention.rs b/rust/cloud-storage/comms_service/src/api/mentions/create_mention.rsdeleted file mode 100644index 61f10b81cd..0000000000--- a/rust/cloud-storage/comms_service/src/api/mentions/create_mention.rs+++ /dev/null@@ -1,96 +0,0 @@-use crate::api::context::DocumentPermissionJwtSecretKey;-use axum::{- Extension, Json,- extract::State,- http::{HeaderMap, StatusCode},- response::{IntoResponse, Response},-};-use axum_macros::debug_handler;-use comms_db_client::entity_mentions::create_entity_mention::{- CreateEntityMentionOptions, create_entity_mention,-};-use model::user::UserContext;-use secretsmanager_client::LocalOrRemoteSecret;-use serde::{Deserialize, Serialize};-use sqlx::PgPool;-use utoipa::ToSchema;--use super::mentions_middleware::validate_mention_edit_permission;--#[derive(Debug, Clone, Serialize, Deserialize, ToSchema)]-pub struct CreateEntityMentionRequest {- pub source_entity_type: String,- pub source_entity_id: String,- pub entity_type: String,- pub entity_id: String,-}--#[derive(Debug, Clone, Serialize, Deserialize, ToSchema)]-pub struct CreateEntityMentionResponse {- pub id: String,- pub source_entity_type: String,- pub source_entity_id: String,- pub entity_type: String,- pub entity_id: String,- pub user_id: Option<String>,- pub created_at: chrono::DateTime<chrono::Utc>,-}--#[utoipa::path(- post,- path = "/comms/mentions",- request_body = CreateEntityMentionRequest,- responses(- (status = 201, description = "Entity mention created successfully", body = CreateEntityMentionResponse),- (status = 400, description = "Invalid request parameters"),- (status = 500, description = "Internal server error")- ),- tag = "mentions"-)]-#[tracing::instrument(skip(db, config, user_context))]-#[debug_handler(state = crate::api::context::AppState)]-pub async fn create_mention_handler(- State(db): State<PgPool>,- State(config): State<LocalOrRemoteSecret<DocumentPermissionJwtSecretKey>>,- Extension(user_context): Extension<UserContext>,- headers: HeaderMap,- Json(data): Json<CreateEntityMentionRequest>,-) -> Result<Response, Response> {- validate_mention_edit_permission(- &headers,- config,- &data.source_entity_type,- &data.source_entity_id,- )- .await?;-- let entity_mention = create_entity_mention(- &db,- CreateEntityMentionOptions {- source_entity_type: data.source_entity_type,- source_entity_id: data.source_entity_id,- entity_type: data.entity_type,- entity_id: data.entity_id,- user_id: Some(user_context.user_id.clone()),- },- )- .await- .map_err(|e| {- tracing::error!("Failed to create entity mention: {:?}", e);- (StatusCode::INTERNAL_SERVER_ERROR).into_response()- })?;-- Ok((- StatusCode::CREATED,- Json(CreateEntityMentionResponse {- id: entity_mention.id.to_string(),- source_entity_type: entity_mention.source_entity_type,- source_entity_id: entity_mention.source_entity_id,- entity_type: entity_mention.entity_type,- entity_id: entity_mention.entity_id,- user_id: entity_mention.user_id,- created_at: entity_mention.created_at,- }),- )- .into_response())-}diff --git a/rust/cloud-storage/comms_service/src/api/mentions/delete_mention.rs b/rust/cloud-storage/comms_service/src/api/mentions/delete_mention.rsdeleted file mode 100644index b1b03045db..0000000000--- a/rust/cloud-storage/comms_service/src/api/mentions/delete_mention.rs+++ /dev/null@@ -1,88 +0,0 @@-use crate::api::context::DocumentPermissionJwtSecretKey;-use axum::{- Json,- extract::State,- http::{HeaderMap, StatusCode},- response::{IntoResponse, Response},-};-use comms_db_client::entity_mentions::{- delete_entity_mention_by_id::delete_entity_mention_by_id,- get_entity_mention_by_id::get_entity_mention_by_id,-};-use secretsmanager_client::LocalOrRemoteSecret;-use serde::{Deserialize, Serialize};-use sqlx::PgPool;-use utoipa::ToSchema;-use uuid::Uuid;--use super::mentions_middleware::validate_mention_edit_permission;--#[derive(Debug, Clone, Serialize, Deserialize, ToSchema)]-pub struct DeleteEntityMentionRequest {- pub entity_mention_id: String,-}--#[derive(Debug, Clone, Serialize, Deserialize, ToSchema)]-pub struct DeleteEntityMentionResponse {- pub deleted: bool,-}--#[utoipa::path(- delete,- path = "/comms/mentions/{mention_id}",- params(- ("mention_id" = String, Path, description = "UUID of the entity mention to delete")- ),- responses(- (status = 200, description = "Entity mention deleted successfully", body = DeleteEntityMentionResponse),- (status = 400, description = "Invalid request parameters"),- (status = 403, description = "Insufficient permissions"),- (status = 404, description = "Entity mention not found"),- (status = 500, description = "Internal server error")- ),- tag = "mentions"-)]-#[tracing::instrument(skip(db, secret))]-pub async fn delete_mention_handler(- State(db): State<PgPool>,- State(secret): State<LocalOrRemoteSecret<DocumentPermissionJwtSecretKey>>,-- headers: HeaderMap,- axum::extract::Path(entity_mention_id): axum::extract::Path<String>,-) -> Result<Response, Response> {- let mention_id = Uuid::parse_str(&entity_mention_id)- .map_err(|_| (StatusCode::BAD_REQUEST, "invalid entity mention ID").into_response())?;-- let entity_mention = get_entity_mention_by_id(&db, mention_id)- .await- .map_err(|e| {- tracing::error!("Failed to fetch entity mention: {:?}", e);- (StatusCode::INTERNAL_SERVER_ERROR).into_response()- })?- .ok_or_else(|| (StatusCode::NOT_FOUND, "entity mention not found").into_response())?;-- validate_mention_edit_permission(- &headers,- secret,- &entity_mention.source_entity_type,- &entity_mention.source_entity_id,- )- .await?;-- let deleted = delete_entity_mention_by_id(&db, mention_id)- .await- .map_err(|e| {- tracing::error!("Failed to delete entity mention: {:?}", e);- (StatusCode::INTERNAL_SERVER_ERROR).into_response()- })?;-- if !deleted {- return Err(StatusCode::NOT_FOUND.into_response());- }-- Ok((- StatusCode::OK,- Json(DeleteEntityMentionResponse { deleted }),- )- .into_response())-}diff --git a/rust/cloud-storage/comms_service/src/api/mentions/mentions_middleware.rs b/rust/cloud-storage/comms_service/src/api/mentions/mentions_middleware.rsdeleted file mode 100644index 16c6cdef7b..0000000000--- a/rust/cloud-storage/comms_service/src/api/mentions/mentions_middleware.rs+++ /dev/null@@ -1,50 +0,0 @@-use crate::{- api::{context::DocumentPermissionJwtSecretKey, middleware::validate_edit_document_permission},- constants,-};-use axum::{- http::{HeaderMap, StatusCode},- response::{IntoResponse, Response},-};-use secretsmanager_client::LocalOrRemoteSecret;--/// Validate user permissions based on the `x-permissions-token` header.-/// Checks that the souce type is `document` and that the user has edit access to the document.-pub async fn validate_mention_edit_permission(- headers: &HeaderMap,- permissions_token_secret: LocalOrRemoteSecret<DocumentPermissionJwtSecretKey>,- source_entity_type: &str,- source_entity_id: &str,-) -> Result<(), Response> {- if source_entity_type == "document" {- let token = headers- .get(constants::MACRO_PERMISSIONS_TOKEN_HEADER_KEY)- .and_then(|header| header.to_str().ok())- .ok_or_else(|| {- tracing::error!("missing x-permissions-token header");- (- StatusCode::UNAUTHORIZED,- "missing required authentication header",- )- .into_response()- })?;-- validate_edit_document_permission(- token,- source_entity_id,- permissions_token_secret.as_ref(),- )- .map_err(|err| {- tracing::error!(error=?err, "permission validation failed");- (- StatusCode::FORBIDDEN,- "insufficient permissions: edit access required",- )- .into_response()- })?;- } else {- return Err((StatusCode::BAD_REQUEST, "invalid source entity type").into_response());- }-- Ok(())-}diff --git a/rust/cloud-storage/comms_service/src/api/mentions/mod.rs b/rust/cloud-storage/comms_service/src/api/mentions/mod.rsdeleted file mode 100644index 91f39ebedd..0000000000--- a/rust/cloud-storage/comms_service/src/api/mentions/mod.rs+++ /dev/null@@ -1,20 +0,0 @@-use crate::api::context::AppState;-use axum::{- Router,- routing::{delete, post},-};-pub use create_mention::{- CreateEntityMentionRequest, CreateEntityMentionResponse, create_mention_handler,-};-pub use delete_mention::{- DeleteEntityMentionRequest, DeleteEntityMentionResponse, delete_mention_handler,-};-pub mod create_mention;-pub mod delete_mention;-mod mentions_middleware;--pub fn router() -> Router<AppState> {- Router::new()- .route("/", post(create_mention_handler))- .route("/{mention_id}", delete(delete_mention_handler))-}diff --git a/rust/cloud-storage/comms_service/src/api/middleware/mod.rs b/rust/cloud-storage/comms_service/src/api/middleware/mod.rsdeleted file mode 100644index d3d44bfa09..0000000000--- a/rust/cloud-storage/comms_service/src/api/middleware/mod.rs+++ /dev/null@@ -1,6 +0,0 @@-mod permissions_token;-mod renamed_middleware {- pub use macro_middleware::auth::decode_jwt::handler as decode_jwt;-}-pub use permissions_token::{AuthToken, decode_validate_jwt, validate_edit_document_permission};-pub use renamed_middleware::decode_jwt;diff --git a/rust/cloud-storage/comms_service/src/api/middleware/permissions_token.rs b/rust/cloud-storage/comms_service/src/api/middleware/permissions_token.rsdeleted file mode 100644index 5f7a8fe267..0000000000--- a/rust/cloud-storage/comms_service/src/api/middleware/permissions_token.rs+++ /dev/null@@ -1,37 +0,0 @@-use jsonwebtoken::{Algorithm, DecodingKey, Validation, decode};-use models_permissions::share_permission::access_level::AccessLevel;-use serde::Deserialize;--#[derive(Deserialize, Debug)]-pub struct AuthToken {- #[allow(unused)]- pub user_id: Option<String>,- pub document_id: String,- pub access_level: AccessLevel,-}--pub fn decode_validate_jwt(token: &str, secret_key: &str) -> anyhow::Result<AuthToken> {- let validation = Validation::new(Algorithm::HS256);- let key = DecodingKey::from_secret(secret_key.to_string().as_bytes());- Ok(decode::<AuthToken>(token, &key, &validation)?.claims)-}--/// Validates document permission for a specific operation requiring edit access-pub fn validate_edit_document_permission(- token: &str,- document_id: &str,- secret_key: &str,-) -> Result<(), anyhow::Error> {- let decoded = decode_validate_jwt(token, secret_key)?;-- // Validate token is for this document- if decoded.document_id != document_id {- anyhow::bail!("Document ID mismatch in token");- }-- // Check permission level - require Edit or Admin access- match decoded.access_level {- AccessLevel::Edit | AccessLevel::Owner => Ok(()),- _ => anyhow::bail!("Insufficient permissions: Edit access required"),- }-}diff --git a/rust/cloud-storage/comms_service/src/api/mod.rs b/rust/cloud-storage/comms_service/src/api/mod.rsdeleted file mode 100644index 4921454d85..0000000000--- a/rust/cloud-storage/comms_service/src/api/mod.rs+++ /dev/null@@ -1,30 +0,0 @@-use crate::api::{activity::post_activity, context::AppState};-use axum::{Router, routing::post};-use utoipa::OpenApi;-use utoipa_swagger_ui::SwaggerUi;--pub mod activity;-pub mod attachments;-pub mod channels;-pub mod context;-pub mod extractors;-pub mod mentions;-pub mod middleware;-pub mod preview;-pub mod swagger;--/// Creates the public comms router.-/// This router contains all public-facing comms endpoints.-/// It does NOT include JWT decoding middleware - that should be applied by the host service.-pub fn router(app_state: &AppState) -> Router<AppState> {- Router::new()- .merge(comms::inbound::router::comms_router(- app_state.comms_state.clone(),- ))- .route("/activity", post(post_activity::post_activity_handler))- .nest("/channels", channels::router())- .nest("/preview", preview::router())- .nest("/attachments", attachments::router())- .nest("/mentions", mentions::router())- .merge(SwaggerUi::new("/docs").url("/api-doc/openapi.json", swagger::ApiDoc::openapi()))-}diff --git a/rust/cloud-storage/comms_service/src/api/preview/get_batch_preview.rs b/rust/cloud-storage/comms_service/src/api/preview/get_batch_preview.rsdeleted file mode 100644index 4e97de5fcf..0000000000--- a/rust/cloud-storage/comms_service/src/api/preview/get_batch_preview.rs+++ /dev/null@@ -1,70 +0,0 @@-use crate::utils::previews::resolve_previews;-use anyhow::Result;-use axum::extract::Json;-use axum::extract::State;-use axum::response::{IntoResponse, Response};-use comms_db_client::model::ChannelPreview;-use model::response::{GenericErrorResponse, GenericResponse};-use model::user::axum_extractor::MacroUserExtractor;-use reqwest::StatusCode;-use serde::{Deserialize, Serialize};-use sqlx::PgPool;-use utoipa::ToSchema;--#[derive(Debug, Serialize, Deserialize, ToSchema)]-pub struct GetBatchChannelPreviewRequest {- pub channel_ids: Vec<String>,-}--#[derive(Debug, Serialize, Deserialize, ToSchema)]-pub struct GetBatchChannelPreviewResponse {- pub previews: Vec<ChannelPreview>,-}--#[tracing::instrument(skip(db, user_context, req), fields(user_id=?user_context.user_id))]-#[utoipa::path(- post,- tag = "preview",- operation_id="get_batch_channel_preview",- path = "/comms/preview",- responses(- (status = 200, body=GetBatchChannelPreviewResponse),- (status = 401, body=GenericErrorResponse),- (status = 404, body=GenericErrorResponse),- (status = 500, body=GenericErrorResponse),- )-)]-pub async fn handler(- State(db): State<PgPool>,- MacroUserExtractor {- macro_user_id,- user_context,- ..- }: MacroUserExtractor,- Json(req): Json<GetBatchChannelPreviewRequest>,-) -> Result<(StatusCode, Json<GetBatchChannelPreviewResponse>), Response> {- let raw_previews = comms_db_client::preview::batch_get_channel_preview(- &db,- &req.channel_ids,- macro_user_id.as_ref(),- user_context.organization_id.map(|org_id| org_id as i64),- )- .await- .map_err(|err| {- tracing::error!(error=?err, "unable to get channel preview");- GenericResponse::builder()- .message("failed to retrive channel previews")- .is_error(true)- .send(StatusCode::INTERNAL_SERVER_ERROR)- .into_response()- })?;-- // TODO: if previews include direct messages or private group chats, generate lookup table- // somehow- let previews = resolve_previews(macro_user_id, raw_previews, &Default::default());-- Ok((- StatusCode::OK,- Json(GetBatchChannelPreviewResponse { previews }),- ))-}diff --git a/rust/cloud-storage/comms_service/src/api/preview/mod.rs b/rust/cloud-storage/comms_service/src/api/preview/mod.rsdeleted file mode 100644index c80654924f..0000000000--- a/rust/cloud-storage/comms_service/src/api/preview/mod.rs+++ /dev/null@@ -1,8 +0,0 @@-pub mod get_batch_preview;-use axum::{Router, routing::post};--use crate::api::context::AppState;--pub fn router() -> Router<AppState> {- Router::new().route("/", post(get_batch_preview::handler))-}diff --git a/rust/cloud-storage/comms_service/src/api/swagger.rs b/rust/cloud-storage/comms_service/src/api/swagger.rsdeleted file mode 100644index e48643a646..0000000000--- a/rust/cloud-storage/comms_service/src/api/swagger.rs+++ /dev/null@@ -1,157 +0,0 @@-use crate::api::{- activity::post_activity::PostActivityRequest,- channels::{- add_participants::AddParticipantsRequest,- create_channel::{CreateChannelRequest, CreateChannelResponse},- delete_message::DeleteMessageParams,- get_channel::GetChannelResponse,- get_or_create_dm::{GetOrCreateDmRequest, GetOrCreateDmResponse},- get_or_create_private::{GetOrCreatePrivateRequest, GetOrCreatePrivateResponse},- patch_message::{PatchMessageParams, PatchMessageRequest},- post_message::{PostMessageRequest, PostMessageResponse},- post_reaction::{PostReactionRequest, ReactionAction},- post_typing::PostTypingRequest,- remove_participants::RemoveParticipantsRequest,- },- extractors::ParticipantAccess,- mentions::{- CreateEntityMentionRequest, CreateEntityMentionResponse, DeleteEntityMentionRequest,- DeleteEntityMentionResponse,- },- preview::get_batch_preview::{GetBatchChannelPreviewRequest, GetBatchChannelPreviewResponse},-};-use comms::inbound::router::{ApiActivity, ApiChannelWithLatest};-use comms_db_client::channels::patch_channel::PatchChannelOptions;-use comms_db_client::model::{- Activity, ActivityType, CountedReaction, EntityMention, Message, NewAttachment, Reaction,- SimpleMention,-};-use model::comms::{- Channel, ChannelParticipant, ChannelType, ChannelWithParticipants,- GetMessageWithContextResponse, GetOrCreateAction, LatestMessage, ParticipantRole,-};--use model::response::{GenericErrorResponse, StringIDResponse};-use model::version::CommunicationServiceApiVersion;-use utoipa::OpenApi;--use super::channels::{- add_participants, create_channel, delete_channel, delete_message, get_channel, get_mentions,- get_message_with_context, get_or_create_dm, get_or_create_private, join_channel, leave_channel,- patch_channel, patch_message, post_message, post_reaction, post_typing, remove_participants,-};--use super::attachments::references;-use super::attachments::references::GetAttachmentReferencesResponse;-use comms_db_client::attachments::get_attachment_references::{- ChannelReference, EntityReference, GenericReference,-};--use super::channels::get_mentions::GetMentionsResponse;--use super::activity::post_activity;-use super::mentions::{- create_mention::__path_create_mention_handler, delete_mention::__path_delete_mention_handler,-};-use super::preview::get_batch_preview;--#[derive(OpenApi)]-#[openapi(- info(- terms_of_service = "https://macro.com/terms",- ),- paths(- create_channel::create_channel_handler,- get_channel::get_channel_handler,- comms::inbound::router::get_channels_handler,- post_message::post_message_handler,- post_typing::post_typing_handler,- post_reaction::post_reaction_handler,- patch_message::patch_message_handler,- delete_message::delete_message_handler,- comms::inbound::router::get_activity_handler,- post_activity::post_activity_handler,- join_channel::join_channel_handler,- leave_channel::leave_channel_handler,- get_batch_preview::handler,- remove_participants::handler,- add_participants::handler,- get_or_create_dm::handler,- get_or_create_private::handler,- delete_channel::delete_channel_handler,- patch_channel::patch_channel_handler,- references::handler,- create_mention_handler,- delete_mention_handler,- get_mentions::handler,- get_message_with_context::handler,- ),- components(- schemas(- CommunicationServiceApiVersion,- CreateChannelRequest,- CreateChannelResponse,- GetChannelResponse,- ApiChannelWithLatest,- PostMessageRequest,- PostMessageResponse,- PostTypingRequest,- StringIDResponse,- GenericErrorResponse,- PostReactionRequest,- ReactionAction,- PatchMessageParams,- PatchMessageRequest,- DeleteMessageParams,- PostActivityRequest,- AddParticipantsRequest,- RemoveParticipantsRequest,-- Channel,- ChannelParticipant,- ChannelType,- ParticipantRole,- Message,- Reaction,- CountedReaction,- Activity,- ApiActivity,- ActivityType,- NewAttachment,- ParticipantAccess,- SimpleMention,- EntityMention,-- GetBatchChannelPreviewRequest,- GetBatchChannelPreviewResponse,-- GetOrCreateDmRequest,- GetOrCreateDmResponse,-- GetOrCreatePrivateRequest,- GetOrCreatePrivateResponse,-- GetOrCreateAction,- PatchChannelOptions,-- GetAttachmentReferencesResponse,- ChannelReference,- GenericReference,- EntityReference,-- CreateEntityMentionRequest,- CreateEntityMentionResponse,- DeleteEntityMentionRequest,- DeleteEntityMentionResponse,-- GetMentionsResponse,- ChannelWithParticipants,- LatestMessage,- GetMessageWithContextResponse,- ),- ),- tags(- (name = "macro comms service", description = "Comms Service")- )- )]-pub struct ApiDoc;diff --git a/rust/cloud-storage/comms_service/src/channel_permissions.rs b/rust/cloud-storage/comms_service/src/channel_permissions.rsdeleted file mode 100644index d3bfe034ed..0000000000--- a/rust/cloud-storage/comms_service/src/channel_permissions.rs+++ /dev/null@@ -1,117 +0,0 @@-//! Channel share permissions handling.-//!-//! This module contains the logic for managing channel share permissions,-//! which was previously handled via calls to the document storage service.--use anyhow::Context;-use entity_access::domain::models::EntityType;-use entity_access::domain::ports::EntityAccessService;-use macro_user_id::user_id::MacroUserIdStr;-use models_permissions::share_permission::access_level::AccessLevel;-use models_permissions::share_permission::channel_share_permission::{- UpdateChannelSharePermission, UpdateOperation,-};-use sqlx::PgPool;-use std::str::FromStr;--/// Updates the channel share permission for an item shared in a channel message.-///-/// When a user shares an item (document, chat, project, thread) in a channel message,-/// this function:-/// 1. Validates the user has access to the item-/// 2. Creates a channel share permission linking the item to the channel-/// 3. Grants all channel participants view access to the item-#[tracing::instrument(skip(db, entity_access_service), err)]-pub async fn update_channel_share_permission(- db: &PgPool,- entity_access_service: &impl EntityAccessService,- user_id: &str,- channel_id: &str,- item_id: &str,- item_type: &str,-) -> anyhow::Result<()> {- // The item id should be a uuid- let entity_id = macro_uuid::string_to_uuid(item_id)?;-- // If the item type is not a supported shareable item type, return success early- if model::item::ShareableItemType::from_str(item_type).is_err() {- return Ok(());- }-- // TODO: we should make everything here use the transaction- let mut transaction = db.begin().await?;-- // Ensure thread share permissions exist before getting access level- if item_type == "thread" {- macro_middleware::cloud_storage::thread::ensure_thread_exists::insert_thread_share_permissions(db, item_id)- .await- .context("failed to insert thread share permissions")?;- }-- // Map item_type string to EntityType- let entity_type = match item_type {- "document" => EntityType::Document,- "chat" => EntityType::Chat,- "project" => EntityType::Project,- "thread" => EntityType::EmailThread,- "call" => EntityType::Call,- _ => anyhow::bail!("unsupported item type: {}", item_type),- };-- // Parse user_id- let user_id_parsed = MacroUserIdStr::parse_from_str(user_id).context("invalid user id")?;-- // Get user's max access level to the item- let user_access_level = entity_access_service- .get_access_level(Some(&user_id_parsed), item_id, entity_type)- .await- .context("failed to get user access level")?;-- if user_access_level.is_none() {- tracing::info!("user does not have access to the item, not modifying share permissions");- return Ok(());- }-- let channel_share_permission_access_level = AccessLevel::View;-- // Get share permission id- let share_permission_id =- macro_db_client::share_permission::get::get_share_permission_id(db, item_id, item_type)- .await- .context("failed to get share permission id")?;-- // Insert channel share permission- if let Err(e) =- macro_db_client::share_permission::channel_permission::create::insert_channel_share_permission(- &mut *transaction,- &share_permission_id,- channel_id,- &channel_share_permission_access_level,- )- .await- {- if e.to_string() == "channel permission already exists" {- // fail silently. this flow happens when the patch item call made by the FE inserts the CSP- // before this.- return Ok(());- } else {- return Err(e).context("failed to insert channel share permission");- }- }-- entity_access_db_utils::update_entity_access_channel_share_permissions(- &mut transaction,- &entity_id,- entity_type,- &[UpdateChannelSharePermission {- channel_id: channel_id.to_string(),- operation: UpdateOperation::Add,- access_level: Some(channel_share_permission_access_level),- }],- )- .await?;-- transaction.commit().await?;-- Ok(())-}diff --git a/rust/cloud-storage/comms_service/src/config.rs b/rust/cloud-storage/comms_service/src/config.rsdeleted file mode 100644index b72843e716..0000000000--- a/rust/cloud-storage/comms_service/src/config.rs+++ /dev/null@@ -1,85 +0,0 @@-use anyhow::Context;-pub use macro_env::Environment;-use macro_middleware::auth::internal_access::InternalApiSecretKey;-use reqwest::Url;--/// The configuration parameters for the application.-///-/// These can either be passed on the command line, or pulled from environment variables.-/// The latter is preferred as environment variables are one of the recommended ways to-/// populate the Docker container-///-/// See `.env.sample` in cognitive-workspace root for details.-pub struct Config {- /// The connection URL for the Postgres database this application should use.- pub database_url: String,- /// The port to listen for HTTP requests on.- pub port: usize,- /// The environment we are in- pub environment: Environment,- /// internal auth key- pub internal_auth_key: InternalApiSecretKey,- /// url of the connection service- pub connection_gateway_url: String,-- /// The SQS queue to send notifications to- pub notification_queue: String,-- /// The contacts SQS queue- pub contacts_queue: String,-- /// Auth service client- pub auth_service_url: Url,-- /// Auth service secret key, used for internal access- pub auth_service_secret_key: String,-- pub search_event_queue: String,-}--impl Config {- pub fn from_env() -> anyhow::Result<Self> {- let database_url =- std::env::var("DATABASE_URL").context("DATABASE_URL must be provided")?;- let port: usize = std::env::var("PORT")- .unwrap_or("8080".to_string())- .parse::<usize>()- .unwrap();- let environment = Environment::new_or_prod();-- let internal_auth_key = InternalApiSecretKey::new()?;-- let connection_gateway_url = std::env::var("CONNECTION_GATEWAY_URL")- .context("CONNECTION_GATEWAY_URL must be provided")?;-- let notification_queue =- std::env::var("NOTIFICATION_QUEUE").context("NOTIFICATION_QUEUE must be provided")?;-- let contacts_queue =- std::env::var("CONTACTS_QUEUE").context("CONTACTS_QUEUE must be provided")?;-- let auth_service_url = std::env::var("AUTHENTICATION_SERVICE_URL")- .map(|s| Url::parse(&s))- .context("AUTHENTICATION_SERVICE_URL must be provided")?- .context("AUTHENTICATION_SERVICE_URL must be a valid url")?;-- let auth_service_secret_key = std::env::var("AUTHENTICATION_SERVICE_SECRET_KEY")- .context("AUTHENTICATION_SERVICE_SECRET_KEY must be provided")?;-- let search_event_queue =- std::env::var("SEARCH_EVENT_QUEUE").context("SEARCH_EVENT_QUEUE must be provided")?;-- Ok(Config {- database_url,- port,- environment,- internal_auth_key,- connection_gateway_url,- notification_queue,- contacts_queue,- auth_service_url,- auth_service_secret_key,- search_event_queue,- })- }-}diff --git a/rust/cloud-storage/comms_service/src/constants.rs b/rust/cloud-storage/comms_service/src/constants.rsdeleted file mode 100644index 834c991e06..0000000000--- a/rust/cloud-storage/comms_service/src/constants.rs+++ /dev/null@@ -1 +0,0 @@-pub const MACRO_PERMISSIONS_TOKEN_HEADER_KEY: &str = "x-permissions-token";diff --git a/rust/cloud-storage/comms_service/src/lib.rs b/rust/cloud-storage/comms_service/src/lib.rsdeleted file mode 100644index ce0d7006f4..0000000000--- a/rust/cloud-storage/comms_service/src/lib.rs+++ /dev/null@@ -1,24 +0,0 @@-//! Comms Service Library - exposes API routes for integration into other services--pub mod api;-pub mod channel_permissions;-pub mod config;-pub mod constants;-pub mod notification;-pub mod service;-pub mod utils;--// Re-exports for consumers-pub use api::context::AppState as CommsHandlerState;-pub use api::context::ChannelImpl;-pub use api::context::DocumentPermissionJwtSecretKey;-pub use api::context::EntityAccessServiceType;-pub use api::router as comms_router;-pub use api::swagger::ApiDoc as CommsApiDoc;--// Re-export comms types needed to construct the state-pub use comms::domain::service::ChannelServiceImpl;-pub use comms::inbound::router::CommsRouterState;-pub use comms::outbound::postgres::comms_repo::PgCommsRepo;-pub use comms::outbound::postgres::user_repo::PgUserRepo;-pub use frecency::outbound::postgres::FrecencyPgStorage;diff --git a/rust/cloud-storage/comms_service/src/notification.rs b/rust/cloud-storage/comms_service/src/notification.rsdeleted file mode 100644index 37b1ae9535..0000000000--- a/rust/cloud-storage/comms_service/src/notification.rs+++ /dev/null@@ -1,384 +0,0 @@-use crate::api::context::AppState;-use comms_db_client::{- messages::get_count::get_channel_message_count,- messages::get_message_owner::get_message_owner,- model::{Message, SimpleMention},- participants::get_participants::get_channel_participants_for_thread_id,-};-use macro_db_client::notification::BasicCloudStorageItemMetadata;-use macro_user_id::{cowlike::CowLike, user_id::MacroUserIdStr};-use model::comms::ChannelParticipant;-use model_entity::EntityType;-use model_notifications::{- ChannelInviteMetadata, ChannelMentionMetadata, ChannelMessageSendMetadata,- ChannelReplyMetadata, CommonChannelMetadata, DocumentMentionMetadata,- NotificationDocumentSubType,-};-use notification_hex::domain::models::SendNotificationRequestBuilder;-use notification_hex::domain::service::NotificationIngress;-use std::{collections::HashSet, iter::once};-use uuid::Uuid;--#[cfg(test)]-mod test;--struct ChannelMessageEvent<'a> {- channel_id: &'a Uuid,- message: &'a Message,- channel_metadata: &'a CommonChannelMetadata,- channel_message_count: usize,- user_mentions: &'a [String],- document_mentions: &'a [BasicCloudStorageItemMetadata],- participants: &'a [ChannelParticipant],- thread_participants: &'a [MacroUserIdStr<'static>],- thread_parent_sender_id: Option<MacroUserIdStr<'static>>,- has_attachments: bool,- sender_profile_picture_url: Option<String>,- /// Pre-computed set of existing user IDs; used by the `(0, None)` invite- /// branch to split recipients into push vs email delivery.- existing_user_ids: HashSet<String>,-}--fn recipients_excluding<'a>(- recipients: impl IntoIterator<Item = &'a str>,- exclude: impl IntoIterator<Item = &'a str>,-) -> impl Iterator<Item = MacroUserIdStr<'static>> {- let exclude_set: HashSet<&str> = exclude.into_iter().collect();- recipients- .into_iter()- .filter(move |id| !exclude_set.contains(id))- .filter_map(|id| MacroUserIdStr::parse_from_str(id).ok())- .map(|u| u.into_owned())-}--impl ChannelMessageEvent<'_> {- async fn send(&self, ingress: &impl NotificationIngress) -> anyhow::Result<()> {- let entity = || EntityType::Channel.with_entity_string(self.channel_id.to_string());- let sender = || Some(self.message.sender_id.clone());-- // Send mention notifications for @mentioned users- if !self.user_mentions.is_empty() {- ingress- .send_notification(- SendNotificationRequestBuilder {- notification_entity: entity(),- notification: ChannelMentionMetadata {- message_content: self.message.content.clone(),- message_id: self.message.id.to_string(),- has_attachments: self.has_attachments,- thread_id: self.message.thread_id.map(|t| t.to_string()),- common: self.channel_metadata.clone(),- sender_profile_picture_url: self.sender_profile_picture_url.clone(),- },- sender_id: sender(),- recipient_ids: recipients_excluding(- self.user_mentions.iter().map(|m| m.as_str()),- once(self.message.sender_id.0.as_ref()),- )- .collect(),- }- .into_request()- .with_apns()- .with_conn_gateway(),- )- .await- .map_err(|e| anyhow::anyhow!("{e:?}"))?;- }-- // Send document mention notifications- if !self.document_mentions.is_empty() {- let doc_recipients: HashSet<_> = recipients_excluding(- self.participants.iter().map(|p| p.user_id.as_ref()),- once(self.message.sender_id.0.as_ref()),- )- .collect();-- for mention in self.document_mentions {- ingress- .send_notification(- SendNotificationRequestBuilder {- notification_entity: entity(),- notification: DocumentMentionMetadata {- document_name: mention.item_name.clone(),- owner: mention.item_owner.clone(),- file_type: mention.file_type.clone(),- sub_type: match mention.sub_type.as_deref() {- Some("task") => Some(NotificationDocumentSubType::Task),- _ => None,- },- channel: ChannelMentionMetadata {- message_content: self.message.content.clone(),- message_id: self.message.id.to_string(),- has_attachments: self.has_attachments,- thread_id: self.message.thread_id.map(|t| t.to_string()),- common: self.channel_metadata.clone(),- sender_profile_picture_url: self- .sender_profile_picture_url- .clone(),- },- },- sender_id: sender(),- recipient_ids: doc_recipients.clone(),- }- .into_request()- .with_apns()- .with_conn_gateway(),- )- .await- .map_err(|e| anyhow::anyhow!("{e:?}"))?;- }- }-- let sender_and_mentions = once(self.message.sender_id.0.as_ref())- .chain(self.user_mentions.iter().map(String::as_str))- .collect::<Vec<&str>>();-- // MessageSend and Invite notifications are sent to all participants except the sender and- // mentioned users. Mentioned users receive a separate ChannelMention notification.- let recipients_without_sender_and_mentions: HashSet<_> = recipients_excluding(- self.participants.iter().map(|p| p.user_id.as_ref()),- sender_and_mentions.clone(),- )- .collect();-- match (self.channel_message_count, self.message.thread_id) {- // Thread Message Reply- (_, Some(thread_id)) => {- if !self.thread_participants.is_empty() {- ingress- .send_notification(- SendNotificationRequestBuilder {- notification_entity: entity(),- notification: ChannelReplyMetadata {- thread_id: thread_id.to_string(),- message_id: self.message.id.to_string(),- user_id: self.message.sender_id.clone(),- message_content: self.message.content.clone(),- has_attachments: self.has_attachments,- thread_parent_sender_id: self.thread_parent_sender_id.clone(),- common: self.channel_metadata.clone(),- sender_profile_picture_url: self- .sender_profile_picture_url- .clone(),- },- sender_id: sender(),- recipient_ids: recipients_excluding(- self.thread_participants.iter().map(|p| p.as_ref()),- sender_and_mentions,- )- .collect(),- }- .into_request()- .with_apns()- .with_conn_gateway(),- )- .await- .map_err(|e| anyhow::anyhow!("{e:?}"))?;- } else {- tracing::warn!("thread participants is empty, but message has thread id");- }- }- // First message in the channel — send an invite notification.- // The count is 1 (not 0) because our message was already persisted- // before this notification task runs; 0 shouldn't happen in- // practice but is handled defensively.- (..=1, None) => {- dispatch_notifications_for_invite(- ingress,- self.channel_id,- &self.message.sender_id,- recipients_without_sender_and_mentions.into_iter().collect(),- self.existing_user_ids.clone(),- self.sender_profile_picture_url.clone(),- Some(self.message.content.clone()),- self.channel_metadata.clone(),- )- .await?;- }- // Channel has messages, send message send notification- (_, None) => {- ingress- .send_notification(- SendNotificationRequestBuilder {- notification_entity: entity(),- notification: ChannelMessageSendMetadata {- message_id: self.message.id.to_string(),- sender: self.message.sender_id.clone(),- message_content: self.message.content.to_string(),- has_attachments: self.has_attachments,- common: self.channel_metadata.clone(),- sender_profile_picture_url: self.sender_profile_picture_url.clone(),- },- sender_id: sender(),- recipient_ids: recipients_without_sender_and_mentions,- }- .into_request()- .with_apns()- .with_conn_gateway(),- )- .await- .map_err(|e| anyhow::anyhow!("{e:?}"))?;- }- }-- Ok(())- }-}--#[expect(clippy::too_many_arguments)]-pub async fn dispatch_notifications_for_invite(- ingres: &impl NotificationIngress,- channel_id: &Uuid,- invited_by_user_id: &MacroUserIdStr<'static>,- recipient_user_ids: Vec<MacroUserIdStr<'_>>,- existing_user_ids: HashSet<String>,- sender_profile_picture_url: Option<String>,- message_content: Option<String>,- common: CommonChannelMetadata,-) -> anyhow::Result<()> {- let (existing_users, not_existing_users): (HashSet<_>, HashSet<_>) = recipient_user_ids- .into_iter()- .partition(|id| existing_user_ids.contains(id.as_ref()));-- let _ = tokio::try_join!(- ingres.send_notification(- SendNotificationRequestBuilder {- notification_entity: EntityType::Channel.with_entity_string(channel_id.to_string()),- notification: ChannelInviteMetadata {- invited_by: invited_by_user_id.clone(),- channel_name: common.channel_name.clone(),- message_content: message_content.clone(),- sender_profile_picture_url: sender_profile_picture_url.clone(),- },- sender_id: Some(invited_by_user_id.copied().into_owned()),- recipient_ids: existing_users,- }- .into_request()- .with_apns()- .with_conn_gateway(),- ),- ingres.send_notification(- SendNotificationRequestBuilder {- notification_entity: EntityType::Channel.with_entity_string(channel_id.to_string()),- notification: ChannelInviteMetadata {- invited_by: invited_by_user_id.clone(),- channel_name: common.channel_name.clone(),- message_content,- sender_profile_picture_url,- },- sender_id: Some(invited_by_user_id.copied().into_owned()),- recipient_ids: not_existing_users,- }- .into_request()- .with_email(),- )- )- .map_err(|e| anyhow::anyhow!("{e:?}"))?;-- Ok(())-}--pub async fn dispatch_notifications_for_message(- api_context: &AppState,- channel_id: &Uuid,- channel_metadata: CommonChannelMetadata,- participants: Vec<ChannelParticipant>,- message: Message,- mentions: Vec<SimpleMention>,- has_attachments: bool,-) -> anyhow::Result<()> {- // The message is already persisted before this task runs, so the row- // count includes the message we just created — the first message in a- // channel yields a count of 1 (not 0).- let channel_message_count =- get_channel_message_count(&api_context.db, channel_id).await? as usize;-- // When this is the first message in the channel, look up which- // participants already have accounts so the invite branch can split- // push (existing) vs email (non-existing) delivery.- let existing_user_ids: HashSet<String> = if channel_message_count <= 1- && message.thread_id.is_none()- {- let participant_ids: Vec<_> = participants.iter().map(|p| p.user_id.0.clone()).collect();-- macro_db_client::user::get_all::get_existing_users(&api_context.db, &participant_ids)- .await?- .into_iter()- .collect()- } else {- HashSet::new()- };-- let (user_mentions, document_mention_ids) =- mentions- .into_iter()- .fold((Vec::new(), Vec::new()), |(mut users, mut docs), m| {- match m.entity_type.as_str() {- "user" => users.push(m.entity_id),- "document" => docs.push(m.entity_id),- _ => {}- }- (users, docs)- });-- let document_mentions =- macro_db_client::notification::get_basic_cloud_storage_documents_metadata(- &api_context.db,- &document_mention_ids,- )- .await- .inspect_err(|e| {- tracing::error!(error=?e, "unable to get documents metadata");- })- .unwrap_or_default();-- let (thread_participants, thread_parent_sender_id) = if let Some(thread_id) = message.thread_id- {- let participants = get_channel_participants_for_thread_id(&api_context.db, &thread_id)- .await- .unwrap_or_default();- // Get the thread parent sender (author of the root message)- let sender_id = match get_message_owner(&api_context.db, &thread_id).await {- Ok(id) => MacroUserIdStr::parse_from_str(&id)- .ok()- .map(|id| id.into_owned()),- Err(_) => None,- };- (participants, sender_id)- } else {- (vec![], None)- };-- let sender_profile_picture_url =- get_sender_profile_picture_url(&api_context.db, &message.sender_id).await;-- ChannelMessageEvent {- channel_id,- message: &message,- channel_metadata: &channel_metadata,- channel_message_count,- user_mentions: &user_mentions,- document_mentions: &document_mentions,- participants: &participants,- thread_participants: &thread_participants,- thread_parent_sender_id,- has_attachments,- sender_profile_picture_url,- existing_user_ids,- }- .send(&*api_context.notification_ingress_service)- .await-}--pub async fn get_sender_profile_picture_url(- db: &sqlx::PgPool,- sender_id: &MacroUserIdStr<'_>,-) -> Option<String> {- macro_db_client::user::update_profile_picture::get_profile_pictures(- db,- &vec![sender_id.as_ref().to_string()],- )- .await- .ok()- .and_then(|pics| pics.pictures.into_iter().next().map(|p| p.url))-}diff --git a/rust/cloud-storage/comms_service/src/notification/test.rs b/rust/cloud-storage/comms_service/src/notification/test.rsdeleted file mode 100644index 50d5f46c3a..0000000000--- a/rust/cloud-storage/comms_service/src/notification/test.rs+++ /dev/null@@ -1,292 +0,0 @@-use super::*;-use model::comms::{ChannelId, ParticipantRole};-use notification_hex::domain::models::{Notification, NotificationResult, SendNotificationRequest};-use notification_hex::domain::service::SendNotificationError;-use std::collections::HashMap;-use std::sync::Mutex;-use uuid::Uuid;--struct MockNotificationIngress {- recorded_requests: Mutex<Vec<serde_json::Value>>,-}--impl MockNotificationIngress {- fn new() -> Self {- Self {- recorded_requests: Mutex::new(Vec::new()),- }- }-- fn recorded_requests(&self) -> Vec<serde_json::Value> {- self.recorded_requests.lock().unwrap().clone()- }-}--impl NotificationIngress for MockNotificationIngress {- async fn send_notification<- 'a,- T: Notification + Clone + 'static,- U: serde::Serialize + Send + Sync + 'static,- >(- &'a self,- req: SendNotificationRequest<'a, T, U>,- ) -> Result<Option<NotificationResult<'a>>, rootcause::Report<SendNotificationError>> {- let snapshot = serde_json::to_value(&req).unwrap();- self.recorded_requests.lock().unwrap().push(snapshot);- Ok(None)- }-}--fn participant(user_id: MacroUserIdStr<'static>, channel_id: Uuid) -> ChannelParticipant {- ChannelParticipant {- user_id,- channel_id: ChannelId(channel_id),- role: ParticipantRole::Member,- left_at: None,- joined_at: chrono::Utc::now(),- }-}--fn message(- channel_id: Uuid,- sender_id: MacroUserIdStr<'static>,- thread_id: Option<Uuid>,-) -> Message {- Message {- id: Uuid::new_v4(),- sender_id,- content: "test".to_string(),- thread_id,- channel_id,- created_at: chrono::Utc::now(),- deleted_at: None,- edited_at: None,- updated_at: chrono::Utc::now(),- }-}--fn private_metadata() -> CommonChannelMetadata {- CommonChannelMetadata {- channel_type: model_notifications::ChannelType::Private,- channel_name: "group".to_string(),- }-}--fn uid(s: &str) -> MacroUserIdStr<'static> {- MacroUserIdStr::parse_from_str(s).unwrap().into_owned()-}--fn get_type_name(req: &serde_json::Value) -> &str {- req["req"]["notification"]["tag"].as_str().unwrap()-}--fn get_recipient_ids(req: &serde_json::Value) -> HashSet<String> {- req["req"]["recipient_ids"]- .as_array()- .unwrap()- .iter()- .map(|v| v.as_str().unwrap().to_string())- .collect()-}--const MESSAGE_NOTIF_TYPES: &[&str] = &[- "channel_message_send",- "channel_message_reply",- "channel_mention",-];--fn assert_single_message_notification_per_recipient(requests: &[serde_json::Value]) {- let mut visited: HashMap<String, usize> = HashMap::new();-- for req in requests {- let type_name = get_type_name(req);- if !MESSAGE_NOTIF_TYPES.contains(&type_name) {- continue;- }- for r in get_recipient_ids(req) {- *visited.entry(r).or_default() += 1;- }- }-- let violations: Vec<_> = visited- .into_iter()- .filter(|(_, count)| *count > 1)- .collect();-- assert!(- violations.is_empty(),- "notifications sent to multiple recipients: {violations:?}"- );-}--#[tokio::test]-async fn mentioned_users_get_mention_not_message_send() {- let channel_id = Uuid::new_v4();- let participants = vec![- participant(uid("macro|[email protected]"), channel_id),- participant(uid("macro|[email protected]"), channel_id),- participant(uid("macro|[email protected]"), channel_id),- ];- let msg = message(channel_id, uid("macro|[email protected]"), None);- let metadata = private_metadata();- let user_mentions = vec!["macro|[email protected]".to_string()];-- let ingress = MockNotificationIngress::new();- ChannelMessageEvent {- channel_id: &channel_id,- message: &msg,- channel_metadata: &metadata,- // 2 = message we just persisted + at least one prior message, so this- // exercises the regular send branch (not the first-message invite).- channel_message_count: 2,- user_mentions: &user_mentions,- document_mentions: &[],- participants: &participants,- thread_participants: &[],- thread_parent_sender_id: None,- has_attachments: false,- sender_profile_picture_url: None,- existing_user_ids: HashSet::new(),- }- .send(&ingress)- .await- .unwrap();-- let requests = ingress.recorded_requests();- assert_single_message_notification_per_recipient(&requests);-- let mention = requests- .iter()- .find(|r| get_type_name(r) == "channel_mention")- .expect("should have mention notification");- let mention_recipients = get_recipient_ids(mention);- assert!(mention_recipients.contains("macro|[email protected]"));-- let send = requests- .iter()- .find(|r| get_type_name(r) == "channel_message_send")- .expect("should have message send notification");- let send_recipients = get_recipient_ids(send);- assert!(!send_recipients.contains("macro|[email protected]"));- assert!(send_recipients.contains("macro|[email protected]"));-}--#[tokio::test]-async fn thread_reply_excludes_sender_and_mentions() {- let channel_id = Uuid::new_v4();- let thread_id = Uuid::new_v4();- let participants = vec![- participant(uid("macro|[email protected]"), channel_id),- participant(uid("macro|[email protected]"), channel_id),- participant(uid("macro|[email protected]"), channel_id),- participant(uid("macro|[email protected]"), channel_id),- ];- let msg = message(channel_id, uid("macro|[email protected]"), Some(thread_id));- let metadata = private_metadata();- let user_mentions = vec!["macro|[email protected]".to_string()];- let thread_participants = vec![- MacroUserIdStr::parse_from_str("macro|[email protected]").unwrap(),- MacroUserIdStr::parse_from_str("macro|[email protected]").unwrap(),- MacroUserIdStr::parse_from_str("macro|[email protected]").unwrap(),- MacroUserIdStr::parse_from_str("macro|[email protected]").unwrap(),- ];-- let ingress = MockNotificationIngress::new();- ChannelMessageEvent {- channel_id: &channel_id,- message: &msg,- channel_metadata: &metadata,- channel_message_count: 5,- user_mentions: &user_mentions,- document_mentions: &[],- participants: &participants,- thread_participants: &thread_participants,- thread_parent_sender_id: Some(uid("macro|[email protected]")),- has_attachments: false,- sender_profile_picture_url: None,- existing_user_ids: HashSet::new(),- }- .send(&ingress)- .await- .unwrap();-- let requests = ingress.recorded_requests();- assert_single_message_notification_per_recipient(&requests);-- let reply = requests- .iter()- .find(|r| get_type_name(r) == "channel_message_reply")- .expect("should have reply notification");- let recipients = get_recipient_ids(reply);- assert!(!recipients.contains("macro|[email protected]"));- assert!(!recipients.contains("macro|[email protected]"));- assert!(recipients.contains("macro|[email protected]"));- assert!(recipients.contains("macro|[email protected]"));-}--fn has_email(req: &serde_json::Value) -> bool {- !req["build_email"].is_null()-}--#[tokio::test]-async fn first_message_sends_email_invite_to_non_existing_users() {- let channel_id = Uuid::new_v4();- let participants = vec![- participant(uid("macro|[email protected]"), channel_id),- participant(uid("macro|[email protected]"), channel_id),- participant(uid("macro|[email protected]"), channel_id),- ];- let msg = message(channel_id, uid("macro|[email protected]"), None);- let metadata = private_metadata();-- // Only [email protected] is a known user- let existing_user_ids: HashSet<String> = HashSet::from(["macro|[email protected]".to_string()]);-- let ingress = MockNotificationIngress::new();- ChannelMessageEvent {- channel_id: &channel_id,- message: &msg,- channel_metadata: &metadata,- channel_message_count: 0,- user_mentions: &[],- document_mentions: &[],- participants: &participants,- thread_participants: &[],- thread_parent_sender_id: None,- has_attachments: false,- sender_profile_picture_url: None,- existing_user_ids,- }- .send(&ingress)- .await- .unwrap();-- let requests = ingress.recorded_requests();-- // Should produce exactly two channel_invite notifications- let invites: Vec<_> = requests- .iter()- .filter(|r| get_type_name(r) == "channel_invite")- .collect();- assert_eq!(invites.len(), 2, "expected two invite notifications");-- // The invite to the existing user should NOT have email- let existing_invite = invites- .iter()- .find(|r| get_recipient_ids(r).contains("macro|[email protected]"))- .expect("should have invite for existing user");- assert!(- !has_email(existing_invite),- "existing user invite should not have email"- );-- // The invite to the non-existing user SHOULD have email- let new_user_invite = invites- .iter()- .find(|r| get_recipient_ids(r).contains("macro|[email protected]"))- .expect("should have invite for non-existing user");- assert!(- has_email(new_user_invite),- "non-existing user invite should have email"- );-}diff --git a/rust/cloud-storage/comms_service/src/openapi.rs b/rust/cloud-storage/comms_service/src/openapi.rsdeleted file mode 100644index 8f84ef8cc9..0000000000--- a/rust/cloud-storage/comms_service/src/openapi.rs+++ /dev/null@@ -1,18 +0,0 @@-#![allow(unused)]--mod api;-mod channel_permissions;-mod config;-mod constants;-mod notification;-mod service;-mod utils;--use utoipa::OpenApi;--fn main() {- println!(- "{}",- api::swagger::ApiDoc::openapi().to_pretty_json().unwrap()- );-}diff --git a/rust/cloud-storage/comms_service/src/service/mod.rs b/rust/cloud-storage/comms_service/src/service/mod.rsdeleted file mode 100644index 1e4f635b00..0000000000--- a/rust/cloud-storage/comms_service/src/service/mod.rs+++ /dev/null@@ -1,2 +0,0 @@-pub mod search;-pub mod sender;diff --git a/rust/cloud-storage/comms_service/src/service/search.rs b/rust/cloud-storage/comms_service/src/service/search.rsdeleted file mode 100644index 3c9caebcd9..0000000000--- a/rust/cloud-storage/comms_service/src/service/search.rs+++ /dev/null@@ -1,77 +0,0 @@-#[tracing::instrument(skip(sqs_client))]-pub fn send_channel_message_to_search_extractor_queue(- sqs_client: &sqs_client::SQS,- channel_id: impl ToString + std::fmt::Debug,- message_id: impl ToString + std::fmt::Debug,-) {- #[cfg(feature = "channel_search")]- {- use tracing::Instrument;-- tracing::trace!("enqueueing message to search");-- let channel_id = channel_id.to_string();- let message_id = message_id.to_string();-- // TODO: may need to handle retries as we could hit SQS fifo limits here- tokio::spawn({- let sqs_client = sqs_client.clone();- async move {- let _ = sqs_client- .send_message_to_search_event_queue(- sqs_client::search::SearchQueueMessage::ChannelMessageUpdate(- sqs_client::search::channel::ChannelMessageUpdate {- channel_id,- message_id,- index_override: None,- },- ),- )- .await- .inspect_err(|e| {- tracing::error!(error=?e, "SEARCH_QUEUE unable to enqueue message");- });- }- .in_current_span()- });- }-}--#[tracing::instrument(skip(sqs_client))]-pub fn send_remove_channel_message_to_search_extractor_queue(- sqs_client: &sqs_client::SQS,- channel_id: impl ToString + std::fmt::Debug,- message_id: Option<impl ToString + std::fmt::Debug>,-) {- #[cfg(feature = "channel_search")]- {- use tracing::Instrument;-- tracing::trace!("enqueueing message to search");-- let channel_id = channel_id.to_string();- let message_id = message_id.map(|s| s.to_string());-- // TODO: may need to handle retries as we could hit SQS fifo limits here- tokio::spawn({- let sqs_client = sqs_client.clone();- async move {- let _ = sqs_client- .send_message_to_search_event_queue(- sqs_client::search::SearchQueueMessage::RemoveChannelMessage(- sqs_client::search::channel::RemoveChannelMessage {- channel_id,- message_id,- index_override: None,- },- ),- )- .await- .inspect_err(|e| {- tracing::error!(error=?e, "SEARCH_QUEUE unable to enqueue message");- });- }- .in_current_span()- });- }-}diff --git a/rust/cloud-storage/comms_service/src/service/sender/mod.rs b/rust/cloud-storage/comms_service/src/service/sender/mod.rsdeleted file mode 100644index e0a9c041c3..0000000000--- a/rust/cloud-storage/comms_service/src/service/sender/mod.rs+++ /dev/null@@ -1 +0,0 @@-pub mod notify;diff --git a/rust/cloud-storage/comms_service/src/service/sender/notify.rs b/rust/cloud-storage/comms_service/src/service/sender/notify.rsdeleted file mode 100644index f9b9e35dd7..0000000000--- a/rust/cloud-storage/comms_service/src/service/sender/notify.rs+++ /dev/null@@ -1,122 +0,0 @@-use anyhow::Result;-use comms_db_client::model::{Attachment, CountedReaction, Message, TypingAction};-use comms_db_client::participants::get_participants::get_participants;-use macro_user_id::user_id::MacroUserIdStr;-use model_entity::EntityType;-use serde::Serialize;-use utoipa::ToSchema;-use uuid::Uuid;--use crate::api::context::AppState;--/// Generic wrapper that adds an optional nonce to any serializable payload.-/// Used for optimistic update correlation - the nonce is echoed back to the client.-#[derive(Serialize, ToSchema)]-pub struct WithNonce<'a, T: Serialize> {- #[serde(flatten)]- pub data: T,- #[serde(skip_serializing_if = "Option::is_none")]- pub nonce: Option<&'a str>,-}--pub async fn notify_message(- ctx: &AppState,- message: WithNonce<'_, &Message>,- participants: &[MacroUserIdStr<'_>],-) -> Result<()> {- if participants.is_empty() {- return Ok(());- }- ctx.connection_gateway_client- .batch_send_message(- "comms_message".to_string(),- serde_json::to_value(message)?,- participants- .iter()- .map(|p| EntityType::User.with_entity_str(p.as_ref()))- .collect(),- )- .await?;-- Ok(())-}--#[derive(Debug, Serialize, ToSchema)]-pub struct TypingData<'a> {- pub channel_id: &'a Uuid,- pub user_id: &'a str,- pub action: TypingAction,- pub thread_id: Option<&'a Uuid>,-}--#[tracing::instrument(skip(ctx, update), err)]-pub async fn notify_typing(ctx: &AppState, update: WithNonce<'_, TypingData<'_>>) -> Result<()> {- let participants = get_participants(&ctx.db, update.data.channel_id).await?;-- ctx.connection_gateway_client- .batch_send_message(- "comms_typing".to_string(),- serde_json::to_value(update)?,- participants- .iter()- .map(|p| EntityType::User.with_entity_str(p.user_id.as_ref()))- .collect(),- )- .await?;-- Ok(())-}--#[derive(Debug, Serialize, ToSchema)]-pub struct ReactionData<'a> {- pub channel_id: &'a Uuid,- pub message_id: &'a Uuid,- pub reactions: &'a [CountedReaction],-}--pub async fn notify_reactions(- ctx: &AppState,- update: WithNonce<'_, ReactionData<'_>>,-) -> Result<()> {- let participants = get_participants(&ctx.db, update.data.channel_id).await?;-- ctx.connection_gateway_client- .batch_send_message(- "comms_reaction".to_string(),- serde_json::to_value(update)?,- participants- .iter()- .map(|p| EntityType::User.with_entity_str(p.user_id.as_ref()))- .collect(),- )- .await?;-- Ok(())-}--#[derive(Debug, Serialize, ToSchema)]-pub struct AttachmentData<'a> {- pub channel_id: &'a Uuid,- pub message_id: &'a Uuid,- pub attachments: &'a [Attachment],-}--pub async fn notify_attachments(- ctx: &AppState,- update: WithNonce<'_, AttachmentData<'_>>,-) -> Result<()> {- let participants = get_participants(&ctx.db, update.data.channel_id).await?;-- ctx.connection_gateway_client- .batch_send_message(- "comms_attachment".to_string(),- serde_json::to_value(update)?,- participants- .iter()- .map(|p| EntityType::User.with_entity_str(p.user_id.as_ref()))- .collect(),- )- .await?;-- Ok(())-}diff --git a/rust/cloud-storage/comms_service/src/utils/mod.rs b/rust/cloud-storage/comms_service/src/utils/mod.rsdeleted file mode 100644index c076fb97ed..0000000000--- a/rust/cloud-storage/comms_service/src/utils/mod.rs+++ /dev/null@@ -1 +0,0 @@-pub mod previews;diff --git a/rust/cloud-storage/comms_service/src/utils/previews.rs b/rust/cloud-storage/comms_service/src/utils/previews.rsdeleted file mode 100644index 200b13957f..0000000000--- a/rust/cloud-storage/comms_service/src/utils/previews.rs+++ /dev/null@@ -1,84 +0,0 @@-use comms::domain::models::channel_name::resolve_channel_name;-use comms_db_client::model::{ChannelPreview, ChannelPreviewData, WithChannelId};-use comms_db_client::preview::Previews;-use macro_user_id::cowlike::CowLike;-use macro_user_id::user_id::MacroUserIdStr;-use models_comms::channel::ChannelId;-use std::collections::HashMap;--pub fn resolve_previews(- context: MacroUserIdStr<'_>,- raw_previews: Previews,- name_lookup: &HashMap<MacroUserIdStr<'static>, String>,-) -> Vec<ChannelPreview> {- let mut previews = vec![];-- let not_existing: Vec<ChannelPreview> = raw_previews- .remaining- .iter()- .map(|preview| {- ChannelPreview::DoesNotExist(WithChannelId {- channel_id: preview.clone(),- })- })- .collect();-- let existing: Vec<ChannelPreview> = raw_previews- .exists- .iter()- .map(|preview| {- let participants: Vec<_> = preview- .participants- .iter()- .map(|p| models_comms::channel::ChannelParticipant {- channel_id: p.channel_id,- user_id: p.user_id.clone(),- role: match p.role {- model::comms::ParticipantRole::Owner => {- models_comms::channel::ParticipantRole::Owner- }- model::comms::ParticipantRole::Admin => {- models_comms::channel::ParticipantRole::Admin- }- model::comms::ParticipantRole::Member => {- models_comms::channel::ParticipantRole::Member- }- },- joined_at: p.joined_at,- left_at: p.left_at,- })- .collect();-- let resolved_name = resolve_channel_name(- &match preview.channel_type {- model::comms::ChannelType::Public => models_comms::channel::ChannelType::Public,- model::comms::ChannelType::Organization => {- models_comms::channel::ChannelType::Organization- }- model::comms::ChannelType::Private => {- models_comms::channel::ChannelType::Private- }- model::comms::ChannelType::DirectMessage => {- models_comms::channel::ChannelType::DirectMessage- }- model::comms::ChannelType::Team => models_comms::channel::ChannelType::Team,- },- preview.channel_name.as_deref(),- &participants,- &ChannelId(preview.channel_id),- context.copied(),- name_lookup,- );- ChannelPreview::Access(ChannelPreviewData {- channel_id: preview.channel_id.to_string(),- channel_name: resolved_name,- channel_type: preview.channel_type,- })- })- .collect();-- previews.extend(existing);- previews.extend(not_existing);-- previews-}diff --git a/rust/cloud-storage/comms_service_client/Cargo.toml b/rust/cloud-storage/comms_service_client/Cargo.tomldeleted file mode 100644index 82187b92c5..0000000000--- a/rust/cloud-storage/comms_service_client/Cargo.toml+++ /dev/null@@ -1,19 +0,0 @@-[package]-edition = "2024"-name = "comms_service_client"-publish = false-version = "0.1.0"--[dependencies]-anyhow = { workspace = true }-async-trait = { workspace = true }-chrono = { workspace = true }-model = { path = "../model" }-models_comms = { path = "../models_comms" }-reqwest.workspace = true-serde = { workspace = true }-serde_json = { workspace = true }-thiserror = { workspace = true }-tracing = { workspace = true }-urlencoding = { workspace = true }-uuid = { workspace = true }diff --git a/rust/cloud-storage/comms_service_client/src/channels.rs b/rust/cloud-storage/comms_service_client/src/channels.rsdeleted file mode 100644index d482f61418..0000000000--- a/rust/cloud-storage/comms_service_client/src/channels.rs+++ /dev/null@@ -1,156 +0,0 @@-use super::CommsServiceClient;-use crate::error::{ClientError, ResponseExt};-use model::comms::{ChannelMessage, ChannelParticipant, ChannelType};-use models_comms::channel::{ChannelId, OrganizationId};-use serde::{Deserialize, Serialize};-use urlencoding;-use uuid::Uuid;--#[derive(Debug, Serialize, Deserialize)]-pub struct ChannelMetadataResponse {- pub channel_name: String,- pub channel_type: ChannelType,-}--#[derive(Debug, Serialize, Deserialize)]-pub struct ChannelTranscriptResponse {- pub transcript: String,-}--/// Channel with latest message from GET /channels response-#[derive(Debug, Clone, Serialize, Deserialize)]-pub struct ApiChannelWithLatest {- /// Channel ID- pub id: ChannelId,- /// Channel name (may be None for DMs)- pub name: Option<String>,- /// Channel type- pub channel_type: ChannelType,- /// Organization ID if applicable- pub org_id: Option<OrganizationId>,- /// When the channel was created- pub created_at: chrono::DateTime<chrono::Utc>,- /// When the channel was last updated- pub updated_at: chrono::DateTime<chrono::Utc>,- /// Owner user ID- pub owner_id: String,- /// Channel participants- pub participants: Vec<ChannelParticipant>,- /// Latest message in the channel- pub latest_message: Option<ChannelMessage>,- /// Latest non-thread message- pub latest_non_thread_message: Option<ChannelMessage>,- /// When the user last viewed the channel- pub viewed_at: Option<chrono::DateTime<chrono::Utc>>,- /// When the user last interacted with the channel- pub interacted_at: Option<chrono::DateTime<chrono::Utc>>,- /// Frecency score for sorting- pub frecency_score: Option<f64>,-}--impl CommsServiceClient {- /// Get all channels the user has access to using external authenticated endpoint- #[tracing::instrument(skip(self, jwt_token), err)]- pub async fn get_channels_external(- &self,- jwt_token: &str,- ) -> Result<Vec<ApiChannelWithLatest>, ClientError> {- let url = format!("{}/comms/channels", self.url);- let response = self- .client- .get(&url)- .header("Authorization", format!("Bearer {}", jwt_token))- .send()- .await- .map_client_error()- .await?;-- let result = response- .json::<Vec<ApiChannelWithLatest>>()- .await- .map_err(|e| {- ClientError::Generic(anyhow::anyhow!(- "unable to parse response from get_channels_external: {}",- e- ))- })?;-- Ok(result)- }-- /// Get channel metadata using external authenticated endpoint- #[tracing::instrument(skip(self, jwt_token), err)]- pub async fn get_channel_metadata_external(- &self,- channel_id: &Uuid,- jwt_token: &str,- ) -> Result<ChannelMetadataResponse, ClientError> {- let url = format!("{}/comms/channels/{}/metadata", self.url, channel_id);- let response = self- .client- .get(&url)- .header("Authorization", format!("Bearer {}", jwt_token))- .send()- .await- .map_client_error()- .await?;-- let result = response- .json::<ChannelMetadataResponse>()- .await- .map_err(|e| {- ClientError::Generic(anyhow::anyhow!(- "unable to parse response from get_channel_metadata_external: {}",- e- ))- })?;-- Ok(result)- }-- /// Get channel transcript using external authenticated endpoint- #[tracing::instrument(skip(self, jwt_token), err)]- pub async fn get_channel_transcript_external(- &self,- channel_id: &Uuid,- jwt_token: &str,- since: Option<chrono::DateTime<chrono::Utc>>,- limit: Option<i64>,- ) -> Result<ChannelTranscriptResponse, ClientError> {- let mut url = format!("{}/comms/channels/{}/transcript", self.url, channel_id);- let mut query_params = vec![];- if let Some(since) = since {- query_params.push(format!(- "since={}",- urlencoding::encode(&since.to_rfc3339())- ));- }- if let Some(limit) = limit {- query_params.push(format!("limit={}", limit));- }- if !query_params.is_empty() {- url = format!("{}?{}", url, query_params.join("&"));- }-- let response = self- .client- .get(&url)- .header("Authorization", format!("Bearer {}", jwt_token))- .send()- .await- .map_client_error()- .await?;-- let result = response- .json::<ChannelTranscriptResponse>()- .await- .map_err(|e| {- ClientError::Generic(anyhow::anyhow!(- "unable to parse response from get_channel_transcript_external: {}",- e- ))- })?;-- Ok(result)- }-}diff --git a/rust/cloud-storage/comms_service_client/src/error.rs b/rust/cloud-storage/comms_service_client/src/error.rsdeleted file mode 100644index 310310c269..0000000000--- a/rust/cloud-storage/comms_service_client/src/error.rs+++ /dev/null@@ -1,40 +0,0 @@-use anyhow::anyhow;-use async_trait::async_trait;-use reqwest::StatusCode;-use reqwest::{Error, Response};--#[derive(thiserror::Error, Debug)]-pub enum ClientError {- #[error("request error: {0}")]- Generic(#[from] anyhow::Error),- #[error("network error: {status_code} {message}")]- NetworkError { status_code: u16, message: String },-}--#[async_trait]-pub trait ResponseExt {- async fn map_client_error(self) -> Result<Response, ClientError>;-}--#[async_trait]-impl ResponseExt for Response {- async fn map_client_error(self) -> Result<Response, ClientError> {- match self.status() {- StatusCode::OK | StatusCode::CREATED | StatusCode::ACCEPTED => Ok(self),- _ => Err(ClientError::NetworkError {- status_code: self.status().as_u16(),- message: self.text().await.unwrap_or_default(),- }),- }- }-}--#[async_trait]-impl ResponseExt for Result<Response, Error> {- async fn map_client_error(self) -> Result<Response, ClientError> {- match self {- Ok(response) => response.map_client_error().await,- Err(e) => Err(ClientError::Generic(anyhow!(e.to_string()))),- }- }-}diff --git a/rust/cloud-storage/comms_service_client/src/lib.rs b/rust/cloud-storage/comms_service_client/src/lib.rsdeleted file mode 100644index f02094e0d9..0000000000--- a/rust/cloud-storage/comms_service_client/src/lib.rs+++ /dev/null@@ -1,22 +0,0 @@-pub mod channels;-pub mod error;-pub mod messages;--#[derive(Clone)]-pub struct CommsServiceClient {- url: String,- client: reqwest::Client,-}--impl CommsServiceClient {- pub fn new(url: String) -> Self {- let client = reqwest::Client::builder().build().unwrap();-- Self { url, client }- }-- /// Returns the base URL of the comms service- pub fn url(&self) -> &str {- &self.url- }-}diff --git a/rust/cloud-storage/comms_service_client/src/messages.rs b/rust/cloud-storage/comms_service_client/src/messages.rsdeleted file mode 100644index 71b24cafd7..0000000000--- a/rust/cloud-storage/comms_service_client/src/messages.rs+++ /dev/null@@ -1,42 +0,0 @@-use super::CommsServiceClient;-use crate::error::{ClientError, ResponseExt};-use model::comms::GetMessageWithContextResponse;-use uuid::Uuid;--impl CommsServiceClient {- /// Get messages with context around a specific message- #[tracing::instrument(skip(self, jwt_token))]- pub async fn get_message_with_context(- &self,- message_id: &Uuid,- before: i64,- after: i64,- jwt_token: &str,- ) -> Result<GetMessageWithContextResponse, ClientError> {- let url = format!(- "{}/comms/channels/messages/context?message_id={}&before={}&after={}",- self.url, message_id, before, after- );-- let response = self- .client- .get(&url)- .header("Authorization", format!("Bearer {}", jwt_token))- .send()- .await- .map_client_error()- .await?;-- let result = response- .json::<GetMessageWithContextResponse>()- .await- .map_err(|e| {- ClientError::Generic(anyhow::anyhow!(- "unable to parse response from get_message_with_context: {}",- e- ))- })?;-- Ok(result)- }-}diff --git a/rust/cloud-storage/document_cognition_service/Cargo.toml b/rust/cloud-storage/document_cognition_service/Cargo.tomlindex 40a9a54231..70c809d7d0 100644--- a/rust/cloud-storage/document_cognition_service/Cargo.toml+++ b/rust/cloud-storage/document_cognition_service/Cargo.toml@@ -43,7 +43,6 @@ call = { path = "../call", default-features = false, features = ["ports"] }chat = { path = "../chat", features = ["attachment"] }chrono = { workspace = true }comms = { path = "../comms", features = ["outbound", "attachment"] }-comms_service_client = { path = "../comms_service_client" }connection_gateway = { path = "../connection_gateway" }cookie = { workspace = true }crm = { path = "../crm" }diff --git a/rust/cloud-storage/document_cognition_service/src/api/context/mod.rs b/rust/cloud-storage/document_cognition_service/src/api/context/mod.rsindex b910a41abc..3f0ff97c75 100644--- a/rust/cloud-storage/document_cognition_service/src/api/context/mod.rs+++ b/rust/cloud-storage/document_cognition_service/src/api/context/mod.rs@@ -67,7 +67,6 @@ pub struct ApiContext {pub db: PgPool,pub sqs_client: Arc<sqs_client::SQS>,pub document_storage_client: Arc<DocumentStorageServiceClient>,- pub comms_service_client: Arc<comms_service_client::CommsServiceClient>,pub search_service_client: Arc<SearchServiceClient>,pub email_service_client_external: Arc<email_service_client::EmailServiceClientExternal>,pub jwt_args: JwtValidationArgs,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.rsindex fbea69d3e1..fa9ee611da 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@@ -111,7 +111,6 @@ pub async fn test_api_context(pool: sqlx::Pool<sqlx::Postgres>) -> std::sync::Aruse comms::domain::service::ChannelServiceImpl;use comms::outbound::postgres::comms_repo::PgCommsRepo;use comms::outbound::postgres::user_repo::PgUserRepo;- use comms_service_client::CommsServiceClient;use document_storage_service_client::DocumentStorageServiceClient;use email::domain::ports::ReadonlyEmailPreviewAdapter;use email::domain::service::EmailServiceImpl;@@ -145,7 +144,6 @@ pub async fn test_api_context(pool: sqlx::Pool<sqlx::Postgres>) -> std::sync::Ar"dummy_auth_key".into(),"http://localhost".into(),));- let comms_service_client = Arc::new(CommsServiceClient::new("http://localhost".into()));let search_service_client =SearchServiceClient::new("dummy_auth_key".into(), "http://localhost".into());let sync_service_client = Arc::new(SyncServiceClient::new(@@ -346,7 +344,6 @@ pub async fn test_api_context(pool: sqlx::Pool<sqlx::Postgres>) -> std::sync::Ardb: pool.clone(),sqs_client: Arc::new(sqs_client),document_storage_client,- comms_service_client,search_service_client,email_service_client_external,jwt_args: JwtValidationArgs::new_testing(),diff --git a/rust/cloud-storage/document_cognition_service/src/main.rs b/rust/cloud-storage/document_cognition_service/src/main.rsindex 4bee6c3940..05cda2b2ef 100644--- a/rust/cloud-storage/document_cognition_service/src/main.rs+++ b/rust/cloud-storage/document_cognition_service/src/main.rs@@ -9,7 +9,6 @@ use call::outbound::s3_recording_storage::S3RecordingStorage;use comms::domain::service::ChannelServiceImpl;use comms::outbound::postgres::comms_repo::PgCommsRepo;use comms::outbound::postgres::user_repo::PgUserRepo;-use comms_service_client::CommsServiceClient;use config::{Config, EnvVars, Environment};use document_storage_service_client::DocumentStorageServiceClient;use documents::{@@ -104,10 +103,6 @@ async fn main() -> anyhow::Result<()> {);tracing::info!("initialized dss client");- // Comms service is now served from document_storage_service under /comms prefix- let comms_service_client = CommsServiceClient::new(config.document_storage_service_url.clone());-- tracing::info!("initialized comms client");let sync_service_auth_key = match config.environment {Environment::Local => config.sync_service_auth_key.clone(),_ => secretsmanager_client@@ -434,7 +429,6 @@ async fn main() -> anyhow::Result<()> {email_service_client_external,sqs_client: Arc::new(sqs_client),document_storage_client: Arc::new(document_storage_client),- comms_service_client: Arc::new(comms_service_client),search_service_client,jwt_args,config: Arc::new(config),diff --git a/rust/cloud-storage/document_storage_service/Cargo.toml b/rust/cloud-storage/document_storage_service/Cargo.tomlindex 808876168e..20264cd47a 100644--- a/rust/cloud-storage/document_storage_service/Cargo.toml+++ b/rust/cloud-storage/document_storage_service/Cargo.toml@@ -41,9 +41,8 @@ call = { path = "../call" }channels = { path = "../channels", features = ["inbound", "outbound"] }chrono = { workspace = true }cloudfront_sign = { workspace = true }-comms = { path = "../comms", features = ["outbound"] }+comms = { path = "../comms", features = ["inbound", "outbound"] }comms_db_client = { path = "../comms_db_client" }-comms_service = { path = "../comms_service" }contacts = { path = "../contacts" }connection = { path = "../connection", default-features = false, features = ["outbound",diff --git a/rust/cloud-storage/document_storage_service/src/api/context.rs b/rust/cloud-storage/document_storage_service/src/api/context.rsindex 9f8e8daca6..8430ce8d44 100644--- a/rust/cloud-storage/document_storage_service/src/api/context.rs+++ b/rust/cloud-storage/document_storage_service/src/api/context.rs@@ -36,7 +36,6 @@ use comms::{inbound::router::CommsRouterState,outbound::postgres::{comms_repo::PgCommsRepo, user_repo::PgUserRepo},};-use comms_service::CommsHandlerState;use connection::{domain::service::ConnectionServiceImpl,outbound::connection_gateway_client::ConnectionGatewayImpl,@@ -73,7 +72,6 @@ use properties::{use properties_service::PropertiesHandlerState;use readonly_pool::ReadOnlyPool;use search_service::SearchHandlerState;-use secretsmanager_client::LocalOrRemoteSecret;use soup::{domain::service::SoupImpl, inbound::axum_router::SoupRouterState,outbound::pg_soup_repo::PgSoupRepo,@@ -320,8 +318,6 @@ pub(crate) struct ApiContext {// Comms service fieldspub frecency_storage: FrecencyPgStorage,pub comms_state: CommsState,- pub permissions_token_secret:- LocalOrRemoteSecret<comms_service::DocumentPermissionJwtSecretKey>,pub entity_access_service: Arc<EntityAccessService>,pub documents_state: DocumentsState,pub channels_state: DssChannelsState,@@ -369,26 +365,3 @@ impl FromRef<ApiContext> for SearchHandlerState {SearchHandlerState::from(ctx)}}--impl From<&ApiContext> for CommsHandlerState {- fn from(ctx: &ApiContext) -> Self {- CommsHandlerState {- jwt_validation_args: ctx.jwt_validation_args.clone(),- db: ctx.db.clone(),- connection_gateway_client: ctx.conn_gateway_client.clone(),- notification_ingress_service: ctx.notification_ingress_service.clone(),- sqs_client: ctx.sqs_client.clone(),- contacts_ingress: ctx.contacts_ingress.clone(),- permissions_token_secret: ctx.permissions_token_secret.clone(),- frecency_storage: ctx.frecency_storage.clone(),- comms_state: ctx.comms_state.clone(),- entity_access_service: ctx.entity_access_service.clone(),- }- }-}--impl FromRef<ApiContext> for CommsHandlerState {- fn from_ref(ctx: &ApiContext) -> Self {- CommsHandlerState::from(ctx)- }-}diff --git a/rust/cloud-storage/document_storage_service/src/api/mod.rs b/rust/cloud-storage/document_storage_service/src/api/mod.rsindex 7e72470081..c1c193fe0c 100644--- a/rust/cloud-storage/document_storage_service/src/api/mod.rs+++ b/rust/cloud-storage/document_storage_service/src/api/mod.rs@@ -5,7 +5,6 @@ use axum::extract::FromRef;use axum::extract::Request;use axum::http::Method;use axum::middleware::Next;-use comms_service::CommsHandlerState;use context::InternalFlag;use github::inbound::github_sync_router::GithubSyncRouterState;use macro_axum_utils::compose_layers;@@ -203,8 +202,7 @@ fn api_router(state: ApiContext) -> Router {).nest("/comms",- comms_service::comms_router(&CommsHandlerState::from_ref(&state))- .with_state(CommsHandlerState::from_ref(&state)),+ comms::inbound::router::comms_router(state.comms_state.clone()),).nest("/entity", entity::router()).nest(diff --git a/rust/cloud-storage/document_storage_service/src/api/swagger.rs b/rust/cloud-storage/document_storage_service/src/api/swagger.rsindex 147d3e64d2..f6bcb74c11 100644--- a/rust/cloud-storage/document_storage_service/src/api/swagger.rs+++ b/rust/cloud-storage/document_storage_service/src/api/swagger.rs@@ -65,11 +65,12 @@ use crate::{use channels::inbound::axum_router::{ApiActivity, ApiAttachmentChannelReference, ApiAttachmentEntityReference,ApiAttachmentGenericReference, ApiChannelAttachment, ApiChannelAttachmentsPage,- ApiChannelContextMessage, ApiChannelMessage, ApiChannelMessageKind, ApiChannelMessagesPage,- ApiChannelParticipant, ApiCountedReaction, ApiMessageAttachment, ApiParticipantRole,- ApiResolvedChannelMessage, ApiThreadInfo, ApiThreadReply, ChannelMessageFilters,- CreateEntityMentionRequest, CreateEntityMentionResponse, DeleteEntityMentionResponse,- GetAttachmentReferencesResponse, GetMessageWithContextResponse, PostActivityRequest,+ ApiChannelContextMessage, ApiChannelDetail, ApiChannelMessage, ApiChannelMessageKind,+ ApiChannelMessagesPage, ApiChannelParticipant, ApiCountedReaction, ApiMessageAttachment,+ ApiParticipantRole, ApiResolvedChannelMessage, ApiThreadInfo, ApiThreadReply,+ ChannelMessageFilters, CreateEntityMentionRequest, CreateEntityMentionResponse,+ DeleteEntityMentionResponse, GetAttachmentReferencesResponse, GetMessageWithContextResponse,+ PostActivityRequest,};use document_sub_type::DocumentSubType;use documents_hex::inbound::axum_router::{@@ -218,6 +219,7 @@ use utoipa::OpenApi;channels::inbound::axum_router::get_message_with_context_handler,channels::inbound::axum_router::resolve_channel_message_handler,channels::inbound::axum_router::get_channel_attachments_handler,+ channels::inbound::axum_router::get_channel_handler,channels::inbound::axum_router::get_channel_participants_handler,channels::inbound::axum_router::get_batch_channel_preview_handler,channels::inbound::axum_router::create_mention_handler,@@ -398,6 +400,7 @@ use utoipa::OpenApi;ApiChannelAttachmentsPage,ApiChannelAttachment,ApiChannelParticipant,+ ApiChannelDetail,ApiParticipantRole,GetAttachmentReferencesResponse,ApiAttachmentEntityReference,diff --git a/rust/cloud-storage/document_storage_service/src/main.rs b/rust/cloud-storage/document_storage_service/src/main.rsindex 40d58a994d..1b2bd7cae5 100644--- a/rust/cloud-storage/document_storage_service/src/main.rs+++ b/rust/cloud-storage/document_storage_service/src/main.rs@@ -115,11 +115,6 @@ async fn main() -> anyhow::Result<()> {.get_maybe_secret_value(env, DocumentPermissionJwtSecretKey::new()?).await?;- // Also get it with the comms_service type for CommsHandlerState- let comms_permissions_token_secret = secretsmanager_client- .get_maybe_secret_value(env, comms_service::DocumentPermissionJwtSecretKey::new()?)- .await?;-// Parse our configuration from the environment.let config = Config::from_env(cloudfront_signer_private_key,@@ -321,7 +316,7 @@ async fn main() -> anyhow::Result<()> {frecency_storage.clone(),);- // Create the CommsRouterState for comms_service routes+ // Create the CommsRouterState for the comms hex routes mounted under /comms.let comms_state = CommsRouterState::new(channel_service_for_comms);let s3 = Arc::new(S3::new(@@ -621,7 +616,6 @@ async fn main() -> anyhow::Result<()> {// Comms service fieldsfrecency_storage,comms_state,- permissions_token_secret: comms_permissions_token_secret,entity_access_service: entity_access_service.clone(),documents_state: DocumentRouterState {service: document_service.clone(),diff --git a/rust/cloud-storage/integration_tests/local_e2e/tests/channel_mutations.rs b/rust/cloud-storage/integration_tests/local_e2e/tests/channel_mutations.rsindex d594702b85..24226455a4 100644--- a/rust/cloud-storage/integration_tests/local_e2e/tests/channel_mutations.rs+++ b/rust/cloud-storage/integration_tests/local_e2e/tests/channel_mutations.rs@@ -34,7 +34,7 @@ struct ChannelApiClient {impl ChannelApiClient {/// Channels API under test./// Override mutations with `LOCAL_E2E_CHANNELS_BASE_URL=http://.../channels`.- /// Override the read-model API with `LOCAL_E2E_CHANNELS_READ_BASE_URL=http://.../comms/channels`.+ /// Override the read-model API with `LOCAL_E2E_CHANNELS_READ_BASE_URL=http://.../channels`.fn from_config(config: &LocalE2eConfig, services: &LocalE2eServices) -> Self {let mutation_base_url = config.get("LOCAL_E2E_CHANNELS_BASE_URL")@@ -45,7 +45,7 @@ impl ChannelApiClient {.get("LOCAL_E2E_CHANNELS_READ_BASE_URL").or_else(|| config.get("LOCAL_E2E_NEW_CHANNELS_READ_BASE_URL")).map(str::to_string)- .unwrap_or_else(|| format!("{}/comms/channels", services.document_storage_url()));+ .unwrap_or_else(|| format!("{}/channels", services.document_storage_url()));Self {label: "channels".to_string(),mutation_base_url: trim_trailing_slash(&mutation_base_url),diff --git a/rust/cloud-storage/justfile b/rust/cloud-storage/justfileindex daa2e97d65..32ca73793e 100644--- a/rust/cloud-storage/justfile+++ b/rust/cloud-storage/justfile@@ -83,7 +83,6 @@ setup_test_envs:echo "DATABASE_URL={{ DATABASE_URL }}" >> ./email_scheduled_handler/.envecho "DATABASE_URL={{ DATABASE_URL }}" >> ./saved_views/.envecho "DATABASE_URL={{ DATABASE_URL }}" >> ./channels/.env- echo "DATABASE_URL={{ DATABASE_URL }}" >> ./comms_service/.envecho "DATABASE_URL={{ DATABASE_URL }}" >> ./documents/.envecho "DATABASE_URL={{ DATABASE_URL }}" >> ./foreign_entity/.envecho "DATABASE_URL={{ DATABASE_URL }}" >> ./stream/.envdiff --git a/rust/cloud-storage/local_e2e_test_support/src/services.rs b/rust/cloud-storage/local_e2e_test_support/src/services.rsindex bcfff06c49..e2086cd79f 100644--- a/rust/cloud-storage/local_e2e_test_support/src/services.rs+++ b/rust/cloud-storage/local_e2e_test_support/src/services.rs@@ -127,12 +127,9 @@ impl LocalE2eServices {)}- /// URL for fetching channel data through document storage's comms API.+ /// URL for fetching channel data through document storage's channels hex API.pub fn get_channel_url(&self, channel_id: &str) -> String {- format!(- "{}/comms/channels/{}",- self.document_storage_url, channel_id- )+ format!("{}/channels/{}", self.document_storage_url, channel_id)}/// URL for patching or deleting a channel through document storage's channels hex API.diff --git a/rust/cloud-storage/models_comms/src/lib.rs b/rust/cloud-storage/models_comms/src/lib.rsindex f333359c6f..ff02972763 100644--- a/rust/cloud-storage/models_comms/src/lib.rs+++ b/rust/cloud-storage/models_comms/src/lib.rs@@ -1,2 +1 @@pub mod channel;-pub mod mentions;diff --git a/rust/cloud-storage/models_comms/src/mentions.rs b/rust/cloud-storage/models_comms/src/mentions.rsdeleted file mode 100644index 7fe4a39b6c..0000000000--- a/rust/cloud-storage/models_comms/src/mentions.rs+++ /dev/null@@ -1,18 +0,0 @@-use serde::{Deserialize, Serialize};-use uuid::Uuid;--#[derive(Debug, Serialize, Deserialize)]-pub struct DeleteMentionsRequest {- pub item_ids: Vec<String>,-}--#[derive(Debug, Clone, Serialize, Deserialize)]-pub struct EntityMention {- pub id: Uuid,- pub source_entity_type: String,- pub source_entity_id: String,- pub entity_type: String,- pub entity_id: String,- pub user_id: Option<String>,- pub created_at: chrono::DateTime<chrono::Utc>,-}diff --git a/rust/cloud-storage/notification_service/Cargo.toml b/rust/cloud-storage/notification_service/Cargo.tomlindex dbd98501bb..271ee0adcc 100644--- a/rust/cloud-storage/notification_service/Cargo.toml+++ b/rust/cloud-storage/notification_service/Cargo.toml@@ -77,6 +77,3 @@ uuid = { workspace = true }[dev-dependencies]macro_auth = { path = "../macro_auth", features = ["testing"] }--[package.metadata.cargo-machete]-ignored = ["comms_service"]