diff --git a/charts/datasets/charts/datasets/Chart.yaml b/charts/datasets/charts/datasets/Chart.yaml index 2865bcc..d2afd69 100644 --- a/charts/datasets/charts/datasets/Chart.yaml +++ b/charts/datasets/charts/datasets/Chart.yaml @@ -5,4 +5,4 @@ type: application version: 0.1.0 -appVersion: 0.1.0-rc5 +appVersion: 0.1.0-rc6 diff --git a/datasets/src/graphql/mod.rs b/datasets/src/graphql/mod.rs index 51926e4..4ffe621 100644 --- a/datasets/src/graphql/mod.rs +++ b/datasets/src/graphql/mod.rs @@ -28,7 +28,7 @@ impl Session { &self, ctx: &Context<'_>, after: Option, - first: Option, + first: u64, ) -> async_graphql::Result< Connection, DataCollection, EmptyFields, EmptyFields>, > { @@ -44,13 +44,9 @@ impl Session { } } - let limit = match first { - Some(first) => first + 1, - None => usize::MAX as u64, - }; - + let limit = first.min(100); let mut data_collections = query - .limit(limit) + .limit(limit + 1) .all(database) .await? .into_iter() @@ -58,13 +54,7 @@ impl Session { .collect::>(); let mut has_next_page = false; - - if data_collections.len() - > first - .unwrap_or(usize::MAX.try_into().unwrap()) - .try_into() - .unwrap() - { + if data_collections.len() > limit as usize { has_next_page = true; data_collections.pop(); }