fix: add args filter to schedule list

This commit is contained in:
Ruben Fiszel
2024-04-06 15:43:37 +02:00
parent a969a73a17
commit b2d1ef40d2
2 changed files with 5 additions and 0 deletions
+1
View File
@@ -6190,6 +6190,7 @@ paths:
- $ref: "#/components/parameters/WorkspaceId"
- $ref: "#/components/parameters/Page"
- $ref: "#/components/parameters/PerPage"
- $ref: "#/components/parameters/ArgsFilter"
- name: path
description: filter by path
in: query
+4
View File
@@ -316,6 +316,7 @@ pub struct ListScheduleQuery {
pub per_page: Option<usize>,
pub path: Option<String>,
pub is_flow: Option<bool>,
pub args: Option<String>,
}
async fn list_schedule(
@@ -339,6 +340,9 @@ async fn list_schedule(
if let Some(is_flow) = lsq.is_flow {
sqlb.and_where_eq("is_flow", "?".bind(&is_flow));
}
if let Some(args) = &lsq.args {
sqlb.and_where("args @> ?".bind(&args.replace("'", "''")));
}
let sql = sqlb.sql().map_err(|e| Error::InternalErr(e.to_string()))?;
let rows = sqlx::query_as::<_, Schedule>(&sql)
.fetch_all(&mut *tx)