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
chg(channels): return sender with attachments, bump clamp on limit (#2278)
teo963c554f4db8
diff --git a/js/app/packages/service-clients/service-storage/generated/schemas/apiChannelAttachment.ts b/js/app/packages/service-clients/service-storage/generated/schemas/apiChannelAttachment.tsindex 07e09b5951..48ff6ab905 100644--- a/js/app/packages/service-clients/service-storage/generated/schemas/apiChannelAttachment.ts+++ b/js/app/packages/service-clients/service-storage/generated/schemas/apiChannelAttachment.ts@@ -25,6 +25,8 @@ export interface ApiChannelAttachment {id: string;/** Message id this attachment belongs to. */message_id: string;+ /** The user who sent the message containing this attachment. */+ sender_id: string;/** Width (for images). */width?: ApiChannelAttachmentWidth;}diff --git a/js/app/packages/service-clients/service-storage/generated/schemas/getChannelAttachmentsParams.ts b/js/app/packages/service-clients/service-storage/generated/schemas/getChannelAttachmentsParams.tsindex 7e8a0b903e..3af396b619 100644--- a/js/app/packages/service-clients/service-storage/generated/schemas/getChannelAttachmentsParams.ts+++ b/js/app/packages/service-clients/service-storage/generated/schemas/getChannelAttachmentsParams.ts@@ -7,7 +7,7 @@export type GetChannelAttachmentsParams = {/**- * Page size (1-100, default 50)+ * Page size (1-500, default 50)* @minimum 0*/limit?: number;diff --git a/js/app/packages/service-clients/service-storage/generated/zod.ts b/js/app/packages/service-clients/service-storage/generated/zod.tsindex 7903b6e788..ac808ea383 100644--- a/js/app/packages/service-clients/service-storage/generated/zod.ts+++ b/js/app/packages/service-clients/service-storage/generated/zod.ts@@ -824,7 +824,7 @@ export const getChannelAttachmentsQueryParams = zod.object({.number().min(getChannelAttachmentsQueryLimitMin).optional()- .describe('Page size (1-100, default 50)'),+ .describe('Page size (1-500, default 50)'),cursor: zod.string().optional().describe('Base64 encoded cursor value'),});@@ -847,6 +847,11 @@ export const getChannelAttachmentsResponse = zod.string().uuid().describe('Message id this attachment belongs to.'),+ sender_id: zod+ .string()+ .describe(+ 'The user who sent the message containing this attachment.'+ ),width: zod.number().nullish().describe('Width (for images).'),}).describe('A channel-level attachment.')diff --git a/js/app/packages/service-clients/service-storage/openapi.json b/js/app/packages/service-clients/service-storage/openapi.jsonindex c6a3bed8e1..b83b6652bf 100644--- a/js/app/packages/service-clients/service-storage/openapi.json+++ b/js/app/packages/service-clients/service-storage/openapi.json@@ -613,7 +613,7 @@{"name": "limit","in": "query",- "description": "Page size (1-100, default 50)",+ "description": "Page size (1-500, default 50)","required": false,"schema": {"type": "integer",@@ -5009,6 +5009,7 @@"id","channel_id","message_id",+ "sender_id","entity_type","entity_id","created_at"@@ -5047,6 +5048,10 @@"format": "uuid","description": "Message id this attachment belongs to."},+ "sender_id": {+ "type": "string",+ "description": "The user who sent the message containing this attachment."+ },"width": {"type": ["integer", "null"],"format": "int32",diff --git a/rust/cloud-storage/channels/.sqlx/query-935a3a59b6f7df8eac7cb9ba86bdde343a009e04e6735d3c0f8fb26dfbab4213.json b/rust/cloud-storage/channels/.sqlx/query-24699ee15071155de425d4228c9a5ae5feeab0bd3eed5a659795ea3a07c96ba9.jsonsimilarity index 61%rename from rust/cloud-storage/channels/.sqlx/query-935a3a59b6f7df8eac7cb9ba86bdde343a009e04e6735d3c0f8fb26dfbab4213.jsonrename to rust/cloud-storage/channels/.sqlx/query-24699ee15071155de425d4228c9a5ae5feeab0bd3eed5a659795ea3a07c96ba9.jsonindex 0cbd192868..ed5d43a20c 100644--- a/rust/cloud-storage/channels/.sqlx/query-935a3a59b6f7df8eac7cb9ba86bdde343a009e04e6735d3c0f8fb26dfbab4213.json+++ b/rust/cloud-storage/channels/.sqlx/query-24699ee15071155de425d4228c9a5ae5feeab0bd3eed5a659795ea3a07c96ba9.json@@ -1,6 +1,6 @@{"db_name": "PostgreSQL",- "query": "\n SELECT id, channel_id, message_id, entity_type, entity_id,\n width AS \"width?\", height AS \"height?\", created_at\n FROM comms_attachments\n WHERE channel_id = $1\n AND ($2::timestamptz IS NULL OR (created_at, id) < ($2, $3))\n ORDER BY created_at DESC, id DESC\n LIMIT $4\n ",+ "query": "\n SELECT a.id, a.channel_id, a.message_id, m.sender_id,\n a.entity_type, a.entity_id,\n a.width AS \"width?\", a.height AS \"height?\", a.created_at\n FROM comms_attachments a\n JOIN comms_messages m ON m.id = a.message_id\n WHERE a.channel_id = $1\n AND ($2::timestamptz IS NULL OR (a.created_at, a.id) < ($2, $3))\n ORDER BY a.created_at DESC, a.id DESC\n LIMIT $4\n ","describe": {"columns": [{@@ -20,26 +20,31 @@},{"ordinal": 3,+ "name": "sender_id",+ "type_info": "Text"+ },+ {+ "ordinal": 4,"name": "entity_type","type_info": "Varchar"},{- "ordinal": 4,+ "ordinal": 5,"name": "entity_id","type_info": "Varchar"},{- "ordinal": 5,+ "ordinal": 6,"name": "width?","type_info": "Int4"},{- "ordinal": 6,+ "ordinal": 7,"name": "height?","type_info": "Int4"},{- "ordinal": 7,+ "ordinal": 8,"name": "created_at","type_info": "Timestamptz"}@@ -58,10 +63,11 @@false,false,false,+ false,true,true,false]},- "hash": "935a3a59b6f7df8eac7cb9ba86bdde343a009e04e6735d3c0f8fb26dfbab4213"+ "hash": "24699ee15071155de425d4228c9a5ae5feeab0bd3eed5a659795ea3a07c96ba9"}diff --git a/rust/cloud-storage/channels/src/domain/models.rs b/rust/cloud-storage/channels/src/domain/models.rsindex c8aed4d2d4..c1baac6e47 100644--- a/rust/cloud-storage/channels/src/domain/models.rs+++ b/rust/cloud-storage/channels/src/domain/models.rs@@ -131,6 +131,8 @@ pub struct ChannelAttachment {pub channel_id: Uuid,/// Message this attachment is on.pub message_id: Uuid,+ /// The user who sent the message containing this attachment.+ pub sender_id: String,/// Type of attached entity (e.g. "document").pub entity_type: String,/// Id of the attached entity.diff --git a/rust/cloud-storage/channels/src/domain/service.rs b/rust/cloud-storage/channels/src/domain/service.rsindex c3a4909781..884a75223b 100644--- a/rust/cloud-storage/channels/src/domain/service.rs+++ b/rust/cloud-storage/channels/src/domain/service.rs@@ -191,7 +191,7 @@ wherequery: Query<Uuid, CreatedAt, ()>,limit: u16,) -> Result<ChannelAttachmentsPage, ChannelMessagesErr> {- let limit = limit.clamp(1, 100);+ let limit = limit.clamp(1, 500);let attachments = self.repodiff --git a/rust/cloud-storage/channels/src/inbound/axum_router.rs b/rust/cloud-storage/channels/src/inbound/axum_router.rsindex 0f388a4d67..015becc9c1 100644--- a/rust/cloud-storage/channels/src/inbound/axum_router.rs+++ b/rust/cloud-storage/channels/src/inbound/axum_router.rs@@ -277,7 +277,7 @@ pub async fn get_thread_replies_handler<S: ChannelMessagesService, Svc: EntityAcpath = "/channels/{channel_id}/attachments",params(("channel_id" = Uuid, Path, description = "Channel ID"),- ("limit" = Option<u16>, Query, description = "Page size (1-100, default 50)"),+ ("limit" = Option<u16>, Query, description = "Page size (1-500, default 50)"),("cursor" = Option<String>, Query, description = "Base64 encoded cursor value"),),responses(@@ -538,6 +538,8 @@ pub struct ApiChannelAttachment {channel_id: Uuid,/// Message id this attachment belongs to.message_id: Uuid,+ /// The user who sent the message containing this attachment.+ sender_id: String,/// Type of entity.entity_type: String,/// Entity id.@@ -556,6 +558,7 @@ impl From<ChannelAttachment> for ApiChannelAttachment {id: a.id,channel_id: a.channel_id,message_id: a.message_id,+ sender_id: a.sender_id,entity_type: a.entity_type,entity_id: a.entity_id,width: a.width,diff --git a/rust/cloud-storage/channels/src/outbound/pg_channels_repo.rs b/rust/cloud-storage/channels/src/outbound/pg_channels_repo.rsindex 4c03ea0312..165f7f958a 100644--- a/rust/cloud-storage/channels/src/outbound/pg_channels_repo.rs+++ b/rust/cloud-storage/channels/src/outbound/pg_channels_repo.rs@@ -91,6 +91,7 @@ struct ChannelAttachmentRow {id: Uuid,channel_id: Uuid,message_id: Uuid,+ sender_id: String,entity_type: String,entity_id: String,width: Option<i32>,@@ -428,12 +429,14 @@ impl ChannelMessagesRepo for PgChannelMessagesRepo {let rows = sqlx::query_as!(ChannelAttachmentRow,r#"- SELECT id, channel_id, message_id, entity_type, entity_id,- width AS "width?", height AS "height?", created_at- FROM comms_attachments- WHERE channel_id = $1- AND ($2::timestamptz IS NULL OR (created_at, id) < ($2, $3))- ORDER BY created_at DESC, id DESC+ SELECT a.id, a.channel_id, a.message_id, m.sender_id,+ a.entity_type, a.entity_id,+ a.width AS "width?", a.height AS "height?", a.created_at+ FROM comms_attachments a+ JOIN comms_messages m ON m.id = a.message_id+ WHERE a.channel_id = $1+ AND ($2::timestamptz IS NULL OR (a.created_at, a.id) < ($2, $3))+ ORDER BY a.created_at DESC, a.id DESCLIMIT $4"#,channel_id,@@ -450,6 +453,7 @@ impl ChannelMessagesRepo for PgChannelMessagesRepo {id: r.id,channel_id: r.channel_id,message_id: r.message_id,+ sender_id: r.sender_id,entity_type: r.entity_type,entity_id: r.entity_id,width: r.width,