Fakultas Ilmu Komputer UI

Skip to content
Snippets Groups Projects
Commit 5d033e87 authored by DawnFall19's avatar DawnFall19
Browse files

Implement delete function in Subscriber repository.

parent 9989b38a
No related branches found
No related tags found
No related merge requests found
...@@ -29,4 +29,17 @@ impl SubscriberRepository { ...@@ -29,4 +29,17 @@ impl SubscriberRepository {
return SUBSCRIBERS.get(product_type).unwrap().iter() return SUBSCRIBERS.get(product_type).unwrap().iter()
.map(|f| f.value().clone()).collect(); .map(|f| f.value().clone()).collect();
} }
pub fn delete(product_type: &str, url: &str) -> Option<Subscriber> {
if SUBSCRIBERS.get(product_type).is_none() {
SUBSCRIBERS.insert(String::from(product_type), DashMap::new());
}
let result = SUBSCRIBERS.get(product_type).unwrap()
.remove(url);
if !result.is_none() {
return Some(result.unwrap().1);
}
return None;
}
} }
\ 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