code refactor

This commit is contained in:
MaysWind
2024-11-17 13:04:07 +08:00
parent 69498003d8
commit 8f944b1b46
15 changed files with 159 additions and 43 deletions
@@ -3,6 +3,7 @@ package exchangerates
import (
"encoding/json"
"math"
"net/http"
"time"
"github.com/mayswind/ezbookkeeping/pkg/core"
@@ -111,9 +112,15 @@ func (e *NationalBankOfGeorgiaExchangeRate) ToLatestExchangeRate(c core.Context)
}
}
// GetRequestUrls returns the national bank of Georgia data source urls
func (e *NationalBankOfGeorgiaDataSource) GetRequestUrls() []string {
return []string{nationalBankOfGeorgiaExchangeRateUrl}
// BuildRequests returns the national bank of Georgia exchange rates http requests
func (e *NationalBankOfGeorgiaDataSource) BuildRequests() ([]*http.Request, error) {
req, err := http.NewRequest("GET", nationalBankOfGeorgiaExchangeRateUrl, nil)
if err != nil {
return nil, err
}
return []*http.Request{req}, nil
}
// Parse returns the common response entity according to the national bank of Georgia data source raw response