mirror of
https://github.com/danbulant/Portfolio
synced 2026-07-05 11:00:56 +00:00
feat: map application details
This commit is contained in:
parent
7bce4bf0bc
commit
e5e91aff9a
1 changed files with 8 additions and 12 deletions
|
|
@ -245,12 +245,10 @@ impl EncryptedApplicationDetails {
|
||||||
recipients: Vec<String>,
|
recipients: Vec<String>,
|
||||||
) -> Result<EncryptedApplicationDetails, ServiceError> {
|
) -> Result<EncryptedApplicationDetails, ServiceError> {
|
||||||
let candidate = EncryptedCandidateDetails::new(&form.candidate, &recipients).await?;
|
let candidate = EncryptedCandidateDetails::new(&form.candidate, &recipients).await?;
|
||||||
let mut enc_parents= vec![];
|
let enc_parents = future::try_join_all(
|
||||||
for parent in form.parents.iter() {
|
form.parents.iter()
|
||||||
enc_parents.push(
|
.map(|d| EncryptedParentDetails::new(d, &recipients))
|
||||||
EncryptedParentDetails::new(parent, &recipients).await?
|
).await?;
|
||||||
);
|
|
||||||
}
|
|
||||||
Ok(
|
Ok(
|
||||||
EncryptedApplicationDetails {
|
EncryptedApplicationDetails {
|
||||||
candidate,
|
candidate,
|
||||||
|
|
@ -282,12 +280,10 @@ impl TryFrom<(candidate::Model, Vec<parent::Model>)> for EncryptedApplicationDet
|
||||||
fn try_from(
|
fn try_from(
|
||||||
(candidate, parents): (candidate::Model, Vec<parent::Model>),
|
(candidate, parents): (candidate::Model, Vec<parent::Model>),
|
||||||
) -> Result<Self, Self::Error> {
|
) -> Result<Self, Self::Error> {
|
||||||
let mut enc_parents = vec![];
|
let enc_parents = parents.iter()
|
||||||
for parent in parents.iter() {
|
.map(|m| EncryptedParentDetails::try_from(m.clone()))
|
||||||
enc_parents.push(
|
.collect::<Result<Vec<EncryptedParentDetails>, ServiceError>>()?;
|
||||||
EncryptedParentDetails::try_from(parent.clone())?
|
|
||||||
);
|
|
||||||
}
|
|
||||||
Ok(EncryptedApplicationDetails {
|
Ok(EncryptedApplicationDetails {
|
||||||
candidate: EncryptedCandidateDetails::try_from(candidate)?,
|
candidate: EncryptedCandidateDetails::try_from(candidate)?,
|
||||||
parents: enc_parents,
|
parents: enc_parents,
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue