Fakultas Ilmu Komputer UI

Skip to content
Snippets Groups Projects
Commit a6487874 authored by Christian Raphael Heryanto's avatar Christian Raphael Heryanto
Browse files

Implement subscribe function in Notification controller.

parent 4714845e
No related branches found
No related tags found
No related merge requests found
......@@ -3,6 +3,6 @@ pub mod notification;
pub fn route_stage() -> AdHoc {
return AdHoc::on_ignite("Initializing controller routes...", |rocket| async {
rocket.mount("/", routes![])
rocket.mount("/", routes![notification::subscribe])
});
}
......@@ -4,3 +4,11 @@ use crate::model::notification::Notification;
use crate::model::subscriber::SubscriberRequest;
use crate::service::notification::NotificationService;
use bambangshop_receiver::Result;
#[get("/subscribe/<product_type>")]
pub fn subscribe(product_type: &str) -> Result<Json<SubscriberRequest>> {
return match NotificationService::subscribe(product_type) {
Ok(f) => Ok(Json::from(f)),
Err(e) => Err(e),
};
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment