fix format

This commit is contained in:
jb-alvarado 2022-07-07 21:45:33 +02:00
parent d623dd5ce8
commit eb831f14c1
3 changed files with 13 additions and 11 deletions

View File

@ -15,11 +15,11 @@ use utils::{
auth, db_path, init_config,
models::LoginUser,
routes::{
add_dir, add_preset, add_user, del_playlist, file_browser, gen_playlist, get_all_settings,
get_log, get_playlist, get_playout_config, get_presets, get_settings, get_user,
control_playout, login, media_current, media_last, media_next, move_rename,
patch_settings, process_control, remove, save_file, save_playlist,
send_text_message, update_playout_config, update_preset, update_user, delete_preset,
add_dir, add_preset, add_user, control_playout, del_playlist, delete_preset, file_browser,
gen_playlist, get_all_settings, get_log, get_playlist, get_playout_config, get_presets,
get_settings, get_user, login, media_current, media_last, media_next, move_rename,
patch_settings, process_control, remove, save_file, save_playlist, send_text_message,
update_playout_config, update_preset, update_user,
},
run_args, Role,
};

View File

@ -297,7 +297,7 @@ pub async fn db_add_preset(preset: TextPreset) -> Result<SqliteQueryResult, sqlx
Ok(result)
}
pub async fn db_delete_preset(id: &i64) -> Result<SqliteQueryResult, sqlx::Error> {
pub async fn db_delete_preset(id: &i64) -> Result<SqliteQueryResult, sqlx::Error> {
let conn = db_connection().await?;
let query = "DELETE FROM presets WHERE id = $1;";
let result: SqliteQueryResult = sqlx::query(query).bind(id).execute(&conn).await?;

View File

@ -8,7 +8,6 @@
///
/// For all endpoints an (Bearer) authentication is required.\
/// `{id}` represent the channel id, and at default is 1.
use std::collections::HashMap;
use actix_multipart::Multipart;
@ -30,9 +29,9 @@ use crate::utils::{
PathObject,
},
handles::{
db_add_preset, db_add_user, db_get_all_settings, db_get_presets, db_get_settings,
db_get_user, db_login, db_role, db_update_preset, db_update_settings, db_update_user,
db_delete_preset,
db_add_preset, db_add_user, db_delete_preset, db_get_all_settings, db_get_presets,
db_get_settings, db_get_user, db_login, db_role, db_update_preset, db_update_settings,
db_update_user,
},
models::{LoginUser, Settings, TextPreset, User},
playlist::{delete_playlist, generate_playlist, read_playlist, write_playlist},
@ -455,7 +454,10 @@ pub async fn send_text_message(
/// ```
#[post("/control/{id}/playout/")]
#[has_any_role("Role::Admin", "Role::User", type = "Role")]
pub async fn control_playout(id: web::Path<i64>, control: web::Json<Process>) -> Result<impl Responder, ServiceError> {
pub async fn control_playout(
id: web::Path<i64>,
control: web::Json<Process>,
) -> Result<impl Responder, ServiceError> {
match control_state(*id, control.command.clone()).await {
Ok(res) => return Ok(res.text().await.unwrap_or_else(|_| "Success".into())),
Err(e) => Err(e),