use std::collections::HashSet;
use uuid::Uuid;
use crate::db::{Collectable, Identifiable};
#[derive(Clone, Debug, Deserialize, Serialize)]
pub struct Subscriber {
pub id: Uuid,
pub address: String,
pub confirmed: bool,
pub lists: HashSet<String>,
pub marketing_consent: bool,
pub notes: String,
}
impl Subscriber {
pub fn new(address: String) -> Self {
Self {
id: Uuid::new_v4(),
address,
confirmed: false,
lists: Default::default(),
marketing_consent: false,
notes: String::new(),
}
}
}
impl Collectable for Subscriber {
fn get_collection_name() -> &'static str {
"email_subscriptions"
}
}
impl Identifiable for Subscriber {
fn get_id(&self) -> Uuid {
self.id
}
}