Fakultas Ilmu Komputer UI

Skip to content
Snippets Groups Projects
Commit 705a51fa authored by vissutagunawan's avatar vissutagunawan
Browse files

Implement unsubscribe function in Notification service.

parent bc995fc1
No related branches found
No related tags found
No related merge requests found
......@@ -15,4 +15,17 @@ impl NotificationService {
let subscriber_result = SubscriberRepository::add(product_type_str, subscriber);
return Ok(subscriber_result);
}
pub fn unsubscribe(product_type: &str, url: &str) -> Result<Subscriber> {
let product_type_upper = product_type.to_uppercase();
let product_type_str = product_type_upper.as_str();
let result = SubscriberRepository::delete(product_type_str, url);
if result.is_none() {
return Err(compose_error_response(
Status::NotFound,
"Subscriber not found".to_string(),
));
}
return Ok(result.unwrap());
}
}
\ 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