Fakultas Ilmu Komputer UI

Skip to content
Snippets Groups Projects
Commit 21bbbb31 authored by DawnFall19's avatar DawnFall19
Browse files

Implement add function in Subscriber repository.

parent aaea8ca7
Branches
No related tags found
No related merge requests found
......@@ -10,4 +10,14 @@ lazy_static! {
pub struct 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