Mother and father can not be identical
This commit is contained in:
parent
5506149efc
commit
c6d9264d94
@ -82,6 +82,8 @@ enum MemberControllerErr {
|
|||||||
MotherNotExisting,
|
MotherNotExisting,
|
||||||
#[error("Father does not exists!")]
|
#[error("Father does not exists!")]
|
||||||
FatherNotExisting,
|
FatherNotExisting,
|
||||||
|
#[error("Mother and father can not be identical!")]
|
||||||
|
MotherAndFatherIdentical,
|
||||||
}
|
}
|
||||||
|
|
||||||
fn check_opt_str_val(
|
fn check_opt_str_val(
|
||||||
@ -188,6 +190,10 @@ impl MemberRequest {
|
|||||||
if !members_service::exists(member.family_id(), mother).await? {
|
if !members_service::exists(member.family_id(), mother).await? {
|
||||||
return Err(MemberControllerErr::MotherNotExisting.into());
|
return Err(MemberControllerErr::MotherNotExisting.into());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if self.mother == self.father {
|
||||||
|
return Err(MemberControllerErr::MotherAndFatherIdentical.into());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if let Some(father) = self.father {
|
if let Some(father) = self.father {
|
||||||
|
Loading…
Reference in New Issue
Block a user