mirror of
https://gitlab.com/mbugroup/lti-api.git
synced 2026-05-24 07:15:43 +00:00
Merge branch 'feat/BE/US-35/stock-transfer' into 'development-before-sso'
(BE-58,,59): extend db schema & build stock transfer api See merge request mbugroup/lti-api!19
This commit is contained in:
@@ -0,0 +1,23 @@
|
||||
package entities
|
||||
|
||||
import "time"
|
||||
|
||||
// HEADER
|
||||
type StockTransfer struct {
|
||||
Id uint64 `gorm:"primaryKey;autoIncrement"`
|
||||
MovementNumber string `gorm:"uniqueIndex;not null"`
|
||||
FromWarehouseId uint64
|
||||
ToWarehouseId uint64
|
||||
TransferDate time.Time
|
||||
Reason string
|
||||
CreatedBy uint64
|
||||
CreatedAt time.Time
|
||||
UpdatedAt time.Time
|
||||
DeletedAt *time.Time `gorm:"index"`
|
||||
// Relations
|
||||
FromWarehouse *Warehouse `gorm:"foreignKey:FromWarehouseId"`
|
||||
ToWarehouse *Warehouse `gorm:"foreignKey:ToWarehouseId"`
|
||||
Details []StockTransferDetail `gorm:"foreignKey:StockTransferId"`
|
||||
Deliveries []StockTransferDelivery `gorm:"foreignKey:StockTransferId"`
|
||||
CreatedUser *User `gorm:"foreignKey:CreatedBy"`
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
package entities
|
||||
|
||||
import "time"
|
||||
|
||||
// DETAIL EKSPEDISI
|
||||
type StockTransferDelivery struct {
|
||||
Id uint64 `gorm:"primaryKey;autoIncrement"`
|
||||
StockTransferId uint64
|
||||
SupplierId uint64
|
||||
VehiclePlate string
|
||||
DriverName string
|
||||
DocumentNumber string
|
||||
DocumentPath string
|
||||
ShippingCostItem float64
|
||||
ShippingCostTotal float64
|
||||
CreatedAt time.Time
|
||||
UpdatedAt time.Time
|
||||
DeletedAt *time.Time `gorm:"index"`
|
||||
// Relations
|
||||
StockTransfer *StockTransfer `gorm:"foreignKey:StockTransferId"`
|
||||
Supplier *Supplier `gorm:"foreignKey:SupplierId"`
|
||||
Items []StockTransferDeliveryItem `gorm:"foreignKey:StockTransferDeliveryId"`
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
package entities
|
||||
|
||||
// PIVOT TABLE TRANSFER
|
||||
type StockTransferDeliveryItem struct {
|
||||
Id uint64 `gorm:"primaryKey;autoIncrement"`
|
||||
StockTransferDeliveryId uint64
|
||||
StockTransferDetailId uint64
|
||||
Quantity float64
|
||||
// Relations
|
||||
StockTransferDelivery *StockTransferDelivery `gorm:"foreignKey:StockTransferDeliveryId"`
|
||||
StockTransferDetail *StockTransferDetail `gorm:"foreignKey:StockTransferDetailId"`
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
package entities
|
||||
|
||||
import "time"
|
||||
|
||||
// DETAIL PRODUK
|
||||
type StockTransferDetail struct {
|
||||
Id uint64 `gorm:"primaryKey;autoIncrement"`
|
||||
StockTransferId uint64
|
||||
ProductId uint64
|
||||
Quantity float64
|
||||
CreatedAt time.Time
|
||||
UpdatedAt time.Time
|
||||
DeletedAt *time.Time `gorm:"index"`
|
||||
// Relations
|
||||
StockTransfer *StockTransfer `gorm:"foreignKey:StockTransferId"`
|
||||
Product *Product `gorm:"foreignKey:ProductId"`
|
||||
DeliveryItems []StockTransferDeliveryItem `gorm:"foreignKey:StockTransferDetailId"`
|
||||
}
|
||||
Reference in New Issue
Block a user