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(),
&meta,
)
.with_condition("is_deleted = false")
.search_field("name")
.build()
.await?;
+1 -1
View File
@@ -46,7 +46,7 @@ impl RolesSchema {
.permissions
.into_iter()
.map(|perm| {
make_thing(&ResourceEnum::Permissions.to_string(), &perm.id.to_raw())
make_thing(&ResourceEnum::Permissions.to_string(), &perm.id.id.to_raw())
})
.collect(),
is_deleted: dto.is_deleted,
+14 -8
View File
@@ -24,19 +24,25 @@ pub struct UsersSchema {
impl Default for UsersSchema {
fn default() -> Self {
Self {
id: Thing::from(("app_users", "dummy")),
fullname: "".into(),
email: "".into(),
password: "".into(),
id: make_thing(
&ResourceEnum::Users.to_string(),
&Uuid::new_v4().to_string(),
),
fullname: String::new(),
email: String::new(),
password: hash_password("").unwrap(),
avatar: None,
phone_number: "".into(),
phone_number: String::new(),
is_active: false,
is_deleted: false,
gender: None,
birthdate: None,
role: Thing::from(("app_roles", "dummy")),
created_at: "".into(),
updated_at: "".into(),
role: make_thing(
&ResourceEnum::Roles.to_string(),
"5713cb37-dc02-4e87-8048-d7a41d352059",
),
created_at: get_iso_date(),
updated_at: get_iso_date(),
}
}
}