FilterTransactions filters transactions using a JSON request body. This endpoint accepts a POST request with filters specified in JSON format, providing more flexibility than query parameter filters. Request body format: { "filters": [ {"field": "status", "operator": "eq", "value": "APPLI
(c *gin.Context)
| 353 | // - 400 Bad Request: If there's an error parsing the filters or retrieving transactions. |
| 354 | // - 200 OK: If the transactions are successfully retrieved. |
| 355 | func (a Api) FilterTransactions(c *gin.Context) { |
| 356 | filters, opts, limit, offset, err := ParseFiltersFromBody(c, "transactions") |
| 357 | if err != nil { |
| 358 | c.JSON(http.StatusBadRequest, gin.H{"error": err.Error()}) |
| 359 | return |
| 360 | } |
| 361 | |
| 362 | transactions, count, err := a.ledgerforge.GetAllTransactionsWithFilterAndOptions(c.Request.Context(), filters, opts, limit, offset) |
| 363 | if err != nil { |
| 364 | c.JSON(http.StatusBadRequest, gin.H{"error": err.Error()}) |
| 365 | return |
| 366 | } |
| 367 | |
| 368 | // Transform each transaction for response |
| 369 | result := make([]*model.Transaction, len(transactions)) |
| 370 | for i := range transactions { |
| 371 | result[i] = transformTransaction(&transactions[i]) |
| 372 | } |
| 373 | |
| 374 | if opts.IncludeCount { |
| 375 | c.JSON(http.StatusOK, FilterResponse{Data: result, TotalCount: count}) |
| 376 | } else { |
| 377 | c.JSON(http.StatusOK, result) |
| 378 | } |
| 379 | } |
| 380 | |
| 381 | // UpdateInflightStatus updates the status of an inflight transaction based on the provided ID and status. |
| 382 | // It processes the transaction in batches according to the specified status (commit or void). |
nothing calls this directly
no test coverage detected