DeleteMemory deletes one memory document.
(c *gin.Context)
| 424 | |
| 425 | // DeleteMemory deletes one memory document. |
| 426 | func (h *BaseHandlers) DeleteMemory(c *gin.Context) { |
| 427 | location, err := h.resolveMemoryLocation(c.Request.Context(), c.Param("filename"), memorySelectorFromQuery(c)) |
| 428 | if err != nil { |
| 429 | h.respondMemoryError(c, StatusForMemoryError(err), err, nil) |
| 430 | return |
| 431 | } |
| 432 | |
| 433 | store, err := h.memoryStoreForLocation(c.Request.Context(), location) |
| 434 | if err != nil { |
| 435 | h.respondMemoryError(c, StatusForMemoryError(err), err, nil) |
| 436 | return |
| 437 | } |
| 438 | |
| 439 | result, err := store.ProposeDelete( |
| 440 | c.Request.Context(), |
| 441 | location.Scope, |
| 442 | c.Param("filename"), |
| 443 | h.memoryOrigin(), |
| 444 | ) |
| 445 | if err != nil { |
| 446 | h.respondMemoryError(c, StatusForMemoryError(err), err, nil) |
| 447 | return |
| 448 | } |
| 449 | |
| 450 | c.JSON(http.StatusOK, contract.MemoryDeleteResponse{ |
| 451 | Decision: MemoryDecisionPayload(result.Decision, nil), |
| 452 | Applied: result.Applied, |
| 453 | }) |
| 454 | } |
| 455 | |
| 456 | // ReindexMemory rebuilds the derived memory catalog from Markdown memory files. |
| 457 | func (h *BaseHandlers) ReindexMemory(c *gin.Context) { |
nothing calls this directly
no test coverage detected