Mother and father can not be identical

This commit is contained in:
Pierre HUBERT 2023-08-05 12:12:36 +02:00
parent 5506149efc
commit c6d9264d94

View File

@ -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 {