update
This commit is contained in:
parent
b921536ce8
commit
5f30f98d48
@ -15,9 +15,10 @@ import (
|
|||||||
|
|
||||||
type Card struct {
|
type Card struct {
|
||||||
// Added by Serra
|
// Added by Serra
|
||||||
SerraCount int64 `bson:"serra_count"`
|
SerraCount int64 `bson:"serra_count"`
|
||||||
SerraPrices []PriceEntry `bson:"serra_prices"`
|
SerraPrices []PriceEntry `bson:"serra_prices"`
|
||||||
SerraUpdated string `bson:"serra_updated"`
|
SerraCreated primitive.DateTime `bson:"serra_created"`
|
||||||
|
SerraUpdated primitive.DateTime `bson:"serra_updated"`
|
||||||
|
|
||||||
Artist string `json:"artist"`
|
Artist string `json:"artist"`
|
||||||
ArtistIds []string `json:"artist_ids"`
|
ArtistIds []string `json:"artist_ids"`
|
||||||
@ -151,6 +152,9 @@ func fetch_card(path string) (*Card, error) {
|
|||||||
// Increase counter
|
// Increase counter
|
||||||
val.SerraCount = val.SerraCount + 1
|
val.SerraCount = val.SerraCount + 1
|
||||||
|
|
||||||
|
// Set created Time
|
||||||
|
card.SerraCreated = primitive.NewDateTimeFromTime(time.Now())
|
||||||
|
|
||||||
// Increase Price
|
// Increase Price
|
||||||
val.SerraPrices = append(val.SerraPrices, PriceEntry{primitive.NewDateTimeFromTime(time.Now()), val.Prices.Eur})
|
val.SerraPrices = append(val.SerraPrices, PriceEntry{primitive.NewDateTimeFromTime(time.Now()), val.Prices.Eur})
|
||||||
|
|
||||||
|
|||||||
@ -29,6 +29,8 @@ func storage_connect() *mongo.Client {
|
|||||||
|
|
||||||
func storage_add(coll *mongo.Collection, card *Card) error {
|
func storage_add(coll *mongo.Collection, card *Card) error {
|
||||||
|
|
||||||
|
card.SerraUpdated = primitive.NewDateTimeFromTime(time.Now())
|
||||||
|
|
||||||
_, err := coll.InsertOne(context.TODO(), card)
|
_, err := coll.InsertOne(context.TODO(), card)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user