Mejora y simplifica la gestión global de acciones

This commit is contained in:
Manuel Cillero 2022-05-05 21:43:00 +02:00
parent 7c8f51ba86
commit 67ddb8d899
29 changed files with 184 additions and 206 deletions

View file

@ -19,12 +19,12 @@ impl ModuleTrait for User {
cfg.route("/user/login", app::web::get().to(login));
}
fn migrations(&self) -> Vec<Box<dyn db::MigrationTrait>> {
fn migrations(&self) -> Vec<MigrationItem> {
vec![
boxed_migration!(m20220312_000001_create_table_role),
boxed_migration!(m20220312_000002_create_table_role_permission),
boxed_migration!(m20220312_000003_create_table_user),
boxed_migration!(m20220312_000004_create_table_user_role),
migration_item!(m20220312_000001_create_table_role),
migration_item!(m20220312_000002_create_table_role_permission),
migration_item!(m20220312_000003_create_table_user),
migration_item!(m20220312_000004_create_table_user_role),
]
}
}

View file

@ -9,7 +9,7 @@ enum Role {
Weight, // The weight of this role in listings and the user interface.
}
pub struct Migration;
pub_migration!(Migration);
#[async_trait::async_trait]
impl MigrationTrait for Migration {
@ -62,9 +62,3 @@ impl MigrationTrait for Migration {
.await
}
}
impl MigrationName for Migration {
fn name(&self) -> &str {
module_name!()
}
}

View file

@ -11,7 +11,7 @@ enum RolePermission {
#[derive(Iden)]
enum Role { Table, Rid, /* ... */ }
pub struct Migration;
pub_migration!(Migration);
#[async_trait::async_trait]
impl MigrationTrait for Migration {
@ -56,9 +56,3 @@ impl MigrationTrait for Migration {
.await
}
}
impl MigrationName for Migration {
fn name(&self) -> &str {
module_name!()
}
}

View file

@ -16,7 +16,7 @@ enum User {
Timezone, // User's time zone.
}
pub struct Migration;
pub_migration!(Migration);
#[async_trait::async_trait]
impl MigrationTrait for Migration {
@ -77,9 +77,3 @@ impl MigrationTrait for Migration {
.await
}
}
impl MigrationName for Migration {
fn name(&self) -> &str {
module_name!()
}
}

View file

@ -14,7 +14,7 @@ enum User { Table, Uid, /* ... */ }
#[derive(Iden)]
enum Role { Table, Rid, /* ... */ }
pub struct Migration;
pub_migration!(Migration);
#[async_trait::async_trait]
impl MigrationTrait for Migration {
@ -62,9 +62,3 @@ impl MigrationTrait for Migration {
.await
}
}
impl MigrationName for Migration {
fn name(&self) -> &str {
module_name!()
}
}