From dd358d8db729fab1ce130a2672ea34f12d34eae5 Mon Sep 17 00:00:00 2001 From: Christian Raphael Heryanto <christian.raphael@ui.ac.id> Date: Fri, 28 Mar 2025 15:01:05 +0800 Subject: [PATCH] Implement list_all_as_string function in Subscriber repository. --- src/repository/notification.rs | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/repository/notification.rs b/src/repository/notification.rs index cde012e..43a9401 100644 --- a/src/repository/notification.rs +++ b/src/repository/notification.rs @@ -16,4 +16,13 @@ impl NotificationRepository { NOTIFICATIONS.write().unwrap().push(notification.clone()); return notification; } + + pub fn list_all_as_string() -> Vec<String> { + return NOTIFICATIONS + .read() + .unwrap() + .iter() + .map(|f| format!("{}", f.clone())) + .collect(); + } } -- GitLab