customer/internal/models/history.go

59 lines
1.8 KiB
Go
Raw Normal View History

2023-05-23 10:52:27 +00:00
package models
import "time"
type History struct {
2023-06-15 12:31:34 +00:00
ID string `json:"id" bson:"_id,omitempty"`
UserID string `json:"userId" bson:"userId"`
Comment string `json:"comment" bson:"comment"`
Key string `json:"key" bson:"key"`
RawDetails RawDetails `json:"rawDetails" bson:"rawDetails"`
2023-06-15 12:45:38 +00:00
Deleted bool `json:"isDeleted" bson:"isDeleted"`
2023-06-15 12:31:34 +00:00
CreatedAt time.Time `json:"createdAt" bson:"createdAt"`
UpdatedAt time.Time `json:"updatedAt" bson:"updatedAt"`
DeletedAt *time.Time `json:"deletedAt,omitempty" bson:"deletedAt,omitempty"`
Version uint32 `json:"version" bson:"version"`
2023-05-23 10:52:27 +00:00
}
2023-11-23 18:55:22 +00:00
type TariffID struct {
ID string `json:"id" bson:"_id"`
}
2023-11-25 18:28:26 +00:00
type ReportHistory struct {
ID string `json:"id" bson:"_id,omitempty"`
UserID string `json:"userId" bson:"userId"`
Comment string `json:"comment" bson:"comment"`
Key string `json:"key" bson:"key"`
RawDetails RawDetails `json:"rawDetails" bson:"rawDetails"`
Deleted bool `json:"isDeleted" bson:"isDeleted"`
CreatedAt time.Time `json:"createdAt" bson:"createdAt"`
UpdatedAt time.Time `json:"updatedAt" bson:"updatedAt"`
DeletedAt *time.Time `json:"deletedAt,omitempty" bson:"deletedAt,omitempty"`
}
type RawDetails struct {
Tariffs []Tariff `json:"tariffs" bson:"tariffs"`
Price int64 `json:"price" bson:"price"`
Comment string `json:"comment" bson:"comment"`
2023-11-25 18:28:26 +00:00
}
2023-06-15 12:45:38 +00:00
func (receiver *History) Sanitize() *History {
now := time.Now()
receiver.ID = ""
receiver.CreatedAt = now
receiver.UpdatedAt = now
receiver.DeletedAt = nil
receiver.Deleted = false
receiver.Version = mongoVersion
2023-06-15 12:45:38 +00:00
return receiver
}
2023-06-15 12:31:34 +00:00
type CustomerHistoryKey string
2023-05-23 10:52:27 +00:00
const (
2023-09-14 19:56:36 +00:00
CustomerHistoryKeyReplenish = "replenishWallet"
CustomerHistoryKeyPayCart = "payCart"
2023-05-23 10:52:27 +00:00
)