Skip to content

armgit / macro

Public Imported from GitHub
0

Macro is a unified workspace for teams: email, chat, docs, tasks, agents, calls, and CRM — @-linked together with shared AI memory.

fix(comms): remove limit on get_channels endpoint (#990)

teod7cd7b084b94
diff --git a/rust/cloud-storage/comms/src/domain/models.rs b/rust/cloud-storage/comms/src/domain/models.rs
index cf97afe802..ee9fbaaccb 100644
--- a/rust/cloud-storage/comms/src/domain/models.rs
+++ b/rust/cloud-storage/comms/src/domain/models.rs
@@ -47,19 +47,10 @@ pub struct GetChannelsRequest {
impl GetChannelsRequest {
pub fn into_params(self) -> GetChannelsParams {
- let GetChannelsRequest {
- macro_id,
- limit,
- query,
- } = self;
-
- // make sure the limit for page size exists within a reasonable range
- let limit = limit.unwrap_or(20).clamp(20, 100);
-
GetChannelsParams {
- macro_id,
- limit,
- query,
+ macro_id: self.macro_id,
+ limit: self.limit,
+ query: self.query,
}
}
}
@@ -67,7 +58,7 @@ impl GetChannelsRequest {
#[derive(Debug)]
pub struct GetChannelsParams {
macro_id: MacroUserIdStr<'static>,
- limit: u32,
+ limit: Option<u32>,
query: Query<Uuid, SimpleSortMethod, LiteralTree<ChannelLiteral>>,
}
@@ -76,7 +67,7 @@ impl GetChannelsParams {
&self.macro_id
}
- pub fn limit(&self) -> u32 {
+ pub fn limit(&self) -> Option<u32> {
self.limit
}
diff --git a/rust/cloud-storage/comms/src/outbound/postgres/comms_repo/dynamic.rs b/rust/cloud-storage/comms/src/outbound/postgres/comms_repo/dynamic.rs
index e8ff07f33c..11c80390f0 100644
--- a/rust/cloud-storage/comms/src/outbound/postgres/comms_repo/dynamic.rs
+++ b/rust/cloud-storage/comms/src/outbound/postgres/comms_repo/dynamic.rs
@@ -169,7 +169,7 @@ pub async fn get_user_channels_dynamic(
params: &GetChannelsParams,
) -> Result<Vec<ChannelWithParticipants>, sqlx::Error> {
let user_id = params.user();
- let query_limit = params.limit() as i64;
+ let query_limit = params.limit().map(|l| l as i64);
let cursor = params.query();
let sort_method_str = cursor.sort_method().to_string();
let (cursor_id, cursor_timestamp) = cursor.vals();