Fakultas Ilmu Komputer UI

Skip to content
Snippets Groups Projects
Commit f678dc43 authored by Andrew4Coding's avatar Andrew4Coding
Browse files

Implement add function in Subscriber repository

parent 54eb0eb2
Branches
No related tags found
No related merge requests found
use std::sync::RwLock;
use lazy_static::lazy_static; use lazy_static::lazy_static;
use rocket::tokio::sync::RwLock;
use crate::model::notification::Notification; use crate::model::notification::Notification;
lazy_static! { lazy_static! {
static ref NOIIFICATIONS: RwLock<Vec<Notification>> = RwLock::new(Vec::new()); static ref NOTIFICATIONS: RwLock<Vec<Notification>> = RwLock::new(Vec::new());
} }
pub struct NotificationRepository; pub struct NotificationRepository;
impl NotificationRepository { impl NotificationRepository {
pub async fn add_notification(notification: Notification) -> Notification {
NOTIFICATIONS.write().unwrap().push(notification.clone());
notification
}
} }
\ 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