GetAccount retrieves an account by its ID. It uses the provided account ID and optional query parameters to fetch the account. Parameters: - c: The Gin context containing the request and response. - id: The unique identifier of the account to retrieve. - includes: Optional query parameters to inclu
(c *gin.Context)
| 69 | // - 400 Bad Request: If there's an error in fetching the account. |
| 70 | // - 200 OK: If the account is successfully retrieved. |
| 71 | func (a Api) GetAccount(c *gin.Context) { |
| 72 | id := c.Param("id") |
| 73 | |
| 74 | includes := c.QueryArray("include") |
| 75 | |
| 76 | account, err := a.ledgerforge.GetAccount(id, includes) |
| 77 | if err != nil { |
| 78 | c.JSON(http.StatusBadRequest, gin.H{"error": err.Error()}) |
| 79 | return |
| 80 | } |
| 81 | c.JSON(http.StatusOK, account) |
| 82 | } |
| 83 | |
| 84 | // GetAllAccounts retrieves all accounts. |
| 85 | // It fetches a list of all accounts in the system. |