Fakultas Ilmu Komputer UI

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

Implement the receive function in Notification controller.

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