Silence warnings, run cargo fmt
This commit is contained in:
parent
fe1c1d3655
commit
af1c767f5f
77 changed files with 1904 additions and 903 deletions
|
|
@ -116,12 +116,13 @@ pub async fn is_scene_slug_available<'e>(
|
|||
realm_id: Uuid,
|
||||
slug: &str,
|
||||
) -> Result<bool, AppError> {
|
||||
let exists: (bool,) =
|
||||
sqlx::query_as(r#"SELECT EXISTS(SELECT 1 FROM realm.scenes WHERE realm_id = $1 AND slug = $2)"#)
|
||||
.bind(realm_id)
|
||||
.bind(slug)
|
||||
.fetch_one(executor)
|
||||
.await?;
|
||||
let exists: (bool,) = sqlx::query_as(
|
||||
r#"SELECT EXISTS(SELECT 1 FROM realm.scenes WHERE realm_id = $1 AND slug = $2)"#,
|
||||
)
|
||||
.bind(realm_id)
|
||||
.bind(slug)
|
||||
.fetch_one(executor)
|
||||
.await?;
|
||||
|
||||
Ok(!exists.0)
|
||||
}
|
||||
|
|
@ -294,7 +295,10 @@ pub async fn update_scene<'e>(
|
|||
param_idx += 1;
|
||||
}
|
||||
if req.dimension_mode.is_some() {
|
||||
set_clauses.push(format!("dimension_mode = ${}::realm.dimension_mode", param_idx));
|
||||
set_clauses.push(format!(
|
||||
"dimension_mode = ${}::realm.dimension_mode",
|
||||
param_idx
|
||||
));
|
||||
param_idx += 1;
|
||||
}
|
||||
if req.sort_order.is_some() {
|
||||
|
|
@ -317,7 +321,8 @@ pub async fn update_scene<'e>(
|
|||
s.is_hidden, s.created_at, s.updated_at, c.id as default_channel_id
|
||||
FROM realm.scenes s
|
||||
LEFT JOIN scene.instances c ON c.scene_id = s.id AND c.instance_type = 'public'
|
||||
WHERE s.id = $1"#.to_string()
|
||||
WHERE s.id = $1"#
|
||||
.to_string()
|
||||
} else {
|
||||
set_clauses.push("updated_at = now()".to_string());
|
||||
format!(
|
||||
|
|
@ -396,12 +401,11 @@ pub async fn get_next_sort_order<'e>(
|
|||
executor: impl PgExecutor<'e>,
|
||||
realm_id: Uuid,
|
||||
) -> Result<i32, AppError> {
|
||||
let result: (Option<i32>,) = sqlx::query_as(
|
||||
r#"SELECT MAX(sort_order) FROM realm.scenes WHERE realm_id = $1"#,
|
||||
)
|
||||
.bind(realm_id)
|
||||
.fetch_one(executor)
|
||||
.await?;
|
||||
let result: (Option<i32>,) =
|
||||
sqlx::query_as(r#"SELECT MAX(sort_order) FROM realm.scenes WHERE realm_id = $1"#)
|
||||
.bind(realm_id)
|
||||
.fetch_one(executor)
|
||||
.await?;
|
||||
|
||||
Ok(result.0.unwrap_or(0) + 1)
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue