Fakultas Ilmu Komputer UI

Skip to content
Snippets Groups Projects
Commit f614d566 authored by Ferdinand57's avatar Ferdinand57
Browse files

Implement unsubscribe function in Notification controller.

parent 2765fc22
Branches
No related tags found
No related merge requests found
......@@ -7,6 +7,6 @@ pub fn route_stage() -> AdHoc {
return AdHoc::on_ignite("Initializing controller routes...", |rocket| async {
rocket
.mount("/product", routes![product::create, product::list, product::read, product::delete])
.mount("/notification", routes![notification::subscribe])
.mount("/notification", routes![notification::subscribe, notification::unsubscribe])
});
}
......@@ -11,4 +11,12 @@ pub fn subscribe(product_type: &str, subscriber: Json<Subscriber>) -> Result<Cre
Ok(f) => Ok(Created::new("/").body(Json::from(f))),
Err(e) => Err(e)
};
}
#[post("/unsubscribe/<product_type>?<url>")]
pub fn unsubscribe(product_type: &str, url: &str) -> Result<Json<Subscriber>> {
return match NotificationService::unsubscribe(product_type, url) {
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