Fakultas Ilmu Komputer UI

Skip to content
Snippets Groups Projects
Commit 92f9e703 authored by Ida Made Revindra Dikta Mahendra's avatar Ida Made Revindra Dikta Mahendra
Browse files

[CHORE]: Implement add function in Subscriber repository

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