sainw 6 years ago
parent
commit
65f3f3f44a
2 changed files with 40 additions and 0 deletions
  1. 1 0
      go.mod
  2. 39 0
      vo.go

+ 1 - 0
go.mod

@@ -0,0 +1 @@
+module git.autoleum.com/sainw/syncer

+ 39 - 0
vo.go

@@ -0,0 +1,39 @@
+package syncer
+
+import "time"
+
+const (
+	SYNC_ACTION_INSERT = "Insert"
+	SYNC_ACTION_UPDATE = "Update"
+	SYNC_ACTION_DELETE = "Delete"
+
+	// ClientPriceUpdate
+	TYPE_CLIENT_PRICE_UPDATE = "ClientPriceUpdate"
+)
+
+type Model struct {
+	ID        uint64    `json:"id" gorm:"primary_key"`
+	Type      string    `json:"type" gorm:"not null"`
+	CreatedAt time.Time `json:"create_at"`
+	UpdatedAt time.Time `json:"update_at"`
+}
+
+type SyncLog struct {
+	Model
+	DataType string `json:"data_type"`                     // data type
+	Data     string `json:"data" sql:"type:varchar(5000)"` // data in json string
+	Action   string `json:"action"`                        // [Insert,Update,Delete]
+	Synced   bool   `json:"synced"`
+}
+
+// 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"`
+}