This repository has been archived by the owner on Feb 9, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add entry_kinds and BasePersonaDataEntry trait
- Loading branch information
Showing
14 changed files
with
746 additions
and
436 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
use super::entry_kinds::{ | ||
associated_url::AssociatedURL, company_name::CompanyName, credit_card::CreditCard, | ||
date_of_birth::DateOfBirth, email_address::EmailAddress, name::Name, phone_number::PhoneNumber, | ||
postal_address::PostalAddress, | ||
}; | ||
use serde::{Deserialize, Serialize}; | ||
|
||
pub trait BasePersonaDataEntry { | ||
fn embed(&self) -> Self; | ||
fn description(&self) -> String; | ||
} | ||
|
||
#[derive(Serialize, Deserialize)] | ||
pub enum Entry { | ||
Name(Name), | ||
DateOfBirth(DateOfBirth), | ||
CompanyName(CompanyName), | ||
|
||
EmailAddress(EmailAddress), | ||
PhoneNumber(PhoneNumber), | ||
Url(AssociatedURL), | ||
PostalAddress(PostalAddress), | ||
CreditCard(CreditCard), | ||
} | ||
|
||
impl BasePersonaDataEntry for Entry { | ||
fn embed(&self) -> Self { | ||
match self { | ||
Self::Name(name) => Self::Name(name.embed()), | ||
Self::CompanyName(company) => Self::CompanyName(company.embed()), | ||
Self::CreditCard(credit_card) => Self::CreditCard(credit_card.embed()), | ||
Self::DateOfBirth(date_of_birth) => Self::DateOfBirth(date_of_birth.embed()), | ||
Self::EmailAddress(email) => Self::EmailAddress(email.embed()), | ||
Self::PhoneNumber(phone) => Self::PhoneNumber(phone.embed()), | ||
Self::PostalAddress(postal) => Self::PostalAddress(postal.embed()), | ||
Self::Url(url) => Self::Url(url.embed()), | ||
} | ||
} | ||
fn description(&self) -> String { | ||
match self { | ||
Self::Name(name) => name.description(), | ||
Self::CompanyName(company) => company.description(), | ||
Self::CreditCard(credit_card) => credit_card.description(), | ||
Self::DateOfBirth(date_of_birth) => date_of_birth.description(), | ||
Self::EmailAddress(email) => email.description(), | ||
Self::PhoneNumber(phone) => phone.description(), | ||
Self::PostalAddress(postal) => postal.description(), | ||
Self::Url(url) => url.description(), | ||
} | ||
} | ||
} |
15 changes: 15 additions & 0 deletions
15
profile/src/v100/entity/persona/persona_data/entry_kinds/associated_url.rs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
use crate::v100::entity::persona::persona_data::entry::BasePersonaDataEntry; | ||
use serde::{Deserialize, Serialize}; | ||
|
||
#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq, Default)] | ||
pub struct AssociatedURL {} | ||
|
||
impl BasePersonaDataEntry for AssociatedURL { | ||
fn embed(&self) -> Self { | ||
self.embed() | ||
} | ||
|
||
fn description(&self) -> String { | ||
todo!() | ||
} | ||
} |
15 changes: 15 additions & 0 deletions
15
profile/src/v100/entity/persona/persona_data/entry_kinds/company_name.rs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
use crate::v100::entity::persona::persona_data::entry::BasePersonaDataEntry; | ||
use serde::{Deserialize, Serialize}; | ||
|
||
#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq, Default)] | ||
pub struct CompanyName {} | ||
|
||
impl BasePersonaDataEntry for CompanyName { | ||
fn embed(&self) -> Self { | ||
self.embed() | ||
} | ||
|
||
fn description(&self) -> String { | ||
todo!() | ||
} | ||
} |
15 changes: 15 additions & 0 deletions
15
profile/src/v100/entity/persona/persona_data/entry_kinds/credit_card.rs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
use crate::v100::entity::persona::persona_data::entry::BasePersonaDataEntry; | ||
use serde::{Deserialize, Serialize}; | ||
|
||
#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq, Default)] | ||
pub struct CreditCard {} | ||
|
||
impl BasePersonaDataEntry for CreditCard { | ||
fn embed(&self) -> Self { | ||
self.embed() | ||
} | ||
|
||
fn description(&self) -> String { | ||
todo!() | ||
} | ||
} |
15 changes: 15 additions & 0 deletions
15
profile/src/v100/entity/persona/persona_data/entry_kinds/date_of_birth.rs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
use crate::v100::entity::persona::persona_data::entry::BasePersonaDataEntry; | ||
use serde::{Deserialize, Serialize}; | ||
|
||
#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq, Default)] | ||
pub struct DateOfBirth {} | ||
|
||
impl BasePersonaDataEntry for DateOfBirth { | ||
fn embed(&self) -> Self { | ||
self.embed() | ||
} | ||
|
||
fn description(&self) -> String { | ||
todo!() | ||
} | ||
} |
15 changes: 15 additions & 0 deletions
15
profile/src/v100/entity/persona/persona_data/entry_kinds/email_address.rs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
use crate::v100::entity::persona::persona_data::entry::BasePersonaDataEntry; | ||
use serde::{Deserialize, Serialize}; | ||
|
||
#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq, Default)] | ||
pub struct EmailAddress {} | ||
|
||
impl BasePersonaDataEntry for EmailAddress { | ||
fn embed(&self) -> Self { | ||
self.embed() | ||
} | ||
|
||
fn description(&self) -> String { | ||
todo!() | ||
} | ||
} |
8 changes: 8 additions & 0 deletions
8
profile/src/v100/entity/persona/persona_data/entry_kinds/mod.rs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
pub mod associated_url; | ||
pub mod company_name; | ||
pub mod credit_card; | ||
pub mod date_of_birth; | ||
pub mod email_address; | ||
pub mod name; | ||
pub mod phone_number; | ||
pub mod postal_address; |
15 changes: 15 additions & 0 deletions
15
profile/src/v100/entity/persona/persona_data/entry_kinds/name.rs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
use crate::v100::entity::persona::persona_data::entry::BasePersonaDataEntry; | ||
use serde::{Deserialize, Serialize}; | ||
|
||
#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq, Default)] | ||
pub struct Name {} | ||
|
||
impl BasePersonaDataEntry for Name { | ||
fn embed(&self) -> Self { | ||
self.embed() | ||
} | ||
|
||
fn description(&self) -> String { | ||
todo!() | ||
} | ||
} |
15 changes: 15 additions & 0 deletions
15
profile/src/v100/entity/persona/persona_data/entry_kinds/phone_number.rs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
use crate::v100::entity::persona::persona_data::entry::BasePersonaDataEntry; | ||
use serde::{Deserialize, Serialize}; | ||
|
||
#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq, Default)] | ||
pub struct PhoneNumber {} | ||
|
||
impl BasePersonaDataEntry for PhoneNumber { | ||
fn embed(&self) -> Self { | ||
self.embed() | ||
} | ||
|
||
fn description(&self) -> String { | ||
todo!() | ||
} | ||
} |
15 changes: 15 additions & 0 deletions
15
profile/src/v100/entity/persona/persona_data/entry_kinds/postal_address.rs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
use crate::v100::entity::persona::persona_data::entry::BasePersonaDataEntry; | ||
use serde::{Deserialize, Serialize}; | ||
|
||
#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq, Default)] | ||
pub struct PostalAddress {} | ||
|
||
impl BasePersonaDataEntry for PostalAddress { | ||
fn embed(&self) -> Self { | ||
self.embed() | ||
} | ||
|
||
fn description(&self) -> String { | ||
todo!() | ||
} | ||
} |
Oops, something went wrong.