diff --git a/README.md b/README.md index 07bc72b..b8865ce 100644 --- a/README.md +++ b/README.md @@ -46,209 +46,210 @@ The HTML code for the frontend can be generated by using `trunk build`. The resu ## Diagrams ### Class Diagramm +#### Backend ```mermaid classDiagram - namespace Backend { - class Error { - +status: &'static str - +message: String - } - class TicketResponse { - +id: i32 - +category: String - +betreff: String - +description: String - +room: i16 - +status: String - +date: chrono::DateTime~chrono::Utc~ - +user_id: i16 - +user_first_name: String - +user_last_name: String - } - class User { - +id: i16 - +last_name: String - +first_name: String - +username: String - +is_admin: bool - +pwd: String - } - class TicketCreateScheme { - +category: String - +betreff: String - +description: String - +room: i16 - } - class TicketUpdateScheme { - +status: String - } - class UserUpdateScheme { - +id: i16 - +first_name: String - +last_name: String - +username: String - +make_admin: bool - +new_pwd: String - } - class UserCreateScheme { - +first_name: String - +last_name: String - +username: String - +is_admin: bool - +pwd: String - } - class LoginScheme { - +username: String - +pwd: String - } - class FilteredUser { - +id: i16 - +first_name: String - +last_name: String - +username: String - +is_admin: bool - } - class Claims { - +sub: String - +issued: usize - +expires: usize - } - class AppState { - -db: PgPool - -env: Env - } - class Env { - +db_url: String - +token_secret: String - +origin: String - +backend_port: String - +load() Env - } + class Error { + +status: &'static str + +message: String } - namespace Frontend { - class TicketCreateScheme { - +category: String - +betreff: String - +description: String - +room: i16 - } - class TicketUpdateScheme { - +status: String - } - class Ticket { - +id: i32 - +category: String - +betreff: String - +description: String - +room: i16 - +status: String - +date: chrono::DateTime~chrono::Utc~ - +user_id: i16 - +user_first_name: String - +user_last_name: String - } - class TicketProps { - +id: i32 - } - class ActiveUser { - +id: Option~i16~ - +is_admin: bool - } - class ApiError { - -message: String - -_status: String - } - class SidebarExpandState { - +ticket_open: bool - +users_open: bool - } - class Default { - +default() Self - } - class SidebarState { - +expand: SidebarExpandState - +set_tickets_open: Callback~bool~ - +toggle_tickets: Callback~()~ - +set_users_open: Callback~bool~ - +toggle_users: Callback~()~ - +new(expand:SidebarExpandState, set_tickets_open:Callback~bool~, toggle_tickets:Callback~()~, set_users_open:Callback~bool~, toggle_users:Callback~()~) Self - } - class SidebarProps { - +children: Children - } - class TicketPartial { - -date: DateTime~Utc~ - -room: i16 - -user_id: i16 - } - class UserPartial { - -id: i16 - -first_name: String - -last_name: String - } - class RoomTotalsProps { - -tickets: Vec~TicketPartial~ - } - class UserTotalProps { - -users: Vec~UserPartial~ - -tickets: Vec~TicketPartial~ - } - class AdminSetupScheme { - +first_name: String - +last_name: String - +username: String - +pwd: String - } - class UserCreateScheme { - +first_name: String - +last_name: String - +username: String - +is_admin: bool - +pwd: String - } - class LoginScheme { - +username: String - +pwd: String - } - class UserUpdateScheme { - +id: i16 - +first_name: String - +last_name: String - +username: String - +make_admin: bool - +new_pwd: String - } - class FilteredUser { - +id: i16 - +first_name: String - +last_name: String - +username: String - +is_admin: bool - } - class UserProps { - +id: i16 - } - class ApiError { - -message: String - -_status: String - } - class AuthState { - +is_authenticated: Option~bool~ - +is_admin: Option~bool~ - } - class ProtectedRouteProps { - +children: Children - +admin_page: bool - } - class SidebarShellProps { - +children: Children - } - class AdminCheckWrapperProps { - +children: Children - } + class TicketResponse { + +id: i32 + +category: String + +betreff: String + +description: String + +room: i16 + +status: String + +date: chrono::DateTime~chrono::Utc~ + +user_id: i16 + +user_first_name: String + +user_last_name: String + } + class User { + +id: i16 + +last_name: String + +first_name: String + +username: String + +is_admin: bool + +pwd: String + } + class TicketCreateScheme { + +category: String + +betreff: String + +description: String + +room: i16 + } + class TicketUpdateScheme { + +status: String + } + class UserUpdateScheme { + +id: i16 + +first_name: String + +last_name: String + +username: String + +make_admin: bool + +new_pwd: String + } + class UserCreateScheme { + +first_name: String + +last_name: String + +username: String + +is_admin: bool + +pwd: String + } + class LoginScheme { + +username: String + +pwd: String + } + class FilteredUser { + +id: i16 + +first_name: String + +last_name: String + +username: String + +is_admin: bool + } + class Claims { + +sub: String + +issued: usize + +expires: usize + } + class AppState { + -db: PgPool + -env: Env + } + class Env { + +db_url: String + +token_secret: String + +origin: String + +backend_port: String + +load() Env } AppState --> Env Env ..> Env +``` + +#### Frontend +```mermaid + class TicketCreateScheme { + +category: String + +betreff: String + +description: String + +room: i16 + } + class TicketUpdateScheme { + +status: String + } + class Ticket { + +id: i32 + +category: String + +betreff: String + +description: String + +room: i16 + +status: String + +date: chrono::DateTime~chrono::Utc~ + +user_id: i16 + +user_first_name: String + +user_last_name: String + } + class TicketProps { + +id: i32 + } + class ActiveUser { + +id: Option~i16~ + +is_admin: bool + } + class ApiError { + -message: String + -_status: String + } + class SidebarExpandState { + +ticket_open: bool + +users_open: bool + } + class Default { + +default() Self + } + class SidebarState { + +expand: SidebarExpandState + +set_tickets_open: Callback~bool~ + +toggle_tickets: Callback~()~ + +set_users_open: Callback~bool~ + +toggle_users: Callback~()~ + +new(expand:SidebarExpandState, set_tickets_open:Callback~bool~, toggle_tickets:Callback~()~, set_users_open:Callback~bool~, toggle_users:Callback~()~) Self + } + class SidebarProps { + +children: Children + } + class TicketPartial { + -date: DateTime~Utc~ + -room: i16 + -user_id: i16 + } + class UserPartial { + -id: i16 + -first_name: String + -last_name: String + } + class RoomTotalsProps { + -tickets: Vec~TicketPartial~ + } + class UserTotalProps { + -users: Vec~UserPartial~ + -tickets: Vec~TicketPartial~ + } + class AdminSetupScheme { + +first_name: String + +last_name: String + +username: String + +pwd: String + } + class UserCreateScheme { + +first_name: String + +last_name: String + +username: String + +is_admin: bool + +pwd: String + } + class LoginScheme { + +username: String + +pwd: String + } + class UserUpdateScheme { + +id: i16 + +first_name: String + +last_name: String + +username: String + +make_admin: bool + +new_pwd: String + } + class FilteredUser { + +id: i16 + +first_name: String + +last_name: String + +username: String + +is_admin: bool + } + class UserProps { + +id: i16 + } + class ApiError { + -message: String + -_status: String + } + class AuthState { + +is_authenticated: Option~bool~ + +is_admin: Option~bool~ + } + class ProtectedRouteProps { + +children: Children + +admin_page: bool + } + class SidebarShellProps { + +children: Children + } + class AdminCheckWrapperProps { + +children: Children + } SidebarState --> SidebarExpandState RoomTotalsProps --> TicketPartial UserTotalProps --> UserPartial