Ready to implement photos management

This commit is contained in:
2023-08-05 19:15:52 +02:00
parent 4cd7519890
commit 02da973dd8
11 changed files with 195 additions and 20 deletions

View File

@ -117,6 +117,10 @@ pub struct FamilyMembership {
pub count_admins: i64,
}
/// Photo ID holder
#[derive(Debug, Clone, Copy, serde::Serialize, serde::Deserialize, Eq, PartialEq, Hash)]
pub struct PhotoID(pub i32);
/// Member ID holder
#[derive(Debug, Clone, Copy, serde::Serialize, serde::Deserialize, Eq, PartialEq, Hash)]
pub struct MemberID(pub i32);
@ -153,7 +157,7 @@ pub struct Member {
pub first_name: Option<String>,
pub last_name: Option<String>,
pub birth_last_name: Option<String>,
pub photo_id: Option<String>,
photo_id: Option<i32>,
pub email: Option<String>,
pub phone: Option<String>,
pub address: Option<String>,
@ -183,6 +187,10 @@ impl Member {
FamilyID(self.family_id)
}
pub fn photo_id(&self) -> Option<PhotoID> {
self.photo_id.map(PhotoID)
}
pub fn sex(&self) -> Option<Sex> {
self.sex.as_deref().map(Sex::parse_str).unwrap_or_default()
}