package entities import ( "time" "gorm.io/gorm" ) type Product struct { Id uint `gorm:"primaryKey"` Name string `gorm:"not null;uniqueIndex:products_name_unique,where:deleted_at IS NULL"` Brand string `gorm:"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:"-"` CreatedUser User `gorm:"foreignKey:CreatedBy;references:Id"` Uom Uom `gorm:"foreignKey:UomId;references:Id"` ProductCategory ProductCategory `gorm:"foreignKey:ProductCategoryId;references:Id"` Suppliers []Supplier `gorm:"many2many:product_suppliers;joinForeignKey:ProductID;joinReferences:SupplierID"` Flags []Flag `gorm:"polymorphic:Flagable;polymorphicValue:products"` }