From 769c12833adc08aa48bd0bed8d728b34df4fef5c Mon Sep 17 00:00:00 2001 From: Antoine Gersant Date: Sat, 27 Oct 2018 17:26:19 -0700 Subject: [PATCH] Implemented endpoint to write settings --- src/rocket_api.rs | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/rocket_api.rs b/src/rocket_api.rs index 7e74ebd..1f1eb10 100644 --- a/src/rocket_api.rs +++ b/src/rocket_api.rs @@ -12,7 +12,7 @@ const CURRENT_MAJOR_VERSION: i32 = 2; const CURRENT_MINOR_VERSION: i32 = 2; pub fn get_routes() -> Vec { - routes![version, initial_setup, get_settings,] + routes![version, initial_setup, get_settings, put_settings] } struct Auth { @@ -88,3 +88,9 @@ fn get_settings(db: State, _admin_rights: AdminRights) -> Result(&db)?; Ok(Json(config)) } + +#[put("/settings", data = "")] +fn put_settings(db: State, _admin_rights: AdminRights, config: Json) -> Result<(), errors::Error> { + config::amend::(&db, &config)?; + Ok(()) +}