Refactor[BE] adjustment stock handling: remove stock_log_id, update relations, and enhance transfer logging

This commit is contained in:
aguhh18
2026-01-26 16:26:20 +07:00
parent 258fd1d7e0
commit 1572dfd0b8
6 changed files with 33 additions and 45 deletions
+1 -2
View File
@@ -4,7 +4,6 @@ import "time"
type AdjustmentStock struct {
Id uint `gorm:"primaryKey"`
StockLogId uint `gorm:"column:stock_log_id;not null;index"`
ProductWarehouseId uint `gorm:"column:product_warehouse_id;not null"`
TotalQty float64 `gorm:"column:total_qty;default:0"`
TotalUsed float64 `gorm:"column:total_used;default:0"`
@@ -13,6 +12,6 @@ type AdjustmentStock struct {
CreatedAt time.Time `gorm:"column:created_at;autoCreateTime"`
UpdatedAt time.Time `gorm:"column:updated_at;autoUpdateTime"`
StockLog *StockLog `gorm:"foreignKey:StockLogId;references:Id"`
ProductWarehouse *ProductWarehouse `gorm:"foreignKey:ProductWarehouseId;references:Id"`
StockLog *StockLog `gorm:"polymorphic:Loggable;polymorphicType:LoggableType;polymorphicId:LoggableId;polymorphicValue:ADJUSTMENT"`
}