From 7a590ade7ef836195977645c8ecd1dc2c5f42753 Mon Sep 17 00:00:00 2001
From: redxef <redxef@redxef.at>
Date: Sun, 9 Mar 2025 20:27:45 +0100
Subject: [PATCH] feat: allow deleting of smart playlists.

---
 .../Api/SmartCollectionController.cs                      | 8 ++++++++
 .../Api/SmartPlaylistController.cs                        | 8 ++++++++
 2 files changed, 16 insertions(+)

diff --git a/Jellyfin.Plugin.SmartPlaylist/Api/SmartCollectionController.cs b/Jellyfin.Plugin.SmartPlaylist/Api/SmartCollectionController.cs
index da0f62d..d327fd7 100644
--- a/Jellyfin.Plugin.SmartPlaylist/Api/SmartCollectionController.cs
+++ b/Jellyfin.Plugin.SmartPlaylist/Api/SmartCollectionController.cs
@@ -58,5 +58,13 @@ namespace Jellyfin.Plugin.SmartPlaylist.Api {
             await _store.SaveSmartCollectionAsync(smartCollection);
             return Created();
         }
+
+        [HttpDelete]
+        [Route("{smartCollectionId}")]
+        [ProducesResponseType(StatusCodes.Status204NoContent)]
+        public async Task<ActionResult> DeleteCollection([FromRoute, Required] SmartCollectionId smartCollectionId) {
+            _store.DeleteSmartCollectionById(smartCollectionId);
+            return NoContent();
+        }
     }
 }
diff --git a/Jellyfin.Plugin.SmartPlaylist/Api/SmartPlaylistController.cs b/Jellyfin.Plugin.SmartPlaylist/Api/SmartPlaylistController.cs
index 0e722cf..3167737 100644
--- a/Jellyfin.Plugin.SmartPlaylist/Api/SmartPlaylistController.cs
+++ b/Jellyfin.Plugin.SmartPlaylist/Api/SmartPlaylistController.cs
@@ -57,5 +57,13 @@ namespace Jellyfin.Plugin.SmartPlaylist.Api {
             await _store.SaveSmartPlaylistAsync(smartPlaylist);
             return Created();
         }
+
+        [HttpDelete]
+        [Route("{smartPlaylistId}")]
+        [ProducesResponseType(StatusCodes.Status204NoContent)]
+        public async Task<ActionResult> DeletePlaylist([FromRoute, Required] SmartPlaylistId smartPlaylistId) {
+            _store.DeleteSmartPlaylistById(smartPlaylistId);
+            return NoContent();
+        }
     }
 }