DeleteMatchingRule deletes a matching rule identified by its ID. It confirms the deletion with a success message. Parameters: - c: The Gin context containing the request and response. Responses: - 400 Bad Request: If the Matching Rule ID is missing. - 500 Internal Server Error: If there is an erro
(c *gin.Context)
| 250 | // - 500 Internal Server Error: If there is an error deleting the matching rule. |
| 251 | // - 200 OK: If the matching rule is successfully deleted. |
| 252 | func (a Api) DeleteMatchingRule(c *gin.Context) { |
| 253 | ruleID := c.Param("id") |
| 254 | if ruleID == "" { |
| 255 | c.JSON(http.StatusBadRequest, gin.H{"error": "Matching Rule ID is required"}) |
| 256 | return |
| 257 | } |
| 258 | |
| 259 | err := a.ledgerforge.DeleteMatchingRule(c.Request.Context(), ruleID) |
| 260 | if err != nil { |
| 261 | logrus.Error(err) |
| 262 | c.JSON(http.StatusInternalServerError, gin.H{"error": "Failed to delete matching rule"}) |
| 263 | return |
| 264 | } |
| 265 | |
| 266 | c.JSON(http.StatusOK, gin.H{"message": "Matching rule deleted successfully"}) |
| 267 | } |
nothing calls this directly
no test coverage detected