Fakultas Ilmu Komputer UI

Skip to content
Snippets Groups Projects
Commit 4424b6ec authored by rafliesa's avatar rafliesa
Browse files

Implement unsubscribe function in Notification controller

parent 16ecde8a
Branches
No related tags found
No related merge requests found
...@@ -5,6 +5,6 @@ pub mod notification; ...@@ -5,6 +5,6 @@ pub mod notification;
pub fn route_stage() -> AdHoc { pub fn route_stage() -> AdHoc {
return AdHoc::on_ignite("Initializing controller routes...", |rocket| async { return AdHoc::on_ignite("Initializing controller routes...", |rocket| async {
rocket rocket
.mount("/", routes![notification::subscribe]) .mount("/", routes![notification::subscribe, notification::unsubscribe])
}); });
} }
...@@ -11,4 +11,12 @@ pub fn subscribe(product_type: &str) -> Result<Json<SubscriberRequest>> { ...@@ -11,4 +11,12 @@ pub fn subscribe(product_type: &str) -> Result<Json<SubscriberRequest>> {
Ok(f) => Ok(Json::from(f)), Ok(f) => Ok(Json::from(f)),
Err(e) => Err(e) Err(e) => Err(e)
}; };
}
#[get("/unsubscribe/<product_type>")]
pub fn unsubscribe(product_type: &str) -> Result<Json<SubscriberRequest>> {
return match NotificationService::unsubscribe(product_type) {
Ok(f) => Ok(Json::from(f)),
Err(e) => Err(e)
};
} }
\ 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