better trade endpoints
This commit is contained in:
@@ -26,7 +26,7 @@ func AddTradeHandler(db *sql.DB) http.HandlerFunc {
|
||||
}
|
||||
|
||||
// check if currency is in the db.
|
||||
currency, err := database.GetCurrencyByCode(db, req.Currency)
|
||||
currency, err := database.GetCurrencyByCode(db, req.CurrencyCode)
|
||||
if err != nil {
|
||||
http.Error(w, fmt.Sprintf("failed to find currency: %s", err), http.StatusInternalServerError)
|
||||
return
|
||||
@@ -57,7 +57,7 @@ func GetTradeListHandler(db *sql.DB) http.HandlerFunc {
|
||||
return func(w http.ResponseWriter, r *http.Request) {
|
||||
tradeList, err := database.GetTrades(db)
|
||||
if err != nil {
|
||||
http.Error(w, fmt.Sprintf("failed to fetch trades:", err), http.StatusInternalServerError)
|
||||
http.Error(w, fmt.Sprintf("failed to fetch trades: %s", err), http.StatusInternalServerError)
|
||||
return
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user