pub mod backup;
use rustlavel::Plugin;
pub trait Module: Plugin {
fn migrations(&self) -> Vec<&'static dyn rustlavel::db::Migration> {
Vec::new()
}
fn seeders(&self) -> Vec<&'static dyn rustlavel::db::Seeder> {
Vec::new()
}
fn permissions(&self) -> &'static [(&'static str, &'static str)] {
&[]
}
fn settings(&self) -> &'static [crate::support::settings::Setting] {
&[]
}
}
pub fn all() -> Vec<Box<dyn Module>> {
vec![Box::new(backup::Backup)]
}
pub fn migrations() -> Vec<&'static dyn rustlavel::db::Migration> {
all().iter().flat_map(|module| module.migrations()).collect()
}
pub fn seeders() -> Vec<&'static dyn rustlavel::db::Seeder> {
all().iter().flat_map(|module| module.seeders()).collect()
}
pub fn permissions() -> Vec<(&'static str, &'static str)> {
all().iter().flat_map(|module| module.permissions().iter().copied()).collect()
}
pub fn settings() -> Vec<crate::support::settings::Setting> {
all().iter().flat_map(|module| module.settings().iter().copied()).collect()
}