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

Method StartReconciliation

api/reconciliation_api.go:69–95  ·  view source on GitHub ↗

StartReconciliation initiates a new reconciliation process based on the provided parameters. It starts the reconciliation process and returns the reconciliation ID. Parameters: - c: The Gin context containing the request and response. Responses: - 400 Bad Request: If the request body is invalid or

(c *gin.Context)

Source from the content-addressed store, hash-verified

67// - 500 Internal Server Error: If there is an error starting the reconciliation process.
68// - 200 OK: If the reconciliation process is successfully started.
69func (a Api) StartReconciliation(c *gin.Context) {
70 var req struct {
71 UploadID string `json:"upload_id" binding:"required"`
72 Strategy string `json:"strategy" binding:"required"`
73 GroupingCriteria string `json:"grouping_criteria"`
74 DryRun bool `json:"dry_run"`
75 MatchingRuleIDs []string `json:"matching_rule_ids" binding:"required"`
76 }
77
78 if err := c.ShouldBindJSON(&req); err != nil {
79 c.JSON(http.StatusBadRequest, gin.H{"error": err.Error()})
80 return
81 }
82 if len(req.MatchingRuleIDs) == 0 {
83 c.JSON(http.StatusBadRequest, gin.H{"error": "matching_rule_ids is required"})
84 return
85 }
86
87 reconciliationID, err := a.ledgerforge.StartReconciliation(c.Request.Context(), req.UploadID, req.Strategy, req.GroupingCriteria, req.MatchingRuleIDs, req.DryRun)
88 if err != nil {
89 logrus.Error(err)
90 c.JSON(http.StatusInternalServerError, gin.H{"error": "Failed to start reconciliation"})
91 return
92 }
93
94 c.JSON(http.StatusOK, gin.H{"reconciliation_id": reconciliationID})
95}
96
97// InstantReconciliation initiates a reconciliation process with externally provided transactions
98// without requiring a prior file upload. It processes the transactions directly and returns

Callers

nothing calls this directly

Calls 1

ErrorMethod · 0.45

Tested by

no test coverage detected