mod app;
use renox::audit::Audit;
use renox::auth::{Auth, Permissions};
use renox::nav::NavLink;
pub use app::roles;
pub fn app() -> renox::App {
renox::App::new()
.embed(renox::embedded!())
.migrations(renox::migrations!())
.module(
Auth::new()
.verify_email() .account() .notifications() .magic_link() .redirect_to("/dashboard")
.on_registered(|user, _form, state| async move {
roles::define(&state.db).await?;
user.assign_role(&state.db, roles::MEMBER).await
}),
)
.module(Permissions)
.module(Audit)
.module(app::home::Home)
.module(app::dashboard::Dashboard)
.module(app::users::Users)
.module(app::activity::Activity)
.command(
"users:admin",
"Give the user with this email the admin role",
app::roles::make_admin,
)
.nav(
"app",
NavLink::route("notifications.index", "nav.notifications")
.icon("bell")
.order(1)
.when(|_| true),
)
.nav(
"app",
NavLink::route("account.show", "nav.account")
.icon("circle-user")
.group("nav.app")
.order(21)
.when(|_| true),
)
.seeder(app::seed::run)
.share("demo_logins", app::demo::for_view)
}