maximo tejeda e986d8884a
Some checks failed
dev test / test (push) Failing after 52s
dev test / vulnCheck (push) Has been skipped
dev test / Ci-Lint (push) Has been skipped
fix imports
2024-12-02 20:11:31 -04:00

33 lines
765 B
Go

package dolar
import (
"context"
dl "git.maximotejeda.com/maximo/dolar/proto/golang/dolar"
"git.maximotejeda.com/maximo/us_dop_scrapper/internal/application/core/domain"
"google.golang.org/grpc"
)
type Adapter struct {
dolar dl.DollarClient
conn *grpc.ClientConn
}
func NewAdapter(conn *grpc.ClientConn) (*Adapter, error) {
client := dl.NewDollarClient(conn)
return &Adapter{dolar: client, conn: conn}, nil
}
func (a *Adapter) NewHistory(history *domain.History) error {
_, err := a.dolar.NewHistory(context.Background(),
&dl.AddDolarRequest{
Institution: &dl.History{
Name: history.Name,
Compra: float32(history.Compra),
Venta: float32(history.Venta),
Parser: history.Parser,
Parsed: history.Parsed,
}})
return err
}