From 3aa44f9f6dbd61355f2a753b1edc348dc01b4851 Mon Sep 17 00:00:00 2001 From: Zeng1998 <1129142694@qq.com> Date: Sat, 5 Nov 2022 20:21:13 +0800 Subject: [PATCH] fix: delete related resources (#415) * chore: add icon * fix: delete all related resources when a memo is deleted * update Co-authored-by: boojack --- store/memo.go | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/store/memo.go b/store/memo.go index b4eec02d..a6c93161 100644 --- a/store/memo.go +++ b/store/memo.go @@ -222,6 +222,14 @@ func (s *Store) DeleteMemo(ctx context.Context, delete *api.MemoDelete) error { return FormatError(err) } + resourceDelete := &api.MemoResourceDelete{ + MemoID: delete.ID, + } + + if err := deleteMemoResource(ctx, tx, resourceDelete); err != nil { + return FormatError(err) + } + if err := tx.Commit(); err != nil { return FormatError(err) }