33 lines
		
	
	
		
			1.9 KiB
		
	
	
	
		
			Go
		
	
	
	
			
		
		
	
	
			33 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
 | 
						|
	ReferenceID      string             `bson:"reference_id"`            // 對應的專案 ID
 | 
						|
	Name             string             `bson:"name"`                    // 名稱
 | 
						|
	Description      string             `bson:"description"`             // 描述
 | 
						|
	ShortDescription string             `bson:"short_description"`       // 封面簡短描述
 | 
						|
	IsUnLimit        bool               `bson:"is_un_limit"`             // 是否沒有數量上限
 | 
						|
	IsFree           bool               `bson:"is_free"`                 // 是否為免費品項(贈品) -> 開啟就是自訂金額
 | 
						|
	Stock            uint64             `bson:"stock"`                   // 庫存總數
 | 
						|
	Price            decimal.Decimal    `bson:"price"`                   // 價格
 | 
						|
	SKU              string             `bson:"sku"`                     // 型號:對應顯示 Item 的 FK
 | 
						|
	TimeSeries       product.TimeSeries `bson:"time_series"`             // 時段種類
 | 
						|
	Media            []Media            `bson:"media,omitempty"`         // 專案動態內容(圖片或者影片)
 | 
						|
	Status           product.ItemStatus `bson:"status"`                  // 商品狀態
 | 
						|
	Freight          []CustomFields     `bson:"freight,omitempty"`       // 運費
 | 
						|
	CustomFields     []CustomFields     `bson:"custom_fields,omitempty"` // 自定義屬性
 | 
						|
	SalesCount       uint64             `bson:"sales_count" `            // 已賣出數量(相反,減到零就不能在賣)
 | 
						|
	UpdatedAt        int64              `bson:"updated_at"`              // 更新時間
 | 
						|
	CreatedAt        int64              `bson:"created_at"`              // 創建時間
 | 
						|
}
 | 
						|
 | 
						|
func (p *ProductItems) CollectionName() string {
 | 
						|
	return "product_items"
 | 
						|
}
 |