Skip to content
This repository has been archived by the owner on Jul 25, 2022. It is now read-only.

Commit

Permalink
Fix Limit (#2274)
Browse files Browse the repository at this point in the history
The limit column is being passed in as Text in graphql calls, which is
not valid.

Instead, we can just keep it as an option, where NULL is the same as no
limit.

Fixes #2273.

Signed-off-by: Joe Grund <jgrund@whamcloud.io>
  • Loading branch information
jgrund committed Sep 24, 2020
1 parent 8f6e699 commit 6b1b229
Showing 1 changed file with 4 additions and 10 deletions.
14 changes: 4 additions & 10 deletions iml-api/src/graphql.rs
Original file line number Diff line number Diff line change
Expand Up @@ -178,9 +178,7 @@ impl QueryRoot {
OFFSET $2 LIMIT $3"#,
dir.deref(),
offset.unwrap_or(0) as i64,
limit
.map(|x| x.to_string())
.unwrap_or_else(|| "ALL".to_string()) as String
limit.map(|x| x as i64),
)
.fetch_all(&context.pg_pool)
.await?;
Expand Down Expand Up @@ -215,9 +213,7 @@ impl QueryRoot {
CASE WHEN $3 = 'desc' THEN t.name END DESC
OFFSET $1 LIMIT $2"#,
offset.unwrap_or(0) as i64,
limit
.map(|x| x.to_string())
.unwrap_or_else(|| "ALL".to_string()) as String,
limit.map(|x| x as i64),
dir.deref()
)
.fetch_all(&context.pg_pool)
Expand Down Expand Up @@ -325,7 +321,7 @@ impl QueryRoot {
CASE WHEN $3 = 'desc' THEN s.create_time END DESC
OFFSET $1 LIMIT $2"#,
offset.unwrap_or(0) as i64,
limit.map(|x| x.to_string()).unwrap_or_else(|| "ALL".to_string()) as String,
limit.map(|x| x as i64),
dir.deref(),
fsname,
name,
Expand Down Expand Up @@ -374,9 +370,7 @@ impl QueryRoot {
CASE WHEN $3 = 'desc' THEN c.id END DESC
OFFSET $1 LIMIT $2 "#,
offset.unwrap_or(0) as i64,
limit
.map(|x| x.to_string())
.unwrap_or_else(|| "ALL".to_string()) as String,
limit.map(|x| x as i64),
dir.deref(),
is_completed,
msg,
Expand Down

0 comments on commit 6b1b229

Please sign in to comment.