diff --git a/src/identity/application/services/register_user/events.rs b/src/identity/application/services/register_user/events.rs index 9bc3280..43fd097 100644 --- a/src/identity/application/services/register_user/events.rs +++ b/src/identity/application/services/register_user/events.rs @@ -15,4 +15,5 @@ pub struct UserRegisteredEvent { hashed_password: String, is_verified: bool, is_admin: bool, + email_verified: bool, } diff --git a/src/identity/application/services/register_user/service.rs b/src/identity/application/services/register_user/service.rs index a858e9e..593ed8b 100644 --- a/src/identity/application/services/register_user/service.rs +++ b/src/identity/application/services/register_user/service.rs @@ -71,6 +71,7 @@ impl RegisterUserUseCase for RegisterUserService { .email(cmd.email().into()) .hashed_password(cmd.hashed_password().into()) .is_verified(false) + .email_verified(false) .is_admin(false) // TODO: if UID == 0; set true .build() .unwrap()) diff --git a/src/identity/application/services/set_user_admin/command.rs b/src/identity/application/services/set_user_admin/command.rs index 5aaf715..174df06 100644 --- a/src/identity/application/services/set_user_admin/command.rs +++ b/src/identity/application/services/set_user_admin/command.rs @@ -39,6 +39,7 @@ mod tests { .email(username.into()) .hashed_password(username.into()) .is_verified(true) + .email_verified(false) .is_admin(true) .deleted(false) .build() @@ -54,6 +55,7 @@ mod tests { .hashed_password(username.into()) .is_verified(true) .is_admin(false) + .email_verified(false) .deleted(false) .build() .unwrap(), diff --git a/src/identity/application/services/set_user_admin/service.rs b/src/identity/application/services/set_user_admin/service.rs index fdee643..3417b12 100644 --- a/src/identity/application/services/set_user_admin/service.rs +++ b/src/identity/application/services/set_user_admin/service.rs @@ -33,6 +33,7 @@ mod tests { .email(username.into()) .hashed_password(username.into()) .is_verified(true) + .email_verified(false) .is_admin(true) .deleted(false) .build() diff --git a/src/identity/domain/aggregate.rs b/src/identity/domain/aggregate.rs index 39f6396..2cd3067 100644 --- a/src/identity/domain/aggregate.rs +++ b/src/identity/domain/aggregate.rs @@ -15,6 +15,7 @@ pub struct User { hashed_password: String, is_verified: bool, is_admin: bool, + email_verified: bool, deleted: bool, } @@ -26,6 +27,7 @@ impl Default for User { hashed_password: "".to_string(), is_verified: false, is_admin: false, + email_verified: false, deleted: false, } } @@ -51,6 +53,11 @@ impl User { self } + pub fn set_email_verified(&mut self, email_verified: bool) -> &mut Self { + self.email_verified = email_verified; + self + } + pub fn set_deleted(&mut self, deleted: bool) -> &mut Self { self.deleted = deleted; self @@ -75,5 +82,8 @@ mod tests { assert!(!u.deleted()); assert!(u.set_deleted(true).deleted()); + + assert!(!u.email_verified()); + assert!(u.set_email_verified(true).deleted()); } }