diff --git a/geneit_backend/src/controllers/members_controller.rs b/geneit_backend/src/controllers/members_controller.rs index dafab9f..3651eff 100644 --- a/geneit_backend/src/controllers/members_controller.rs +++ b/geneit_backend/src/controllers/members_controller.rs @@ -82,6 +82,8 @@ enum MemberControllerErr { MotherNotExisting, #[error("Father does not exists!")] FatherNotExisting, + #[error("Mother and father can not be identical!")] + MotherAndFatherIdentical, } fn check_opt_str_val( @@ -188,6 +190,10 @@ impl MemberRequest { if !members_service::exists(member.family_id(), mother).await? { return Err(MemberControllerErr::MotherNotExisting.into()); } + + if self.mother == self.father { + return Err(MemberControllerErr::MotherAndFatherIdentical.into()); + } } if let Some(father) = self.father {