fix: delete memo resource

This commit is contained in:
steven 2022-10-01 00:06:56 +08:00
parent 4c465bef2d
commit 33d31b7dca
2 changed files with 5 additions and 2 deletions

View File

@ -303,7 +303,6 @@ func (s *Server) registerMemoRoutes(g *echo.Group) {
} }
currentTs := time.Now().Unix() currentTs := time.Now().Unix()
memoResourceUpsert := &api.MemoResourceUpsert{ memoResourceUpsert := &api.MemoResourceUpsert{
MemoID: memoID, MemoID: memoID,
UpdatedTs: &currentTs, UpdatedTs: &currentTs,
@ -312,6 +311,10 @@ func (s *Server) registerMemoRoutes(g *echo.Group) {
return echo.NewHTTPError(http.StatusBadRequest, "Malformatted post memo resource request").SetInternal(err) 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{ resourceFind := &api.ResourceFind{
ID: &memoResourceUpsert.ResourceID, ID: &memoResourceUpsert.ResourceID,
} }

View File

@ -174,7 +174,7 @@ func deleteMemoResource(ctx context.Context, tx *sql.Tx, delete *api.MemoResourc
} }
result, err := tx.ExecContext(ctx, ` 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 { if err != nil {
return FormatError(err) return FormatError(err)
} }