Fakultas Ilmu Komputer UI

Skip to content
Snippets Groups Projects
Commit 840aab62 authored by Scallss's avatar Scallss
Browse files

Implement add function in Subscriber repository.

parent 5d7f7378
No related branches found
No related tags found
No related merge requests found
...@@ -10,4 +10,17 @@ lazy_static! { ...@@ -10,4 +10,17 @@ 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.
Finish editing this message first!
Please register or to comment