mirror of
https://gitlab.com/mbugroup/lti-api.git
synced 2026-05-20 21:41:55 +00:00
37 lines
1.4 KiB
Go
37 lines
1.4 KiB
Go
package entities
|
|
|
|
import (
|
|
"time"
|
|
|
|
"gorm.io/gorm"
|
|
)
|
|
|
|
const (
|
|
LogTypeAdjustment = "ADJUSTMENT"
|
|
LogTypeTransfer = "TRANSFER"
|
|
)
|
|
|
|
const (
|
|
TransactionTypeIncrease = "INCREASE"
|
|
TransactionTypeDecrease = "DECREASE"
|
|
)
|
|
|
|
type StockLog struct {
|
|
Id uint `gorm:"primaryKey;column:id"`
|
|
TransactionType string `gorm:"type:varchar(20);not null"`
|
|
Quantity float64 `gorm:"type:numeric(15,3);not null"`
|
|
BeforeQuantity float64 `gorm:"type:numeric(15,3);not null"`
|
|
AfterQuantity float64 `gorm:"type:numeric(15,3);not null"`
|
|
LogType string `gorm:"type:varchar(50);not null;index:stock_logs_flaggable_lookup,priority:1"`
|
|
LogId uint `gorm:"not null;index:stock_logs_flaggable_lookup,priority:2"`
|
|
Note string `gorm:"type:text"`
|
|
ProductWarehouseId uint `gorm:"not null;index"`
|
|
CreatedBy uint `gorm:"index"`
|
|
CreatedAt time.Time `gorm:"autoCreateTime"`
|
|
UpdatedAt time.Time `gorm:"autoUpdateTime"`
|
|
DeletedAt gorm.DeletedAt `json:"-" gorm:"index"`
|
|
|
|
ProductWarehouse *ProductWarehouse `json:"product_warehouse,omitempty" gorm:"foreignKey:ProductWarehouseId;references:Id"`
|
|
CreatedUser *User `json:"created_user,omitempty" gorm:"foreignKey:CreatedBy;references:Id"`
|
|
}
|