refactor: use newtype pattern for email addresses (#819)

Co-authored-by: Sanchith Hegde <22217505+SanchithHegde@users.noreply.github.com>
This commit is contained in:
Nachiket Kanore
2023-05-04 19:28:20 +05:30
committed by GitHub
parent 92ae2d92f1
commit b8e2b1c5f4
30 changed files with 211 additions and 145 deletions

View File

@ -19,7 +19,7 @@ pub struct CustomerRequest {
pub name: Option<String>,
/// The customer's email address
#[schema(value_type = Option<String>,max_length = 255, example = "JonTest@test.com")]
pub email: Option<Secret<String, pii::Email>>,
pub email: Option<pii::Email>,
/// The customer's phone number
#[schema(value_type = Option<String>,max_length = 255, example = "9999999999")]
pub phone: Option<Secret<String>>,
@ -59,7 +59,7 @@ pub struct CustomerResponse {
pub name: Option<String>,
/// The customer's email address
#[schema(value_type = Option<String>,max_length = 255, example = "JonTest@test.com")]
pub email: Option<Secret<String, pii::Email>>,
pub email: Option<pii::Email>,
/// The customer's phone number
#[schema(value_type = Option<String>,max_length = 255, example = "9999999999")]
pub phone: Option<Secret<String>>,