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

Method DeleteMatchingRule

api/reconciliation_api.go:252–267  ·  view source on GitHub ↗

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)

Source from the content-addressed store, hash-verified

250// - 500 Internal Server Error: If there is an error deleting the matching rule.
251// - 200 OK: If the matching rule is successfully deleted.
252func (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}

Callers

nothing calls this directly

Calls 2

DeleteMatchingRuleMethod · 0.65
ErrorMethod · 0.45

Tested by

no test coverage detected