Skip to content

Commit

Permalink
Fix request
Browse files Browse the repository at this point in the history
  • Loading branch information
amaury1093 committed Nov 25, 2024
1 parent 3bb5052 commit 0f5cb48
Showing 1 changed file with 15 additions and 8 deletions.
23 changes: 15 additions & 8 deletions backend/src/http/v0/check_email/post.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@
//! This file implements the `POST /v0/check_email` endpoint.

use check_if_email_exists::{
check_email, CheckEmailInput, CheckEmailInputProxy, GmailVerifMethod, LOG_TARGET,
check_email, CheckEmailInput, CheckEmailInputProxy, GmailVerifMethod, HotmailB2BVerifMethod,
HotmailB2CVerifMethod, YahooVerifMethod, LOG_TARGET,
};
use serde::{Deserialize, Serialize};
use std::sync::Arc;
Expand All @@ -34,10 +35,11 @@ pub struct CheckEmailRequest {
pub from_email: Option<String>,
pub hello_name: Option<String>,
pub gmail_verif_method: Option<GmailVerifMethod>,
pub hotmailb2b_verif_method: Option<String>,
pub hotmailb2c_verif_method: Option<String>,
pub yahoo_verif_method: Option<String>,
pub hotmailb2b_verif_method: Option<HotmailB2BVerifMethod>,
pub hotmailb2c_verif_method: Option<HotmailB2CVerifMethod>,
pub yahoo_verif_method: Option<YahooVerifMethod>,
pub proxy: Option<CheckEmailInputProxy>,
pub smtp_port: Option<u16>,
}

impl CheckEmailRequest {
Expand All @@ -46,16 +48,21 @@ impl CheckEmailRequest {
to_email: self.to_email.clone(),
from_email: self.from_email.clone().unwrap_or(config.from_email.clone()),
hello_name: self.hello_name.clone().unwrap_or(config.hello_name.clone()),
gmail_verif_method: config.verif_method.gmail,
hotmailb2b_verif_method: config.verif_method.hotmailb2b,
hotmailb2c_verif_method: config.verif_method.hotmailb2c,
yahoo_verif_method: config.verif_method.yahoo,
gmail_verif_method: self.gmail_verif_method.unwrap_or(config.verif_method.gmail),
hotmailb2b_verif_method: self
.hotmailb2b_verif_method
.unwrap_or(config.verif_method.hotmailb2b),
hotmailb2c_verif_method: self
.hotmailb2c_verif_method
.unwrap_or(config.verif_method.hotmailb2c),
yahoo_verif_method: self.yahoo_verif_method.unwrap_or(config.verif_method.yahoo),
proxy: self
.proxy
.as_ref()
.or_else(|| config.proxy.as_ref())
.cloned(),
smtp_timeout: config.smtp_timeout.map(Duration::from_secs),
smtp_port: self.smtp_port.unwrap_or_default(),
sentry_dsn: config.sentry_dsn.clone(),
..Default::default()
}
Expand Down

0 comments on commit 0f5cb48

Please sign in to comment.