mirror of
https://gitlab.com/mbugroup/lti-api.git
synced 2026-05-20 13:31:56 +00:00
fix(BE-48): improve adjustment history filtering and fix pointer conversion
- Add search parameter to adjustment history API - Fix JOIN query logic to avoid duplicate JOINs - Use EXISTS subquery for cleaner product/warehouse filtering - Fix pointer conversion issue in slice iteration - Improve query performance and code readability
This commit is contained in:
@@ -16,19 +16,19 @@ const (
|
||||
)
|
||||
|
||||
type StockLog struct {
|
||||
Id uint `json:"id" gorm:"primaryKey;column:id"`
|
||||
TransactionType string `json:"transaction_type" gorm:"column:transaction_type;type:varchar(20);not null"`
|
||||
Quantity float64 `json:"quantity" gorm:"column:quantity;type:numeric(15,3);not null"`
|
||||
BeforeQuantity float64 `json:"before_quantity" gorm:"column:before_quantity;type:numeric(15,3);not null"`
|
||||
AfterQuantity float64 `json:"after_quantity" gorm:"column:after_quantity;type:numeric(15,3);not null"`
|
||||
LogType string `json:"log_type" gorm:"column:log_type;type:varchar(50);not null;index:stock_logs_flaggable_lookup,priority:1"`
|
||||
LogId uint `json:"log_id" gorm:"column:log_id;not null;index:stock_logs_flaggable_lookup,priority:2"`
|
||||
Note string `json:"note" gorm:"column:note;type:text"`
|
||||
ProductWarehouseId uint `json:"product_warehouse_id" gorm:"column:product_warehouse_id;not null;index"`
|
||||
CreatedBy uint `json:"created_by" gorm:"column:created_by;not null;index"`
|
||||
CreatedAt time.Time `json:"created_at" gorm:"column:created_at;autoCreateTime"`
|
||||
UpdatedAt time.Time `json:"updated_at" gorm:"column:updated_at;autoUpdateTime"`
|
||||
DeletedAt gorm.DeletedAt `json:"deleted_at,omitempty" gorm:"column:deleted_at;index"`
|
||||
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"`
|
||||
|
||||
Reference in New Issue
Block a user