From 0b5e4ca7af65a57bce9f3cb01df9c4eefb10c245 Mon Sep 17 00:00:00 2001 From: Keagan McClelland Date: Wed, 5 May 2021 10:01:16 -0600 Subject: [PATCH] Agent/feature/delete all notifications (#317) * updates to GHC 8.10.4 * adds delete all notifications handler --- agent/config/routes | 2 +- agent/src/Handler/Notifications.hs | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/agent/config/routes b/agent/config/routes index a82b46809..467ccc691 100644 --- a/agent/config/routes +++ b/agent/config/routes @@ -50,7 +50,7 @@ /v0/wifi WifiR GET POST /v0/wifi/#Text WifiBySsidR POST DELETE -/v0/notifications NotificationsR GET +/v0/notifications NotificationsR GET DELETE /v0/notifications/#UUID NotificationR DELETE /v0/shutdown ShutdownR POST diff --git a/agent/src/Handler/Notifications.hs b/agent/src/Handler/Notifications.hs index 9d99a1076..9500b3c42 100644 --- a/agent/src/Handler/Notifications.hs +++ b/agent/src/Handler/Notifications.hs @@ -28,5 +28,9 @@ getNotificationsR = runDB $ do Nothing -> pure a Just x -> pure x +deleteNotificationsR :: Handler () +deleteNotificationsR = do + runDB $ deleteWhere ([] :: [Filter Notification]) + deleteNotificationR :: UUID -> Handler () deleteNotificationR notifId = runDB $ delete (coerce @_ @(Key Notification) notifId)