Fakultas Ilmu Komputer UI

Skip to content
Snippets Groups Projects
Commit 70f341c0 authored by TheoKevH's avatar TheoKevH
Browse files

Implement add function in Subscriber repository

parent 401042b0
No related branches found
No related tags found
No related merge requests found
...@@ -10,4 +10,14 @@ lazy_static! { ...@@ -10,4 +10,14 @@ lazy_static! {
pub struct SubscriberRepository; pub struct SubscriberRepository;
impl SubscriberRepository { impl SubscriberRepository {
pub fn add(product_type: &str, subscriber: Subscriber) -> Subscriber {
let subscriber_value = subscriber.clone();
if SUBSCRIBERS.get(product_type).is_none() {
SUBSCRIBERS.insert(String::from(product_type), DashMap::new());
};
SUBSCRIBERS.get(product_type).unwrap()
.insert(subscriber_value.url.clone(), subscriber_value);
return subscriber;
}
} }
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment