Fakultas Ilmu Komputer UI

Skip to content
Snippets Groups Projects
Commit 6277b725 authored by TheoKevH's avatar TheoKevH
Browse files

Implement list_all function in Subscriber repository

parent 70f341c0
No related branches found
No related tags found
No related merge requests found
...@@ -20,4 +20,13 @@ impl SubscriberRepository { ...@@ -20,4 +20,13 @@ impl SubscriberRepository {
.insert(subscriber_value.url.clone(), subscriber_value); .insert(subscriber_value.url.clone(), subscriber_value);
return subscriber; return subscriber;
} }
pub fn list_all(product_type: &str) -> Vec<Subscriber> {
if SUBSCRIBERS.get(product_type).is_none() {
SUBSCRIBERS.insert(String::from(product_type), DashMap::new());
};
return SUBSCRIBERS.get(product_type).unwrap().iter()
.map(|f| f.value().clone()).collect();
}
} }
\ 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