Skip to content

Commit

Permalink
fix: app logs api filters
Browse files Browse the repository at this point in the history
  • Loading branch information
adnanjpg committed Apr 17, 2024
1 parent d03001c commit b0794bb
Showing 1 changed file with 12 additions and 3 deletions.
15 changes: 12 additions & 3 deletions src/logs/persistence/app_logs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,13 @@ pub async fn get_app_logs(
// }
// query.push(")");

query.push(format!(" AND app_id IN ({})", app_ids.join(", ")));
let ids = app_ids
.iter()
.map(|l| format!("'{}'", l.to_string()))
.collect::<Vec<String>>()
.join(", ");

query.push(format!(" AND app_id IN ({})", ids));
}

if let Some(filter_by_word) = filter_by_word {
Expand Down Expand Up @@ -201,11 +207,14 @@ pub async fn get_app_logs(

if let Some(order_by) = order_by {
query.push(" ORDER BY ");
query.push(&order_by);
query.push(format!("'{}'", &order_by));

if let Some(order_by_direction) = order_by_direction {
query.push(" ");
query.push(&order_by_direction.to_string());
query.push(format!(
"{}",
&order_by_direction.to_string().to_lowercase()
));
}
}

Expand Down

0 comments on commit b0794bb

Please sign in to comment.