From 67074322663f452e9f107f137fe17c464d0efc58 Mon Sep 17 00:00:00 2001 From: Luc Date: Wed, 27 Nov 2024 13:05:12 +0100 Subject: [PATCH] Update default instance settings --- engine/src/routes/instance.rs | 22 +++++++++++++--------- 1 file changed, 13 insertions(+), 9 deletions(-) diff --git a/engine/src/routes/instance.rs b/engine/src/routes/instance.rs index de3a6f0..4019807 100644 --- a/engine/src/routes/instance.rs +++ b/engine/src/routes/instance.rs @@ -8,11 +8,6 @@ use crate::{auth::middleware::AuthToken, models::user_data::{User, UserEntry}, s pub struct ApiInstance; -#[derive(Serialize, Deserialize, Object)] -pub struct InstanceSettings { - pub id_casing_preference: IdCasingPreference, -} - #[derive(Serialize, Deserialize, Enum)] pub enum IdCasingPreference { #[oai(rename = "upper")] @@ -23,6 +18,17 @@ pub enum IdCasingPreference { Lower, } +#[derive(Serialize, Deserialize, Object)] +pub struct InstanceSettings { + pub id_casing_preference: IdCasingPreference, +} + +impl Default for InstanceSettings { + fn default() -> Self { + Self { id_casing_preference: IdCasingPreference::Upper } + } +} + #[OpenApi] impl ApiInstance { #[oai(path = "/instance/settings", method = "get")] @@ -30,10 +36,8 @@ impl ApiInstance { // match token { // AuthToken::Active(active_user) => { // TODO: check if user has permission to access this resource - - Json(InstanceSettings { - id_casing_preference: IdCasingPreference::Upper, - }) + + Json(InstanceSettings::default()) // } // _ => { // Error::from_string("Not Authenticated", StatusCode::UNAUTHORIZED).into_response(),