Fakultas Ilmu Komputer UI

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

Implement list function in Notification controller.

parent 1f026efb
No related branches found
No related tags found
No related merge requests found
...@@ -4,7 +4,11 @@ pub mod notification; ...@@ -4,7 +4,11 @@ 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, notification::unsubscribe, .mount("/", routes![
notification::receive]) notification::subscribe,
notification::unsubscribe,
notification::receive,
notification::list
])
}); });
} }
...@@ -27,4 +27,12 @@ pub fn receive(notification: Json<Notification>) -> Result<Json<Notification>> { ...@@ -27,4 +27,12 @@ pub fn receive(notification: Json<Notification>) -> Result<Json<Notification>> {
Ok(f) => Ok(Json::from(f)), Ok(f) => Ok(Json::from(f)),
Err(e) => Err(e) Err(e) => Err(e)
}; };
}
#[get("/")]
pub fn list() -> Result<Json<Vec<String>>> {
return match NotificationService::list_messages() {
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