mirror of
https://gitlab.com/mbugroup/lti-api.git
synced 2026-05-20 21:41:55 +00:00
33 lines
1.6 KiB
Go
33 lines
1.6 KiB
Go
package entities
|
|
|
|
import (
|
|
"time"
|
|
|
|
"gorm.io/gorm"
|
|
)
|
|
|
|
type Product struct {
|
|
Id uint `gorm:"primaryKey"`
|
|
Name string `gorm:"type:varchar(50);not null;uniqueIndex:products_name_unique,where:deleted_at IS NULL"`
|
|
Brand string `gorm:"type:varchar(50);not null"`
|
|
Sku *string `gorm:"size:100;uniqueIndex:products_sku_unique,where:deleted_at IS NULL"`
|
|
UomId uint `gorm:"not null"`
|
|
ProductCategoryId uint `gorm:"not null"`
|
|
ProductPrice float64 `gorm:"type:numeric(15,3);not null"`
|
|
SellingPrice *float64 `gorm:"type:numeric(15,3)"`
|
|
Tax *float64 `gorm:"type:numeric(15,3)"`
|
|
ExpiryPeriod *int `gorm:""`
|
|
CreatedBy uint `gorm:"not null"`
|
|
CreatedAt time.Time `gorm:"autoCreateTime"`
|
|
UpdatedAt time.Time `gorm:"autoUpdateTime"`
|
|
DeletedAt gorm.DeletedAt `gorm:"index" json:"-"`
|
|
IsVisible bool `gorm:"column:is_visible;default:true"`
|
|
|
|
CreatedUser User `gorm:"foreignKey:CreatedBy;references:Id"`
|
|
Uom Uom `gorm:"foreignKey:UomId;references:Id"`
|
|
ProductCategory ProductCategory `gorm:"foreignKey:ProductCategoryId;references:Id"`
|
|
ProductSuppliers []ProductSupplier `gorm:"foreignKey:ProductId;references:Id"`
|
|
Flags []Flag `gorm:"polymorphic:Flagable;polymorphicValue:products"`
|
|
ProductWarehouses []ProductWarehouse `gorm:"foreignKey:ProductId;references:Id"`
|
|
}
|