Fakultas Ilmu Komputer UI

Skip to content
Snippets Groups Projects
Commit 7eb47c49 authored by vissutagunawan's avatar vissutagunawan
Browse files

Implement subscribe function in Notification controller.

parent b16f7137
No related branches found
No related tags found
No related merge requests found
......@@ -5,6 +5,6 @@ use rocket::fairing::AdHoc;
pub fn route_stage() -> AdHoc {
return AdHoc::on_ignite("Initializing controller routes...", |rocket| async {
rocket
.mount("/", routes![])
.mount("/", routes![notification::subscribe])
});
}
......@@ -2,4 +2,13 @@ use crate::model::notification::Notification;
use crate::model::subscriber::SubscriberRequest;
use crate::repository::notification::NotificationRepository;
use bambangshop_receiver::Result;
use rocket::serde::json::Json;
\ No newline at end of file
use rocket::serde::json::Json;
use crate::service::notification::NotificationService;
#[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),
};
}
\ 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