diff --git a/server.go b/server.go index 0a56614..726c63f 100644 --- a/server.go +++ b/server.go @@ -75,7 +75,7 @@ func RegisterRouter(router *gin.Engine) { authorized.GET("/stats/account/trend", service.StatsAccountTrend) authorized.GET("/stats/account/balance", service.StatsAccountBalance) authorized.GET("/stats/month/total", service.StatsMonthTotal) - authorized.GET("/stats/prices", service.StatsPrices) + authorized.GET("/stats/commodity/price", service.StatsCommodityPrice) authorized.GET("/transaction", service.QueryTransactions) authorized.POST("/transaction", service.AddTransactions) authorized.POST("/transaction/batch", service.AddBatchTransactions) diff --git a/service/stats.go b/service/stats.go index 6ad23e1..cbe3aab 100644 --- a/service/stats.go +++ b/service/stats.go @@ -408,13 +408,13 @@ func StatsPayee(c *gin.Context) { } type StatsPricesResult struct { - Date string `json:"date"` - Price string `json:"price"` - Currency string `json:"operatingCurrency"` - Value string `json:"value"` + Date string `json:"date"` + Commodity string `json:"commodity"` + Currency string `json:"operatingCurrency"` + Value string `json:"value"` } -func StatsPrices(c *gin.Context) { +func StatsCommodityPrice(c *gin.Context) { ledgerConfig := script.GetLedgerConfigFromContext(c) output := script.BeanReportAllPrices(ledgerConfig) script.LogInfo(ledgerConfig.Mail, output) @@ -429,10 +429,10 @@ func StatsPrices(c *gin.Context) { // split line by " " words := strings.Fields(line) statsPricesResultList = append(statsPricesResultList, StatsPricesResult{ - Date: words[0], - Price: words[2], - Value: words[3], - Currency: words[4], + Date: words[0], + Commodity: words[2], + Value: words[3], + Currency: words[4], }) } OK(c, statsPricesResultList)