From 33d31b7dca76ef31f8e3f84333c27d9aa920b9c5 Mon Sep 17 00:00:00 2001 From: steven Date: Sat, 1 Oct 2022 00:06:56 +0800 Subject: [PATCH] fix: delete memo resource --- server/memo.go | 5 ++++- store/memo_resource.go | 2 +- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/server/memo.go b/server/memo.go index 51a6b97f..2bc502ab 100644 --- a/server/memo.go +++ b/server/memo.go @@ -303,7 +303,6 @@ func (s *Server) registerMemoRoutes(g *echo.Group) { } currentTs := time.Now().Unix() - memoResourceUpsert := &api.MemoResourceUpsert{ MemoID: memoID, UpdatedTs: ¤tTs, @@ -312,6 +311,10 @@ func (s *Server) registerMemoRoutes(g *echo.Group) { return echo.NewHTTPError(http.StatusBadRequest, "Malformatted post memo resource request").SetInternal(err) } + if _, err := s.Store.UpsertMemoResource(ctx, memoResourceUpsert); err != nil { + return echo.NewHTTPError(http.StatusInternalServerError, "Failed to upsert memo resource").SetInternal(err) + } + resourceFind := &api.ResourceFind{ ID: &memoResourceUpsert.ResourceID, } diff --git a/store/memo_resource.go b/store/memo_resource.go index fa648818..0ad13a49 100644 --- a/store/memo_resource.go +++ b/store/memo_resource.go @@ -174,7 +174,7 @@ func deleteMemoResource(ctx context.Context, tx *sql.Tx, delete *api.MemoResourc } result, err := tx.ExecContext(ctx, ` - DELETE FROM memo WHERE `+strings.Join(where, " AND "), args...) + DELETE FROM memo_resource WHERE `+strings.Join(where, " AND "), args...) if err != nil { return FormatError(err) }