31 lines
		
	
	
		
			1.9 KiB
		
	
	
	
		
			Go
		
	
	
	
		
		
			
		
	
	
			31 lines
		
	
	
		
			1.9 KiB
		
	
	
	
		
			Go
		
	
	
	
|  | package entity | |||
|  | 
 | |||
|  | import ( | |||
|  | 	"code.30cm.net/digimon/app-cloudep-product-service/pkg/domain/product" | |||
|  | 	"github.com/shopspring/decimal" | |||
|  | 	"go.mongodb.org/mongo-driver/bson/primitive" | |||
|  | ) | |||
|  | 
 | |||
|  | type ProductItems struct { | |||
|  | 	ID                      primitive.ObjectID `bson:"_id,omitempty"`                // 專案 ID
 | |||
|  | 	ProductID               string             `bson:"product_id"`                   // 對應的專案 ID
 | |||
|  | 	Name                    string             `bson:"name" json:"name"`             // 名稱
 | |||
|  | 	Cover                   string             `bson:"cover"`                        // 封面
 | |||
|  | 	Description             string             `bson:"description"`                  // 描述
 | |||
|  | 	ShortDescription        string             `bson:"short_description"`            // 封面簡短描述
 | |||
|  | 	Price                   decimal.Decimal    `bson:"price"`                        // 價格
 | |||
|  | 	SKU                     string             `bson:"sku"`                          // 型號:對應顯示 Item 的 FK
 | |||
|  | 	TimeSeries              product.TimeSeries `bson:"time_series"`                  // 時段種類
 | |||
|  | 	Media                   []Media            `bson:"medias,omitempty"`             // 專案動態內容(圖片或者影片)
 | |||
|  | 	AverageRating           float64            `bson:"average_rating"`               // 綜合評價(如:4.5 顆星)
 | |||
|  | 	AverageRatingUpdateTime int64              `bson:"average_rating_time"`          // 更新評價的時間
 | |||
|  | 	Orders                  uint64             `bson:"total_orders"`                 // 總接單數
 | |||
|  | 	OrdersUpdateTime        int64              `bson:"total_orders_update_time"`     // 更新總接單數的時間
 | |||
|  | 	UpdatedAt               int64              `bson:"updated_at" json:"updated_at"` // 更新時間
 | |||
|  | 	CreatedAt               int64              `bson:"created_at" json:"created_at"` // 創建時間
 | |||
|  | } | |||
|  | 
 | |||
|  | func (p *ProductItems) CollectionName() string { | |||
|  | 	return "product" | |||
|  | } |