diff --git a/src/models/menu.rs b/src/models/menu.rs index 2cd23c5..bbe06d9 100644 --- a/src/models/menu.rs +++ b/src/models/menu.rs @@ -30,6 +30,16 @@ impl Default for MenuResponse { } } +#[derive(Deserialize, Serialize, Extractible, Debug, Clone)] +pub struct MenuAction { + pub internal_id: Option, + pub id: Option, + pub uuid: Option, + pub name: Option, + pub description: Option, + pub help: Option +} + #[derive(Deserialize, Serialize, Extractible, Debug, Clone)] pub struct Menu { pub uuid: Option, @@ -46,11 +56,11 @@ pub struct Menu { pub action: Option, pub action_id: Option, pub action_uuid: Option, - pub window: Option, - pub process: Option, - pub form: Option
, - pub browser: Option, - pub workflow: Option, + pub window: Option, + pub process: Option, + pub form: Option, + pub browser: Option, + pub workflow: Option, // Tree menu childs pub children: Option> } @@ -117,56 +127,6 @@ impl Menu { } } -#[derive(Deserialize, Serialize, Extractible, Debug, Clone)] -pub struct Window { - pub uuid: Option, - pub internal_id: Option, - pub id: Option, - pub name: Option, - pub description: Option, - pub help: Option, -} - -#[derive(Deserialize, Serialize, Extractible, Debug, Clone)] -pub struct Process { - pub uuid: Option, - pub internal_id: Option, - pub id: Option, - pub name: Option, - pub description: Option, - pub help: Option, -} - -#[derive(Deserialize, Serialize, Extractible, Debug, Clone)] -pub struct Form { - pub uuid: Option, - pub internal_id: Option, - pub id: Option, - pub name: Option, - pub description: Option, - pub help: Option, -} - -#[derive(Deserialize, Serialize, Extractible, Debug, Clone)] -pub struct Browser { - pub uuid: Option, - pub internal_id: Option, - pub id: Option, - pub name: Option, - pub description: Option, - pub help: Option, -} - -#[derive(Deserialize, Serialize, Extractible, Debug, Clone)] -pub struct Workflow { - pub uuid: Option, - pub internal_id: Option, - pub id: Option, - pub name: Option, - pub description: Option, - pub help: Option, -} - pub async fn allowed_menu(_language: Option<&String>, _client_id: Option<&String>, _role_id: Option<&String>, _dictionary_code: Option<&String>) -> Result { let _expected_role = role_from_id(_role_id, _client_id, _dictionary_code).await; let _role = match _expected_role { diff --git a/src/models/menu_item.rs b/src/models/menu_item.rs index b73c29d..e198093 100644 --- a/src/models/menu_item.rs +++ b/src/models/menu_item.rs @@ -5,7 +5,7 @@ use std::{io::ErrorKind, io::Error}; use crate::controller::opensearch::{find_from_dsl_body, IndexDocument}; -use super::{get_index_name, menu::{Browser, Form, Process, Window, Workflow}, role::Role}; +use super::{get_index_name, menu::MenuAction, role::Role}; #[derive(Deserialize, Extractible, Debug, Clone)] #[salvo(extract(default_source(from = "body")))] @@ -53,11 +53,11 @@ pub struct MenuItem { pub action: Option, pub action_id: Option, pub action_uuid: Option, - pub window: Option, - pub process: Option, - pub form: Option, - pub browser: Option, - pub workflow: Option + pub window: Option, + pub process: Option, + pub form: Option, + pub browser: Option, + pub workflow: Option } impl Default for MenuItem { @@ -83,11 +83,11 @@ impl Default for MenuItem { action: None, action_id: None, action_uuid: None, - window: None, - process: None, - form: None, - browser: None, - workflow: None + window: None, + process: None, + form: None, + browser: None, + workflow: None } } }