Fakultas Ilmu Komputer UI

Skip to content
Snippets Groups Projects
Commit f299af4d authored by dzak27567's avatar dzak27567
Browse files

Implement the receive function in Notification controller.

parent a05fa30e
No related branches found
No related tags found
No related merge requests found
......@@ -3,7 +3,8 @@ 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(r) => Ok(Json::from(r)),
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.
Finish editing this message first!
Please register or to comment