diff --git a/migrations/20230609121618_initial.sql b/migrations/20230609121618_initial.sql index 977a9785..089c0b90 100644 --- a/migrations/20230609121618_initial.sql +++ b/migrations/20230609121618_initial.sql @@ -1,5 +1,5 @@ CREATE TYPE role AS ENUM ('staff', 'areamanager', 'admin'); -CREATE TYPE function AS ENUM ('posten', 'wachhabender'); +CREATE TYPE function AS ENUM ('posten', 'fuehrungsassistent', 'wachhabender'); CREATE TABLE area ( @@ -52,6 +52,7 @@ CREATE TABLE event voluntaryWachhabender BOOLEAN NOT NULL, amountOfPosten SMALLINT NOT NULL CHECK (amountOfPosten >= 0), clothing TEXT NOT NULL, + note TEXT, canceled BOOLEAN NOT NULL DEFAULT false ); diff --git a/src/filters.rs b/src/filters.rs index 44e429ad..f8c35df9 100644 --- a/src/filters.rs +++ b/src/filters.rs @@ -39,12 +39,15 @@ pub fn invert(b: &bool) -> askama::Result { } pub fn show_tree(f: &Function) -> askama::Result { - let tags = match f { - Function::Posten => r#"Posten"#, - Function::Wachhabender => { - r#"PostenWachhabender"# - } - }; + let mut tags = String::from(r#"Posten"#); + + if f == &Function::Fuehrungsassistent || f == &Function::Wachhabender { + tags.push_str(r#"Führungsassistent"#); + } + + if f == &Function::Wachhabender { + tags.push_str(r#"Wachhabender"#); + } Ok(format!(r#"
{tags}
"#)) } diff --git a/src/models/function.rs b/src/models/function.rs index 95fd54aa..b03bed16 100644 --- a/src/models/function.rs +++ b/src/models/function.rs @@ -8,6 +8,7 @@ use crate::utils::ApplicationError; #[sqlx(type_name = "function", rename_all = "lowercase")] pub enum Function { Posten = 1, + Fuehrungsassistent = 5, Wachhabender = 10, } @@ -15,6 +16,7 @@ impl Display for Function { fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { match self { Function::Posten => write!(f, "Posten"), + Function::Fuehrungsassistent => write!(f, "Führungsassistent"), Function::Wachhabender => write!(f, "Wachhabender"), } }