All checks were successful
dev test / test (push) Successful in 17s
dev test / vulnCheck (push) Successful in 30s
dev test / Ci-Lint (push) Successful in 19s
${{ github.actor }} executed Build Push Prod / build (push) Successful in 4m24s
${{ github.actor }} executed Build Push Prod / deploy (push) Successful in 18s
67 lines
1.3 KiB
Go
67 lines
1.3 KiB
Go
package domain
|
|
|
|
import "time"
|
|
|
|
type Institution struct {
|
|
ID int64 `json:"id"`
|
|
Name string `json:"name"`
|
|
ShortName string `json:"short_name"`
|
|
Created int64 `json:"created"`
|
|
}
|
|
|
|
type History struct {
|
|
ID int64 `json:"id"`
|
|
Institution Institution `json:"institution"`
|
|
Compra float64 `json:"compra"`
|
|
Venta float64 `json:"venta"`
|
|
Parser string `json:"parser"`
|
|
Parsed int64 `json:"parsed"`
|
|
}
|
|
|
|
type Change struct {
|
|
Before History `json:"before"`
|
|
After History `json:"after"`
|
|
}
|
|
type Message struct {
|
|
Message string `json:"message"`
|
|
Data *Change `json:"data"`
|
|
Error error `json:"error"`
|
|
}
|
|
|
|
func NewHistory(name, parser, shortname string, compra, venta float64) History {
|
|
return History{
|
|
Institution: Institution{
|
|
Name: name,
|
|
ShortName: shortname,
|
|
Created: time.Now().Unix(),
|
|
},
|
|
Parser: parser,
|
|
Compra: compra,
|
|
Venta: venta,
|
|
Parsed: time.Now().Unix(),
|
|
}
|
|
}
|
|
|
|
func NewInstitution(name, shortname string) Institution {
|
|
return Institution{
|
|
Name: name,
|
|
ShortName: shortname,
|
|
Created: time.Now().Unix(),
|
|
}
|
|
}
|
|
|
|
func NewChange(before, after History) *Change {
|
|
return &Change{
|
|
Before: before,
|
|
After: after,
|
|
}
|
|
}
|
|
|
|
func NewMessage(message string, data *Change, err error) *Message {
|
|
return &Message{
|
|
Message: message,
|
|
Data: data,
|
|
Error: err,
|
|
}
|
|
}
|