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
feat(channels): port /activity endpoints to channels hex [3/7] (#3638)
teo4a6edb003967
diff --git a/js/app/packages/core/context/channels.ts b/js/app/packages/core/context/channels.tsindex dc133e5d12..027503b463 100644--- a/js/app/packages/core/context/channels.ts+++ b/js/app/packages/core/context/channels.ts@@ -3,10 +3,8 @@ 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,- ApiActivity as ChannelsActivity,-} from '@service-comms/generated/models';+import type { ApiChannelWithLatest } from '@service-comms/generated/models';+import type { ApiActivity as ChannelsActivity } from '@service-storage/generated/schemas/apiActivity';import { type Accessor, createMemo } from 'solid-js';import { createAssertedContextProvider } from './createContext';import { useUserId } from './user';diff --git a/js/app/packages/queries/channel/activity.ts b/js/app/packages/queries/channel/activity.tsindex 0157e98917..c7112f7804 100644--- a/js/app/packages/queries/channel/activity.ts+++ b/js/app/packages/queries/channel/activity.ts@@ -1,18 +1,16 @@import { throwOnErr } from '@core/util/result';import { queryClient } from '@queries/client';import { type MutationCallbacks, withCallbacks } from '@queries/utils';-import { commsServiceClient } from '@service-comms/client';-import type {- ActivityType,- ApiActivity as ChannelsActivity,-} from '@service-comms/generated/models';+import { storageServiceClient } from '@service-storage/client';+import type { ActivityType } from '@service-storage/generated/schemas/activityType';+import type { ApiActivity as ChannelsActivity } from '@service-storage/generated/schemas/apiActivity';import { useMutation, useQuery } from '@tanstack/solid-query';import { channelKeys } from './keys';export function useChannelsActivityQuery() {return useQuery(() => ({queryKey: channelKeys.activity.queryKey,- queryFn: async () => await throwOnErr(commsServiceClient.getActivity),+ queryFn: async () => await throwOnErr(storageServiceClient.getActivity),}));}@@ -33,7 +31,7 @@ export function useUpdateChannelsActivityMutation(mutationFn: async (vars: UpdateChannelActivityMutationVars) =>await throwOnErr(async () =>- await commsServiceClient.postActivity({+ await storageServiceClient.postActivity({channel_id: vars.channelId,activity_type: vars.activityType,})diff --git a/js/app/packages/service-clients/service-storage/client.ts b/js/app/packages/service-clients/service-storage/client.tsindex 2a4d796d17..2acef30907 100644--- a/js/app/packages/service-clients/service-storage/client.ts+++ b/js/app/packages/service-clients/service-storage/client.ts@@ -40,6 +40,7 @@ import type {import type { AddParticipantsRequest } from './generated/schemas/addParticipantsRequest';import type { AddPinRequest } from './generated/schemas/addPinRequest';import type { AnchorResponse } from './generated/schemas/anchorResponse';+import type { ApiActivity } from './generated/schemas/apiActivity';import type { ApiChannelAttachmentsPage } from './generated/schemas/apiChannelAttachmentsPage';import type { ApiChannelMessagesPage } from './generated/schemas/apiChannelMessagesPage';import type { ApiChannelParticipant } from './generated/schemas/apiChannelParticipant';@@ -96,6 +97,7 @@ import type { LocationResponseV3 } from './generated/schemas/locationResponseV3'import type { PatchChannelRequest } from './generated/schemas/patchChannelRequest';import type { PatchMessageRequest } from './generated/schemas/patchMessageRequest';import type { PinRequest } from './generated/schemas/pinRequest';+import type { PostActivityRequest } from './generated/schemas/postActivityRequest';import type { PostMessageRequest } from './generated/schemas/postMessageRequest';import type { PostMessageResponse } from './generated/schemas/postMessageResponse';import type { PostReactionRequest } from './generated/schemas/postReactionRequest';@@ -712,6 +714,24 @@ export const storageServiceClient = {).map((result) => result);},+ async getActivity() {+ return (+ await dssFetch<Array<ApiActivity>>(`/channels/activity`, {+ method: 'GET',+ })+ ).map((result) => result);+ },++ async postActivity(args: PostActivityRequest) {+ const { activity_type, channel_id } = args;+ return (+ await dssFetch<ApiActivity>(`/channels/activity`, {+ method: 'POST',+ body: JSON.stringify({ activity_type, channel_id }),+ })+ ).map((result) => result);+ },+permissionsTokens: {// Uses SYNC_PERMISSION_TOKEN_DSS_HOST instead of dssFetch so that tokens are// always signed by the DSS whose JWT secret matches the sync service's secret.diff --git a/js/app/packages/service-clients/service-storage/generated/schemas/activityType.ts b/js/app/packages/service-clients/service-storage/generated/schemas/activityType.tsnew file mode 100644index 0000000000..1c8ee1cdbf--- /dev/null+++ b/js/app/packages/service-clients/service-storage/generated/schemas/activityType.ts@@ -0,0 +1,17 @@+/**+ * Generated by orval v7.21.0 🍺+ * Do not edit manually.+ * document_storage_service+ * OpenAPI spec version: 0.1.0+ */++/**+ * The kind of activity a user performs in a channel.+ */+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-storage/generated/schemas/apiActivity.ts b/js/app/packages/service-clients/service-storage/generated/schemas/apiActivity.tsnew file mode 100644index 0000000000..b3f18b4437--- /dev/null+++ b/js/app/packages/service-clients/service-storage/generated/schemas/apiActivity.ts@@ -0,0 +1,28 @@+/**+ * Generated by orval v7.21.0 🍺+ * Do not edit manually.+ * document_storage_service+ * OpenAPI spec version: 0.1.0+ */+import type { ApiActivityInteractedAt } from './apiActivityInteractedAt';+import type { ApiActivityViewedAt } from './apiActivityViewedAt';++/**+ * A user's activity (view/interaction) within a channel.+ */+export interface ApiActivity {+ /** Channel id. */+ channel_id: string;+ /** When the activity row was created. */+ created_at: string;+ /** Activity id. */+ id: string;+ /** The last time the user interacted with the channel. */+ interacted_at?: ApiActivityInteractedAt;+ /** When the activity row was last updated. */+ updated_at: string;+ /** User id. */+ user_id: string;+ /** The last time the user viewed the channel. */+ viewed_at?: ApiActivityViewedAt;+}diff --git a/js/app/packages/service-clients/service-storage/generated/schemas/apiActivityInteractedAt.ts b/js/app/packages/service-clients/service-storage/generated/schemas/apiActivityInteractedAt.tsnew file mode 100644index 0000000000..f334d192be--- /dev/null+++ b/js/app/packages/service-clients/service-storage/generated/schemas/apiActivityInteractedAt.ts@@ -0,0 +1,11 @@+/**+ * Generated by orval v7.21.0 🍺+ * Do not edit manually.+ * document_storage_service+ * OpenAPI spec version: 0.1.0+ */++/**+ * The last time the user interacted with the channel.+ */+export type ApiActivityInteractedAt = string | null;diff --git a/js/app/packages/service-clients/service-storage/generated/schemas/apiActivityViewedAt.ts b/js/app/packages/service-clients/service-storage/generated/schemas/apiActivityViewedAt.tsnew file mode 100644index 0000000000..6152738da2--- /dev/null+++ b/js/app/packages/service-clients/service-storage/generated/schemas/apiActivityViewedAt.ts@@ -0,0 +1,11 @@+/**+ * Generated by orval v7.21.0 🍺+ * Do not edit manually.+ * document_storage_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-storage/generated/schemas/index.ts b/js/app/packages/service-clients/service-storage/generated/schemas/index.tsindex aeaf57bfa8..b7beeae6d1 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@@ -9,6 +9,7 @@ export * from './accessLevel';export * from './activity';export * from './activityOneOf';export * from './activityOneOfTwo';+export * from './activityType';export * from './addParticipantsRequest';export * from './addPinRequest';export * from './anchor';@@ -40,6 +41,9 @@ export * from './annotationIncrementalUpdateOneOfSeven';export * from './annotationIncrementalUpdateOneOfSevenPayload';export * from './annotationIncrementalUpdateOneOfSevenUpdateType';export * from './annotationIncrementalUpdateOneOfUpdateType';+export * from './apiActivity';+export * from './apiActivityInteractedAt';+export * from './apiActivityViewedAt';export * from './apiAttachmentChannelReference';export * from './apiAttachmentChannelReferenceChannelName';export * from './apiAttachmentChannelReferenceThreadId';@@ -578,6 +582,7 @@ export * from './pdfPlaceableCommentAnchorRequest';export * from './pdfPlaceableCommentAnchorRequestUuid';export * from './pinnedItem';export * from './pinRequest';+export * from './postActivityRequest';export * from './postChannelMessagesParams';export * from './postItemsSoupAstParams';export * from './postItemsSoupParams';diff --git a/js/app/packages/service-clients/service-storage/generated/schemas/postActivityRequest.ts b/js/app/packages/service-clients/service-storage/generated/schemas/postActivityRequest.tsnew file mode 100644index 0000000000..435173960e--- /dev/null+++ b/js/app/packages/service-clients/service-storage/generated/schemas/postActivityRequest.ts@@ -0,0 +1,17 @@+/**+ * Generated by orval v7.21.0 🍺+ * Do not edit manually.+ * document_storage_service+ * OpenAPI spec version: 0.1.0+ */+import type { ActivityType } from './activityType';++/**+ * Request body for `POST /channels/activity`.+ */+export interface PostActivityRequest {+ /** The kind of activity to record. */+ activity_type: ActivityType;+ /** Channel id to record activity for. */+ channel_id: string;+}diff --git a/js/app/packages/service-clients/service-storage/generated/zod.ts b/js/app/packages/service-clients/service-storage/generated/zod.tsindex 635f6455ef..d9896dee5a 100644--- a/js/app/packages/service-clients/service-storage/generated/zod.ts+++ b/js/app/packages/service-clients/service-storage/generated/zod.ts@@ -1266,6 +1266,66 @@ export const createChannelResponse = zod}).describe('Response returned after creating a channel.');+/**+ * @summary Handler for `GET /channels/activity`.+ */+export const getActivityResponseItem = zod+ .object({+ channel_id: zod.uuid().describe('Channel id.'),+ created_at: zod.iso+ .datetime({})+ .describe('When the activity row was created.'),+ id: zod.uuid().describe('Activity id.'),+ interacted_at: zod.iso+ .datetime({})+ .nullish()+ .describe('The last time the user interacted with the channel.'),+ updated_at: zod.iso+ .datetime({})+ .describe('When the activity row was last updated.'),+ user_id: zod.string().describe('User id.'),+ viewed_at: zod.iso+ .datetime({})+ .nullish()+ .describe('The last time the user viewed the channel.'),+ })+ .describe("A user's activity (view\/interaction) within a channel.");+export const getActivityResponse = zod.array(getActivityResponseItem);++/**+ * @summary Handler for `POST /channels/activity`.+ */+export const postActivityBody = zod+ .object({+ activity_type: zod+ .enum(['view', 'interact'])+ .describe('The kind of activity a user performs in a channel.'),+ channel_id: zod.string().describe('Channel id to record activity for.'),+ })+ .describe('Request body for `POST \/channels\/activity`.');++export const postActivityResponse = zod+ .object({+ channel_id: zod.uuid().describe('Channel id.'),+ created_at: zod.iso+ .datetime({})+ .describe('When the activity row was created.'),+ id: zod.uuid().describe('Activity id.'),+ interacted_at: zod.iso+ .datetime({})+ .nullish()+ .describe('The last time the user interacted with the channel.'),+ updated_at: zod.iso+ .datetime({})+ .describe('When the activity row was last updated.'),+ user_id: zod.string().describe('User id.'),+ viewed_at: zod.iso+ .datetime({})+ .nullish()+ .describe('The last time the user viewed the channel.'),+ })+ .describe("A user's activity (view\/interaction) within a channel.");+/*** @summary Handler for `GET /channels/attachments/{entity_type}/{entity_id}/references`.*/diff --git a/js/app/packages/service-clients/service-storage/openapi.json b/js/app/packages/service-clients/service-storage/openapi.jsonindex 6ec3e2ed1c..96975b42d3 100644--- a/js/app/packages/service-clients/service-storage/openapi.json+++ b/js/app/packages/service-clients/service-storage/openapi.json@@ -1295,6 +1295,125 @@}}},+ "/channels/activity": {+ "get": {+ "tags": ["channels"],+ "summary": "Handler for `GET /channels/activity`.",+ "operationId": "get_activity",+ "responses": {+ "200": {+ "description": "",+ "content": {+ "application/json": {+ "schema": {+ "type": "array",+ "items": {+ "$ref": "#/components/schemas/ApiActivity"+ }+ }+ }+ }+ },+ "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"+ }+ }+ }+ }+ }+ },+ "post": {+ "tags": ["channels"],+ "summary": "Handler for `POST /channels/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/ApiActivity"+ }+ }+ }+ },+ "400": {+ "description": "",+ "content": {+ "application/json": {+ "schema": {+ "$ref": "#/components/schemas/ErrorResponse"+ }+ }+ }+ },+ "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"+ }+ }+ }+ }+ }+ }+ },"/channels/attachments/{entity_type}/{entity_id}/references": {"get": {"tags": ["channels::inbound::axum_router"],@@ -7626,6 +7745,11 @@}]},+ "ActivityType": {+ "type": "string",+ "description": "The kind of activity a user performs in a channel.",+ "enum": ["view", "interact"]+ },"AddParticipantsRequest": {"type": "object","description": "Request to add participants.",@@ -7870,6 +7994,47 @@}]},+ "ApiActivity": {+ "type": "object",+ "description": "A user's activity (view/interaction) within a channel.",+ "required": ["id", "user_id", "channel_id", "created_at", "updated_at"],+ "properties": {+ "channel_id": {+ "type": "string",+ "format": "uuid",+ "description": "Channel id."+ },+ "created_at": {+ "type": "string",+ "format": "date-time",+ "description": "When the activity row was created."+ },+ "id": {+ "type": "string",+ "format": "uuid",+ "description": "Activity id."+ },+ "interacted_at": {+ "type": ["string", "null"],+ "format": "date-time",+ "description": "The last time the user interacted with the channel."+ },+ "updated_at": {+ "type": "string",+ "format": "date-time",+ "description": "When the activity row was last updated."+ },+ "user_id": {+ "type": "string",+ "description": "User id."+ },+ "viewed_at": {+ "type": ["string", "null"],+ "format": "date-time",+ "description": "The last time the user viewed the channel."+ }+ }+ },"ApiAttachmentChannelReference": {"type": "object","description": "A reference to an attachment entity from a channel message.",@@ -13299,6 +13464,21 @@}}},+ "PostActivityRequest": {+ "type": "object",+ "description": "Request body for `POST /channels/activity`.",+ "required": ["channel_id", "activity_type"],+ "properties": {+ "activity_type": {+ "$ref": "#/components/schemas/ActivityType",+ "description": "The kind of activity to record."+ },+ "channel_id": {+ "type": "string",+ "description": "Channel id to record activity for."+ }+ }+ },"PostMessageRequest": {"type": "object","description": "Request to send a channel message.",diff --git a/rust/cloud-storage/channels/src/domain/models.rs b/rust/cloud-storage/channels/src/domain/models.rsindex c57c43f91c..0dce470c18 100644--- a/rust/cloud-storage/channels/src/domain/models.rs+++ b/rust/cloud-storage/channels/src/domain/models.rs@@ -439,6 +439,37 @@ pub enum ChannelType {Team,}+/// A user's activity (view/interaction) within a channel.+#[derive(Debug, Clone, Serialize, Deserialize)]+pub struct Activity {+ /// Activity row id.+ pub id: Uuid,+ /// Id of the user this activity belongs to.+ pub user_id: String,+ /// Id of the channel this activity is for.+ pub channel_id: Uuid,+ /// When the activity row was created.+ pub created_at: DateTime<Utc>,+ /// When the activity row was last updated.+ pub updated_at: DateTime<Utc>,+ /// The last time the user viewed the channel.+ pub viewed_at: Option<DateTime<Utc>>,+ /// The last time the user interacted with the channel+ /// (e.g. reacting, replying, sending a message).+ pub interacted_at: Option<DateTime<Utc>>,+}++/// The kind of activity a user performs in a channel.+#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]+#[cfg_attr(feature = "inbound", derive(utoipa::ToSchema))]+#[serde(rename_all = "lowercase")]+pub enum ActivityType {+ /// The user viewed the channel.+ View,+ /// The user interacted with the channel.+ Interact,+}+/// Result of a get-or-create channel operation.#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]#[cfg_attr(feature = "inbound", derive(utoipa::ToSchema))]diff --git a/rust/cloud-storage/channels/src/domain/ports.rs b/rust/cloud-storage/channels/src/domain/ports.rsindex 50bc40872a..5ab1dd1ade 100644--- a/rust/cloud-storage/channels/src/domain/ports.rs+++ b/rust/cloud-storage/channels/src/domain/ports.rs@@ -1,15 +1,15 @@use crate::domain::events::ChannelEvent;use crate::domain::models::{- AddParticipantsRequest, AttachmentEntityReference, ChannelAttachment, ChannelAttachmentType,- ChannelContextMessage, ChannelInfo, ChannelMessageFilters, ChannelMetadata, ChannelParticipant,- ChannelPreview, ChannelPreviewRow, CountedReaction, CreateChannelRequest,- CreateChannelResponse, CreateEntityMentionOptions, DeleteMessageQuery, EntityMention,- GetOrCreateChannelResponse, GetOrCreateDmRequest, GetOrCreatePrivateRequest, MessageAttachment,- MessagePageDirection, MutatedAttachment, MutatedMessage, NewChannelAttachment,- PatchChannelRequest, PatchMessageRequest, PostMessageRequest, PostMessageResponse,- PostReactionRequest, PostTypingRequest, ReferencedShareItem, RemoveParticipantsRequest,- ResolvedChannelMessage, SimpleMention, ThreadData, ThreadReply, ThreadReplyRow,- TopLevelMessageRow,+ Activity, ActivityType, AddParticipantsRequest, AttachmentEntityReference, ChannelAttachment,+ ChannelAttachmentType, ChannelContextMessage, ChannelInfo, ChannelMessageFilters,+ ChannelMetadata, ChannelParticipant, ChannelPreview, ChannelPreviewRow, CountedReaction,+ CreateChannelRequest, CreateChannelResponse, CreateEntityMentionOptions, DeleteMessageQuery,+ EntityMention, GetOrCreateChannelResponse, GetOrCreateDmRequest, GetOrCreatePrivateRequest,+ MessageAttachment, MessagePageDirection, MutatedAttachment, MutatedMessage,+ NewChannelAttachment, PatchChannelRequest, PatchMessageRequest, PostMessageRequest,+ PostMessageResponse, PostReactionRequest, PostTypingRequest, ReferencedShareItem,+ RemoveParticipantsRequest, ResolvedChannelMessage, SimpleMention, ThreadData, ThreadReply,+ ThreadReplyRow, TopLevelMessageRow,};use crate::domain::side_effects::{ChannelDocumentMention, ChannelNotificationEffect, ChannelRealtimeEffect,@@ -331,6 +331,20 @@ pub trait ChannelRepo: Send + Sync + 'static {channel_id: Uuid,) -> impl Future<Output = Result<(), Self::Err>> + Send;+ /// Fetch all activities for a user across channels, most-recent first.+ fn get_activities(+ &self,+ user_id: String,+ ) -> impl Future<Output = Result<Vec<Activity>, Self::Err>> + Send;++ /// Upsert the user's activity for a channel with the given type, returning the row.+ fn set_activity(+ &self,+ user_id: String,+ channel_id: Uuid,+ activity_type: ActivityType,+ ) -> impl Future<Output = Result<Activity, Self::Err>> + Send;+/// Add a reaction to a message within a channel.fn add_reaction(&self,@@ -447,6 +461,14 @@ pub trait ChannelService: Send + Sync + 'static {async move { Err(ChannelMessagesErr::MessageNotFound(message_id)) }}+ /// Fetch all activities for the user across channels.+ fn get_activities(+ &self,+ _user_id: String,+ ) -> impl Future<Output = Result<Vec<Activity>, ChannelMessagesErr>> + Send {+ async move { Ok(Vec::new()) }+ }+// Channel mutation operations./// Create a channel.@@ -678,6 +700,20 @@ pub trait ChannelService: Send + Sync + 'static {))}}++ /// Upsert the user's activity (view/interaction) for a channel.+ fn post_activity(+ &self,+ _user_id: String,+ _channel_id: Uuid,+ _activity_type: ActivityType,+ ) -> impl Future<Output = Result<Activity, ChannelMutationErr>> + Send {+ async move {+ Err(ChannelMutationErr::NotFound(+ "channel mutations are not configured".to_string(),+ ))+ }+ }}/// A paginated page of channel messages.diff --git a/rust/cloud-storage/channels/src/domain/service.rs b/rust/cloud-storage/channels/src/domain/service.rsindex 00a34ab831..23caa2f772 100644--- a/rust/cloud-storage/channels/src/domain/service.rs+++ b/rust/cloud-storage/channels/src/domain/service.rs@@ -1,15 +1,16 @@use crate::domain::{events::ChannelEvent,models::{- AddParticipantsRequest, AttachmentEntityReference, ChannelAttachmentType,- ChannelContextMessage, ChannelMessage, ChannelMessageFilters, ChannelParticipant,- ChannelPreview, ChannelPreviewData, ChannelType, CreateEntityMentionOptions,- DeleteMessageQuery, EntityMention, GetOrCreateAction, GetOrCreateChannelResponse,- GetOrCreateDmRequest, GetOrCreatePrivateRequest, MessagePageDirection,- NewChannelAttachment, ParticipantRole, PatchChannelRequest, PatchMessageRequest,- PostMessageRequest, PostMessageResponse, PostReactionRequest, PostTypingRequest,- ReactionAction, ReferencedShareItem, RemoveParticipantsRequest, ResolvedChannelMessage,- SimpleMention, ThreadInfo, ThreadReply, TopLevelMessageRow, WithChannelId,+ Activity, ActivityType, AddParticipantsRequest, AttachmentEntityReference,+ ChannelAttachmentType, ChannelContextMessage, ChannelMessage, ChannelMessageFilters,+ ChannelParticipant, ChannelPreview, ChannelPreviewData, ChannelType,+ CreateEntityMentionOptions, DeleteMessageQuery, EntityMention, GetOrCreateAction,+ GetOrCreateChannelResponse, GetOrCreateDmRequest, GetOrCreatePrivateRequest,+ MessagePageDirection, NewChannelAttachment, ParticipantRole, PatchChannelRequest,+ PatchMessageRequest, PostMessageRequest, PostMessageResponse, PostReactionRequest,+ PostTypingRequest, ReactionAction, ReferencedShareItem, RemoveParticipantsRequest,+ ResolvedChannelMessage, SimpleMention, ThreadInfo, ThreadReply, TopLevelMessageRow,+ WithChannelId,},ports::{ChannelAttachmentsPage, ChannelEventDispatcher, ChannelMessagesErr,@@ -1255,6 +1256,33 @@ whereOk(previews)}+ #[tracing::instrument(err, skip(self))]+ async fn get_activities(&self, user_id: String) -> Result<Vec<Activity>, ChannelMessagesErr> {+ let activities = self+ .repo+ .get_activities(user_id)+ .await+ .map_err(anyhow::Error::from)?;++ Ok(activities)+ }++ #[tracing::instrument(err, skip(self))]+ async fn post_activity(+ &self,+ user_id: String,+ channel_id: Uuid,+ activity_type: ActivityType,+ ) -> Result<Activity, ChannelMutationErr> {+ let activity = self+ .repo+ .set_activity(user_id, channel_id, activity_type)+ .await+ .map_err(anyhow::Error::from)?;++ Ok(activity)+ }+#[tracing::instrument(err, skip(self))]async fn get_message_context(&self,diff --git a/rust/cloud-storage/channels/src/domain/service/test.rs b/rust/cloud-storage/channels/src/domain/service/test.rsindex 183099cbe0..06eaa5e5b5 100644--- a/rust/cloud-storage/channels/src/domain/service/test.rs+++ b/rust/cloud-storage/channels/src/domain/service/test.rs@@ -2,13 +2,13 @@ use super::*;use crate::domain::{events::ChannelEvent,models::{- ChannelAttachment, ChannelAttachmentType, ChannelContextMessage, ChannelInfo,- ChannelMessageFilters, ChannelMetadata, ChannelParticipant, ChannelType, CountedReaction,- CreateEntityMentionOptions, EntityMention, MessageAttachment, MessagePageDirection,- MutatedAttachment, MutatedMessage, NewChannelAttachment, ParticipantRole,- PatchChannelRequest, PatchMessageRequest, PostMessageRequest, PostReactionRequest,- ReactionAction, ReferencedShareItem, ReferencedShareItemType, ResolvedChannelMessage,- SimpleMention, ThreadData, ThreadReplyRow, TopLevelMessageRow,+ Activity, ActivityType, ChannelAttachment, ChannelAttachmentType, ChannelContextMessage,+ ChannelInfo, ChannelMessageFilters, ChannelMetadata, ChannelParticipant, ChannelType,+ CountedReaction, CreateEntityMentionOptions, EntityMention, MessageAttachment,+ MessagePageDirection, MutatedAttachment, MutatedMessage, NewChannelAttachment,+ ParticipantRole, PatchChannelRequest, PatchMessageRequest, PostMessageRequest,+ PostReactionRequest, ReactionAction, ReferencedShareItem, ReferencedShareItemType,+ ResolvedChannelMessage, SimpleMention, ThreadData, ThreadReplyRow, TopLevelMessageRow,},ports::{ChannelEventDispatcher, ChannelReferenceSharePermissions, ChannelRepo, MockChannelRepo,@@ -597,6 +597,28 @@ impl ChannelRepo for FakeMutationRepo {Ok(())}+ async fn get_activities(&self, _user_id: String) -> Result<Vec<Activity>, Self::Err> {+ Ok(Vec::new())+ }++ async fn set_activity(+ &self,+ user_id: String,+ channel_id: Uuid,+ _activity_type: ActivityType,+ ) -> Result<Activity, Self::Err> {+ self.state.lock().unwrap().activity_upserts += 1;+ Ok(Activity {+ id: Uuid::nil(),+ user_id,+ channel_id,+ created_at: Utc::now(),+ updated_at: Utc::now(),+ viewed_at: None,+ interacted_at: None,+ })+ }+async fn add_reaction(&self,_channel_id: Uuid,diff --git a/rust/cloud-storage/channels/src/inbound/axum_router.rs b/rust/cloud-storage/channels/src/inbound/axum_router.rsindex 3afc10dd18..9d5202037e 100644--- a/rust/cloud-storage/channels/src/inbound/axum_router.rs+++ b/rust/cloud-storage/channels/src/inbound/axum_router.rs@@ -1,6 +1,13 @@#[cfg(test)]mod test;+use crate::domain::models::{+ Activity, ActivityType, AttachmentChannelReference, AttachmentEntityReference,+ AttachmentGenericReference, ChannelAttachment, ChannelAttachmentType, ChannelContextMessage,+ ChannelMessage, ChannelMessageKind, ChannelParticipant, CountedReaction,+ CreateEntityMentionOptions, MessageAttachment, MessagePageDirection, ParticipantRole,+ ResolvedChannelMessage, ThreadInfo, ThreadReply,+};pub use crate::domain::models::{AddParticipantsRequest, ChannelPreview, ChannelPreviewData, CreateChannelRequest,CreateChannelResponse, CreateEntityMentionRequest, CreateEntityMentionResponse,@@ -10,13 +17,6 @@ pub use crate::domain::models::{PostMessageResponse, PostReactionRequest, PostTypingRequest, RemoveParticipantsRequest,WithChannelId,};-use crate::domain::models::{- AttachmentChannelReference, AttachmentEntityReference, AttachmentGenericReference,- ChannelAttachment, ChannelAttachmentType, ChannelContextMessage, ChannelMessage,- ChannelMessageKind, ChannelParticipant, CountedReaction, CreateEntityMentionOptions,- MessageAttachment, MessagePageDirection, ParticipantRole, ResolvedChannelMessage, ThreadInfo,- ThreadReply,-};pub use crate::domain::models::{ChannelMessageFilters, NotificationFilters};use crate::domain::ports::{ChannelMessagesErr, ChannelMessagesPage, ChannelMessagesQueryResult, ChannelMutationErr,@@ -312,6 +312,10 @@ where"/attachments/{entity_type}/{entity_id}/references",get(get_attachment_references_handler::<S, Svc>),)+ .route(+ "/activity",+ get(get_activity_handler::<S, Svc>).post(post_activity_handler::<S, Svc>),+ ).with_state(state)}@@ -1371,6 +1375,109 @@ pub async fn get_attachment_references_handler<S: ChannelService, Svc: EntityAcc}))}+/// Handler for `GET /channels/activity`.+#[utoipa::path(+ get,+ tag = "channels",+ operation_id = "get_activity",+ path = "/channels/activity",+ responses(+ (status = 200, body = Vec<ApiActivity>),+ (status = 401, body = ErrorResponse),+ (status = 404, body = ErrorResponse),+ (status = 500, body = ErrorResponse),+ )+)]+#[tracing::instrument(err, skip_all)]+pub async fn get_activity_handler<S: ChannelService, Svc: EntityAccessService>(+ State(state): State<ChannelsRouterState<S, Svc>>,+ user: MacroUserExtractor,+) -> Result<Json<Vec<ApiActivity>>, ChannelsHandlerErr> {+ let activities = state+ .service+ .get_activities(user.macro_user_id.to_string())+ .await?;+ Ok(Json(+ activities.into_iter().map(ApiActivity::from).collect(),+ ))+}++/// Handler for `POST /channels/activity`.+#[utoipa::path(+ post,+ tag = "channels",+ operation_id = "post_activity",+ path = "/channels/activity",+ request_body = PostActivityRequest,+ responses(+ (status = 200, body = ApiActivity),+ (status = 400, body = ErrorResponse),+ (status = 401, body = ErrorResponse),+ (status = 404, body = ErrorResponse),+ (status = 500, body = ErrorResponse),+ )+)]+#[tracing::instrument(err, skip_all)]+pub async fn post_activity_handler<S: ChannelService, Svc: EntityAccessService>(+ State(state): State<ChannelsRouterState<S, Svc>>,+ user: MacroUserExtractor,+ Json(req): Json<PostActivityRequest>,+) -> Result<(StatusCode, Json<ApiActivity>), ChannelsHandlerErr> {+ let channel_id = Uuid::parse_str(&req.channel_id)+ .map_err(|_| ChannelsHandlerErr::BadRequest("Invalid channel_id"))?;+ let activity = state+ .service+ .post_activity(+ user.macro_user_id.to_string(),+ channel_id,+ req.activity_type,+ )+ .await?;+ Ok((StatusCode::OK, Json(ApiActivity::from(activity))))+}++/// Request body for `POST /channels/activity`.+#[derive(Debug, Deserialize, utoipa::ToSchema)]+pub struct PostActivityRequest {+ /// Channel id to record activity for.+ pub channel_id: String,+ /// The kind of activity to record.+ pub activity_type: ActivityType,+}++/// A user's activity (view/interaction) within a channel.+#[derive(Debug, Serialize, utoipa::ToSchema)]+pub struct ApiActivity {+ /// Activity id.+ id: Uuid,+ /// User id.+ user_id: String,+ /// Channel id.+ channel_id: Uuid,+ /// When the activity row was created.+ created_at: DateTime<Utc>,+ /// When the activity row was last updated.+ updated_at: DateTime<Utc>,+ /// The last time the user viewed the channel.+ viewed_at: Option<DateTime<Utc>>,+ /// The last time the user interacted with the channel.+ interacted_at: Option<DateTime<Utc>>,+}++impl From<Activity> for ApiActivity {+ fn from(a: Activity) -> Self {+ Self {+ id: a.id,+ user_id: a.user_id,+ channel_id: a.channel_id,+ created_at: a.created_at,+ updated_at: a.updated_at,+ viewed_at: a.viewed_at,+ interacted_at: a.interacted_at,+ }+ }+}+/// Paginated response of channel messages.#[derive(Debug, Serialize, utoipa::ToSchema)]pub struct ApiChannelMessagesPage {diff --git a/rust/cloud-storage/channels/src/inbound/axum_router/test.rs b/rust/cloud-storage/channels/src/inbound/axum_router/test.rsindex 900ca017f4..0b0bed70bb 100644--- a/rust/cloud-storage/channels/src/inbound/axum_router/test.rs+++ b/rust/cloud-storage/channels/src/inbound/axum_router/test.rs@@ -1,10 +1,10 @@use super::*;use crate::domain::models::{- ChannelAttachment, ChannelContextMessage, ChannelMessage, ChannelMessageFilters,- ChannelParticipant, DeleteMessageQuery, GetOrCreateChannelResponse, GetOrCreateDmRequest,- GetOrCreatePrivateRequest, MessagePageDirection, ParticipantRole, PatchChannelRequest,- PatchMessageRequest, PostMessageRequest, PostMessageResponse, PostReactionRequest,- PostTypingRequest, RemoveParticipantsRequest,+ Activity, ActivityType, ChannelAttachment, ChannelContextMessage, ChannelMessage,+ ChannelMessageFilters, ChannelParticipant, DeleteMessageQuery, GetOrCreateChannelResponse,+ GetOrCreateDmRequest, GetOrCreatePrivateRequest, MessagePageDirection, ParticipantRole,+ PatchChannelRequest, PatchMessageRequest, PostMessageRequest, PostMessageResponse,+ PostReactionRequest, PostTypingRequest, RemoveParticipantsRequest,};use crate::domain::ports::{ChannelAttachmentsPage, ChannelMessagesErr, ChannelMessagesQueryResult, ChannelMutationErr,@@ -1608,3 +1608,198 @@ async fn missing_channel_returns_404() {let res = router.oneshot(request).await.unwrap();assert_eq!(res.status(), StatusCode::NOT_FOUND);}++// --- Activity endpoint tests ---++#[derive(Default)]+struct ActivityService {+ posts: Arc<Mutex<Vec<(String, Uuid, ActivityType)>>>,+}++impl ChannelService for ActivityService {+ async fn get_channel_messages(+ &self,+ _channel_id: Uuid,+ _query: Query<Uuid, CreatedAt, ()>,+ _direction: MessagePageDirection,+ _limit: u16,+ _filters: &ChannelMessageFilters,+ _notification_user_id: Option<MacroUserIdStr<'static>>,+ ) -> Result<ChannelMessagesQueryResult, ChannelMessagesErr> {+ Ok(ChannelMessagesQueryResult {+ page: Vec::<ChannelMessage>::new()+ .into_iter()+ .paginate_on(50, CreatedAt)+ .filter_on(())+ .into_page(),+ has_more_newer: false,+ })+ }++ async fn get_channel_attachments(+ &self,+ _channel_id: Uuid,+ _query: Query<Uuid, CreatedAt, ()>,+ _limit: u16,+ _attachment_type: Option<crate::domain::models::ChannelAttachmentType>,+ ) -> Result<ChannelAttachmentsPage, ChannelMessagesErr> {+ Ok(Vec::<ChannelAttachment>::new()+ .into_iter()+ .paginate_on(50, CreatedAt)+ .filter_on(())+ .into_page())+ }++ async fn get_channel_participants(+ &self,+ _channel_id: Uuid,+ ) -> Result<Vec<ChannelParticipant>, ChannelMessagesErr> {+ Ok(vec![])+ }++ async fn get_channel_messages_around(+ &self,+ _channel_id: Uuid,+ _message_id: Uuid,+ _limit: u16,+ ) -> Result<ChannelMessagesQueryResult, ChannelMessagesErr> {+ Ok(ChannelMessagesQueryResult {+ page: Vec::<ChannelMessage>::new()+ .into_iter()+ .paginate_on(50, CreatedAt)+ .filter_on(())+ .into_page(),+ has_more_newer: false,+ })+ }++ async fn get_thread_replies(+ &self,+ _channel_id: Uuid,+ _message_id: Uuid,+ ) -> Result<Vec<crate::domain::models::ThreadReply>, ChannelMessagesErr> {+ Ok(vec![])+ }++ async fn get_attachment_references(+ &self,+ _entity_type: String,+ _entity_id: String,+ _user_id: String,+ ) -> Result<Vec<crate::domain::models::AttachmentEntityReference>, ChannelMessagesErr> {+ Ok(vec![])+ }++ async fn get_activities(&self, user_id: String) -> Result<Vec<Activity>, ChannelMessagesErr> {+ Ok(vec![Activity {+ id: Uuid::nil(),+ user_id,+ channel_id: Uuid::nil(),+ created_at: chrono::Utc::now(),+ updated_at: chrono::Utc::now(),+ viewed_at: None,+ interacted_at: None,+ }])+ }++ async fn post_activity(+ &self,+ user_id: String,+ channel_id: Uuid,+ activity_type: ActivityType,+ ) -> Result<Activity, ChannelMutationErr> {+ self.posts+ .lock()+ .unwrap()+ .push((user_id.clone(), channel_id, activity_type));+ Ok(Activity {+ id: Uuid::nil(),+ user_id,+ channel_id,+ created_at: chrono::Utc::now(),+ updated_at: chrono::Utc::now(),+ viewed_at: None,+ interacted_at: None,+ })+ }+}++#[tokio::test]+async fn get_activity_returns_user_activities() {+ let router = channels_router(ChannelsRouterState::new(+ ActivityService::default(),+ TestAccessService::allow(),+ ))+ .layer(user_extension());+ let request = Request::builder()+ .uri("/activity")+ .body(axum::body::Body::empty())+ .unwrap();++ let res = router.oneshot(request).await.unwrap();+ assert_eq!(res.status(), StatusCode::OK);+ let bytes = res.into_body().collect().await.unwrap().to_bytes();+ let json: serde_json::Value = serde_json::from_slice(&bytes).unwrap();+ assert!(json.is_array());+ assert_eq!(json[0]["user_id"], "macro|[email protected]");+}++#[tokio::test]+async fn post_activity_records_and_returns_activity() {+ let service = ActivityService::default();+ let posts = service.posts.clone();+ let router = channels_router(ChannelsRouterState::new(+ service,+ TestAccessService::allow(),+ ))+ .layer(user_extension());+ let channel_id = Uuid::new_v4();+ let request = Request::builder()+ .method("POST")+ .uri("/activity")+ .header("content-type", "application/json")+ .body(axum::body::Body::from(+ serde_json::json!({+ "channel_id": channel_id.to_string(),+ "activity_type": "view"+ })+ .to_string(),+ ))+ .unwrap();++ let res = router.oneshot(request).await.unwrap();+ assert_eq!(res.status(), StatusCode::OK);+ let bytes = res.into_body().collect().await.unwrap().to_bytes();+ let json: serde_json::Value = serde_json::from_slice(&bytes).unwrap();+ assert_eq!(json["channel_id"], channel_id.to_string());++ let posts = posts.lock().unwrap();+ assert_eq!(posts.len(), 1);+ assert_eq!(posts[0].0, "macro|[email protected]");+ assert_eq!(posts[0].1, channel_id);+ assert!(matches!(posts[0].2, ActivityType::View));+}++#[tokio::test]+async fn post_activity_rejects_invalid_channel_id() {+ let router = channels_router(ChannelsRouterState::new(+ ActivityService::default(),+ TestAccessService::allow(),+ ))+ .layer(user_extension());+ let request = Request::builder()+ .method("POST")+ .uri("/activity")+ .header("content-type", "application/json")+ .body(axum::body::Body::from(+ serde_json::json!({+ "channel_id": "not-a-uuid",+ "activity_type": "interact"+ })+ .to_string(),+ ))+ .unwrap();++ let res = router.oneshot(request).await.unwrap();+ assert_eq!(res.status(), StatusCode::BAD_REQUEST);+}diff --git a/rust/cloud-storage/channels/src/outbound/pg_channels_repo.rs b/rust/cloud-storage/channels/src/outbound/pg_channels_repo.rsindex 3041213e5b..2cf05fbb7f 100644--- a/rust/cloud-storage/channels/src/outbound/pg_channels_repo.rs+++ b/rust/cloud-storage/channels/src/outbound/pg_channels_repo.rs@@ -3,14 +3,14 @@ mod tests;use crate::domain::{models::{- AttachmentChannelReference, AttachmentEntityReference, AttachmentGenericReference,- ChannelAttachment, ChannelAttachmentType, ChannelContextMessage, ChannelInfo,- ChannelMessageFilters, ChannelMessageKind, ChannelMetadata, ChannelParticipant,- ChannelPreviewRow, ChannelType, CountedReaction, CreateChannelRequest,- CreateEntityMentionOptions, EntityMention, MessageAttachment, MessagePageDirection,- MutatedAttachment, MutatedMessage, NewChannelAttachment, ParticipantRole,- PatchChannelRequest, ResolvedChannelMessage, SimpleMention, ThreadData, ThreadReplyRow,- TopLevelMessageRow,+ Activity, ActivityType, AttachmentChannelReference, AttachmentEntityReference,+ AttachmentGenericReference, ChannelAttachment, ChannelAttachmentType,+ ChannelContextMessage, ChannelInfo, ChannelMessageFilters, ChannelMessageKind,+ ChannelMetadata, ChannelParticipant, ChannelPreviewRow, ChannelType, CountedReaction,+ CreateChannelRequest, CreateEntityMentionOptions, EntityMention, MessageAttachment,+ MessagePageDirection, MutatedAttachment, MutatedMessage, NewChannelAttachment,+ ParticipantRole, PatchChannelRequest, ResolvedChannelMessage, SimpleMention, ThreadData,+ ThreadReplyRow, TopLevelMessageRow,},ports::{ChannelRepo, TopLevelMessagesQueryResult},};@@ -2302,6 +2302,120 @@ impl ChannelRepo for PgChannelsRepo {Ok(())}+ async fn get_activities(&self, user_id: String) -> Result<Vec<Activity>, Self::Err> {+ let activities = sqlx::query!(+ r#"+ SELECT+ a.id as "id!: Uuid",+ a.user_id as "user_id!: String",+ a.channel_id as "channel_id!: Uuid",+ a.viewed_at as "viewed_at?: DateTime<Utc>",+ a.interacted_at as "interacted_at?: DateTime<Utc>",+ a.created_at as "created_at!: DateTime<Utc>",+ a.updated_at as "updated_at!: DateTime<Utc>"+ FROM comms_activity a+ WHERE a.user_id = $1+ ORDER BY+ GREATEST(+ COALESCE(a.viewed_at, '1970-01-01'::timestamp),+ COALESCE(a.interacted_at, '1970-01-01'::timestamp)+ ) DESC,+ a.created_at DESC+ LIMIT 100+ "#,+ user_id+ )+ .map(|row| Activity {+ id: row.id,+ user_id: row.user_id,+ channel_id: row.channel_id,+ created_at: row.created_at,+ updated_at: row.updated_at,+ viewed_at: row.viewed_at,+ interacted_at: row.interacted_at,+ })+ .fetch_all(&self.pool)+ .await?;+ Ok(activities)+ }++ async fn set_activity(+ &self,+ user_id: String,+ channel_id: Uuid,+ activity_type: ActivityType,+ ) -> Result<Activity, Self::Err> {+ let activity = 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(&self.pool)+ .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(&self.pool)+ .await?+ }+ };+ Ok(activity)+ }+async fn add_reaction(&self,channel_id: Uuid,diff --git a/rust/cloud-storage/document_storage_service/src/api/swagger.rs b/rust/cloud-storage/document_storage_service/src/api/swagger.rsindex 6bc63b271c..5e0f34323c 100644--- a/rust/cloud-storage/document_storage_service/src/api/swagger.rs+++ b/rust/cloud-storage/document_storage_service/src/api/swagger.rs@@ -63,12 +63,13 @@ use crate::{},};use channels::inbound::axum_router::{- ApiAttachmentChannelReference, ApiAttachmentEntityReference, ApiAttachmentGenericReference,- ApiChannelAttachment, ApiChannelAttachmentsPage, ApiChannelContextMessage, ApiChannelMessage,- ApiChannelMessageKind, ApiChannelMessagesPage, ApiChannelParticipant, ApiCountedReaction,- ApiMessageAttachment, ApiParticipantRole, ApiResolvedChannelMessage, ApiThreadInfo,- ApiThreadReply, ChannelMessageFilters, CreateEntityMentionRequest, CreateEntityMentionResponse,- DeleteEntityMentionResponse, GetAttachmentReferencesResponse, GetMessageWithContextResponse,+ ApiActivity, ApiAttachmentChannelReference, ApiAttachmentEntityReference,+ ApiAttachmentGenericReference, ApiChannelAttachment, ApiChannelAttachmentsPage,+ ApiChannelContextMessage, 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::{@@ -220,6 +221,8 @@ use utoipa::OpenApi;channels::inbound::axum_router::create_mention_handler,channels::inbound::axum_router::delete_mention_handler,channels::inbound::axum_router::get_attachment_references_handler,+ channels::inbound::axum_router::get_activity_handler,+ channels::inbound::axum_router::post_activity_handler,// callscall::inbound::axum_router::get_or_create_call_handler,@@ -417,6 +420,9 @@ use utoipa::OpenApi;CreateEntityMentionRequest,CreateEntityMentionResponse,DeleteEntityMentionResponse,+ channels::domain::models::ActivityType,+ ApiActivity,+ PostActivityRequest,// Callscall::domain::models::CallTokenResponse,