Implemented settings for properties of reservation. Fixed bugs on empty database.

This commit is contained in:
2023-12-08 17:02:00 +01:00
parent d7e33e4342
commit 55ca93406a
14 changed files with 456 additions and 21 deletions
+12 -1
View File
@@ -1,3 +1,7 @@
use log::error;
use rezervator::backend::company::check_company;
use rezervator::backend::user::create_admin;
#[cfg(feature = "ssr")]
#[actix_web::main]
async fn main() -> std::io::Result<()> {
@@ -34,7 +38,7 @@ async fn main() -> std::io::Result<()> {
let cfg_path = matches.opt_str("c").unwrap_or("config.toml".to_string());
env_logger::Builder::from_env(Env::default().default_filter_or("info")).init();
env_logger::Builder::from_env(Env::default().default_filter_or("debug")).init();
info!("Starting server");
let conf = get_configuration(None).await.unwrap();
@@ -49,6 +53,13 @@ async fn main() -> std::io::Result<()> {
migrate!().run(&pool).await.expect("could not run SQLx migrations");
if let Err(e) = create_admin(&pool).await {
error!("Error while checking admin user: {:?}", e);
}
if let Err(e) = check_company(&pool).await {
error!("Error while checking company: {:?}", e);
}
HttpServer::new(move || {
let leptos_options = &conf.leptos_options;
let site_root = &leptos_options.site_root;