Explorar o código

fix record time field

sainw %!s(int64=6) %!d(string=hai) anos
pai
achega
28c6462663
Modificáronse 1 ficheiros con 12 adicións e 19 borrados
  1. 12 19
      vo.go

+ 12 - 19
vo.go

@@ -39,27 +39,20 @@ type SyncLog struct {
 // Client data
 type ClientPriceUpdate struct {
 	Model
-	CompanyId     uint64    `json:"company_id"` // only used by FOS
-	StationId     uint64    `json:"station_id"` // only used by FOS
-	PriceUpdateId uint64    `json:"price_update_id"`
-	GradeId       uint64    `json:"grade_id"`
-	GradeText     string    `json:"grade_text"`
-	GradePrice    uint64    `json:"grade_price"`
-	NewGradePrice uint64    `json:"new_grade_price"`
-	RecCreatedAt  time.Time `json:"rec_create_at"`
-	RecUpdatedAt  time.Time `json:"rec_update_at"`
+	CompanyId     uint64 `json:"company_id"` // only used by FOS
+	StationId     uint64 `json:"station_id"` // only used by FOS
+	PriceUpdateId uint64 `json:"price_update_id"`
+	GradeId       uint64 `json:"grade_id"`
+	GradeText     string `json:"grade_text"`
+	GradePrice    uint64 `json:"grade_price"`
+	NewGradePrice uint64 `json:"new_grade_price"`
+	RecCreatedAt  string `json:"rec_create_at"`
+	RecUpdatedAt  string `json:"rec_update_at"`
 }
 
 // Custom unmarshal for date time of the record
 func (s *ClientPriceUpdate) UnmarshalJSON(data []byte) error {
-	type Alias ClientPriceUpdate
-	aux := &struct {
-		RecCreatedAt string `json:"rec_create_at"`
-		RecUpdatedAt string `json:"rec_update_at"`
-		*Alias
-	}{
-		Alias: (*Alias)(s),
-	}
+	var aux ClientPriceUpdate
 	if err := json.Unmarshal(data, &aux); err != nil {
 		return err
 	}
@@ -72,7 +65,7 @@ func (s *ClientPriceUpdate) UnmarshalJSON(data []byte) error {
 		return e
 	}
 
-	s.RecCreatedAt = createdAt
-	s.RecUpdatedAt = updatedAt
+	s.CreatedAt = createdAt
+	s.UpdatedAt = updatedAt
 	return nil
 }