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)
| 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. |
| 342 | func (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. |
nothing calls this directly
no test coverage detected