mirror of
https://gitlab.com/mbugroup/lti-api.git
synced 2026-05-20 13:31:56 +00:00
91b320d489
- Extend DB schema with product_warehouses and stock_logs tables - Implement stock adjustment API (increase/decrease operations) - Add comprehensive validation for all adjustment operations - Implement audit log system for each adjustment with history tracking - Include transaction handling, DTOs, seeders, and proper error handling - Add adjustment history API with pagination and filtering TODO: Integration testing pending
24 lines
922 B
Go
24 lines
922 B
Go
package entities
|
|
|
|
import (
|
|
"time"
|
|
|
|
"gorm.io/gorm"
|
|
)
|
|
|
|
type ProductWarehouse struct {
|
|
Id uint `json:"id" gorm:"primaryKey;autoIncrement"`
|
|
ProductId uint `json:"product_id" gorm:"not null"`
|
|
WarehouseId uint `json:"warehouse_id" gorm:"not null"`
|
|
Quantity float64 `json:"quantity" gorm:"default:0"`
|
|
CreatedAt time.Time `json:"created_at" gorm:"autoCreateTime"`
|
|
UpdatedAt time.Time `json:"updated_at" gorm:"autoUpdateTime"`
|
|
CreatedBy uint `json:"created_by" gorm:"not null"`
|
|
DeletedAt gorm.DeletedAt `json:"deleted_at" gorm:"index"`
|
|
|
|
// Relations
|
|
Product Product `json:"product,omitempty" gorm:"foreignKey:ProductId;references:Id"`
|
|
Warehouse Warehouse `json:"warehouse,omitempty" gorm:"foreignKey:WarehouseId;references:Id"`
|
|
CreatedUser User `json:"created_user,omitempty" gorm:"foreignKey:CreatedBy;references:Id"`
|
|
}
|