From e589b43b22ab9aa1b600ba2234a26d9c902268bd Mon Sep 17 00:00:00 2001 From: raja <rafaelraja.sitorus@gmail.com> Date: Fri, 28 Mar 2025 21:38:09 +0800 Subject: [PATCH] Implement add function in subscriber repository. --- src/repository/notification.rs | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/src/repository/notification.rs b/src/repository/notification.rs index eb74225..eee5b42 100644 --- a/src/repository/notification.rs +++ b/src/repository/notification.rs @@ -1,8 +1,4 @@ -use std::sync::RwLock; - - use lazy_static::lazy_static; - - use crate::model::notification::Notification; +use crate::model::notification::Notification; // Singleton of Database @@ -13,4 +9,9 @@ use std::sync::RwLock; pub struct NotificationRepository; impl NotificationRepository { + pub fn add(notification: Notification) -> Notification { + NOTIFICATIONS.write().unwrap() + .push(notification.clone()); + return notification; + } } \ No newline at end of file -- GitLab