mirror of
https://github.com/usememos/memos.git
synced 2024-12-21 02:01:55 +03:00
fix: delete memo resource
This commit is contained in:
parent
4c465bef2d
commit
33d31b7dca
@ -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: ¤tTs,
|
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)
|
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,
|
||||||
}
|
}
|
||||||
|
@ -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)
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user