MCPcopy Create free account
hub / github.com/devaccuracy/ledgerforge / DeleteBalanceMonitor

Method DeleteBalanceMonitor

api/balance.go:342–356  ·  view source on GitHub ↗

DeleteBalanceMonitor deletes an existing balance monitor record by its ID. It extracts the ID from the route parameters and deletes the record. If the ID is missing or there's an error deleting the monitor, it responds with an appropriate error message. Parameters: - c: The Gin context containing t

(c *gin.Context)

Source from the content-addressed store, hash-verified

340// - 400 Bad Request: If the ID is missing or there's an error deleting the balance monitor.
341// - 200 OK: If the balance monitor is successfully deleted.
342func (a Api) DeleteBalanceMonitor(c *gin.Context) {
343 id, passed := c.Params.Get("id")
344 if !passed {
345 c.JSON(http.StatusBadRequest, gin.H{"error": "id is required. pass id in the route /:id"})
346 return
347 }
348
349 err := a.ledgerforge.DeleteMonitor(c.Request.Context(), id)
350 if err != nil {
351 c.JSON(http.StatusBadRequest, gin.H{"error": err.Error()})
352 return
353 }
354
355 c.JSON(http.StatusOK, gin.H{"message": "BalanceMonitor deleted successfully"})
356}
357
358// TakeBalanceSnapshots creates daily snapshots of balances in batches.
359// It accepts an optional 'batch_size' query parameter to control the batch processing size.

Callers

nothing calls this directly

Calls 3

GetMethod · 0.65
DeleteMonitorMethod · 0.65
ErrorMethod · 0.45

Tested by

no test coverage detected