GetBalanceMonitorsByBalanceID retrieves all balance monitors associated with a specific balance ID. It extracts the balance ID from the route parameters. If the balance ID is missing or there's an error retrieving the monitors, it responds with an appropriate error message. Parameters: - c: The Gin
(c *gin.Context)
| 280 | // - 400 Bad Request: If the balance ID is missing or there's an error retrieving the balance monitors. |
| 281 | // - 200 OK: If the balance monitors are successfully retrieved. |
| 282 | func (a Api) GetBalanceMonitorsByBalanceID(c *gin.Context) { |
| 283 | balanceID, passed := c.Params.Get("balance_id") |
| 284 | if !passed { |
| 285 | c.JSON(http.StatusBadRequest, gin.H{"error": "balance_id is required. pass balance_id in the route /:balance_id"}) |
| 286 | return |
| 287 | } |
| 288 | |
| 289 | monitors, err := a.ledgerforge.GetMonitorByID(c.Request.Context(), balanceID) |
| 290 | if err != nil { |
| 291 | c.JSON(http.StatusBadRequest, gin.H{"error": err.Error()}) |
| 292 | return |
| 293 | } |
| 294 | |
| 295 | c.JSON(http.StatusOK, monitors) |
| 296 | } |
| 297 | |
| 298 | // UpdateBalanceMonitor updates an existing balance monitor record by its ID. |
| 299 | // It binds the incoming JSON request to a BalanceMonitor object, updates the record, |
nothing calls this directly
no test coverage detected