fix: schema default value

This commit is contained in:
Maulana Sodiqin
2025-05-22 15:25:24 +07:00
parent 48db5f07ef
commit 68e816f956
3 changed files with 15 additions and 10 deletions
@@ -28,7 +28,6 @@ impl<'a> RolesRepository<'a> {
&ResourceEnum::Roles.to_string(), &ResourceEnum::Roles.to_string(),
&meta, &meta,
) )
.with_condition("is_deleted = false")
.search_field("name") .search_field("name")
.build() .build()
.await?; .await?;
+1 -1
View File
@@ -46,7 +46,7 @@ impl RolesSchema {
.permissions .permissions
.into_iter() .into_iter()
.map(|perm| { .map(|perm| {
make_thing(&ResourceEnum::Permissions.to_string(), &perm.id.to_raw()) make_thing(&ResourceEnum::Permissions.to_string(), &perm.id.id.to_raw())
}) })
.collect(), .collect(),
is_deleted: dto.is_deleted, is_deleted: dto.is_deleted,
+14 -8
View File
@@ -24,19 +24,25 @@ pub struct UsersSchema {
impl Default for UsersSchema { impl Default for UsersSchema {
fn default() -> Self { fn default() -> Self {
Self { Self {
id: Thing::from(("app_users", "dummy")), id: make_thing(
fullname: "".into(), &ResourceEnum::Users.to_string(),
email: "".into(), &Uuid::new_v4().to_string(),
password: "".into(), ),
fullname: String::new(),
email: String::new(),
password: hash_password("").unwrap(),
avatar: None, avatar: None,
phone_number: "".into(), phone_number: String::new(),
is_active: false, is_active: false,
is_deleted: false, is_deleted: false,
gender: None, gender: None,
birthdate: None, birthdate: None,
role: Thing::from(("app_roles", "dummy")), role: make_thing(
created_at: "".into(), &ResourceEnum::Roles.to_string(),
updated_at: "".into(), "5713cb37-dc02-4e87-8048-d7a41d352059",
),
created_at: get_iso_date(),
updated_at: get_iso_date(),
} }
} }
} }