feat: create specific price system and adapt product queries
This commit is contained in:
30
app/model/specificPrice.go
Normal file
30
app/model/specificPrice.go
Normal file
@@ -0,0 +1,30 @@
|
||||
package model
|
||||
|
||||
import "time"
|
||||
|
||||
type SpecificPrice struct {
|
||||
ID uint64 `gorm:"primaryKey;autoIncrement" json:"id"`
|
||||
Name string `gorm:"type:varchar(255);not null" json:"name"`
|
||||
Scope string `gorm:"type:varchar(20);not null" json:"scope"`
|
||||
ValidFrom *time.Time `gorm:"null" json:"valid_from"`
|
||||
ValidTill *time.Time `gorm:"null" json:"valid_till"`
|
||||
HasExpirationDate bool `gorm:"default:false" json:"has_expiration_date"`
|
||||
ReductionType string `gorm:"type:enum('amount','percentage');not null" json:"reduction_type"`
|
||||
Price *float64 `gorm:"type:decimal(10,2);null" json:"price"`
|
||||
CurrencyID *uint64 `gorm:"column:b2b_id_currency;null" json:"currency_id"`
|
||||
PercentageReduction *float64 `gorm:"type:decimal(5,2);null" json:"percentage_reduction"`
|
||||
FromQuantity uint32 `gorm:"default:1" json:"from_quantity"`
|
||||
IsActive bool `gorm:"default:true" json:"is_active"`
|
||||
CreatedAt *time.Time `gorm:"null" json:"created_at"`
|
||||
UpdatedAt *time.Time `gorm:"null" json:"updated_at"`
|
||||
|
||||
ProductIDs []uint64 `gorm:"-" json:"product_ids"`
|
||||
CategoryIDs []uint64 `gorm:"-" json:"category_ids"`
|
||||
ProductAttributeIDs []uint64 `gorm:"-" json:"product_attribute_ids"`
|
||||
CountryIDs []uint64 `gorm:"-" json:"country_ids"`
|
||||
CustomerIDs []uint64 `gorm:"-" json:"customer_ids"`
|
||||
}
|
||||
|
||||
func (SpecificPrice) TableName() string {
|
||||
return "b2b_specific_price"
|
||||
}
|
||||
Reference in New Issue
Block a user