From 073b96b29dc95cfa8962bdbf408628b3bf85c7ea Mon Sep 17 00:00:00 2001 From: jake <77554505+brxken128@users.noreply.github.com> Date: Tue, 16 Jan 2024 17:58:30 +0000 Subject: [PATCH] [ENG-1546] Delete `tag_on_object` entries before the tag itself (so tags can be deleted) (#1944) fix: delete `tag_on_object` entries before the tag itself --- core/src/api/tags.rs | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/core/src/api/tags.rs b/core/src/api/tags.rs index 2530562a1..3406dafba 100644 --- a/core/src/api/tags.rs +++ b/core/src/api/tags.rs @@ -358,6 +358,13 @@ pub(crate) fn mount() -> AlphaRouter { "delete", R.with2(library()) .mutation(|(_, library), tag_id: i32| async move { + library + .db + .tag_on_object() + .delete_many(vec![tag_on_object::tag_id::equals(tag_id)]) + .exec() + .await?; + library .db .tag()