mirror of
https://gitlab.com/mbugroup/lti-api.git
synced 2026-05-24 23:35:43 +00:00
refactor(BE-48): clean up ProductWarehouse entity structure
- Remove JSON tags from Product, Warehouse, and CreatedUser relations - Keep GORM tags for database functionality - Simplify entity definition for better maintainability
This commit is contained in:
@@ -7,17 +7,17 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
type ProductWarehouse struct {
|
type ProductWarehouse struct {
|
||||||
Id uint `json:"id" gorm:"primaryKey;autoIncrement"`
|
Id uint `gorm:"primaryKey;autoIncrement"`
|
||||||
ProductId uint `json:"product_id" gorm:"not null"`
|
ProductId uint `gorm:"not null"`
|
||||||
WarehouseId uint `json:"warehouse_id" gorm:"not null"`
|
WarehouseId uint `gorm:"not null"`
|
||||||
Quantity float64 `json:"quantity" gorm:"default:0"`
|
Quantity float64 `gorm:"default:0"`
|
||||||
CreatedAt time.Time `json:"created_at" gorm:"autoCreateTime"`
|
CreatedAt time.Time `gorm:"autoCreateTime"`
|
||||||
UpdatedAt time.Time `json:"updated_at" gorm:"autoUpdateTime"`
|
UpdatedAt time.Time `gorm:"autoUpdateTime"`
|
||||||
CreatedBy uint `json:"created_by" gorm:"not null"`
|
CreatedBy uint `gorm:"not null"`
|
||||||
DeletedAt gorm.DeletedAt `json:"-" gorm:"index"`
|
DeletedAt gorm.DeletedAt `json:"-" gorm:"index"`
|
||||||
|
|
||||||
// Relations
|
// Relations
|
||||||
Product Product `json:"product,omitempty" gorm:"foreignKey:ProductId;references:Id"`
|
Product Product `gorm:"foreignKey:ProductId;references:Id"`
|
||||||
Warehouse Warehouse `json:"warehouse,omitempty" gorm:"foreignKey:WarehouseId;references:Id"`
|
Warehouse Warehouse `gorm:"foreignKey:WarehouseId;references:Id"`
|
||||||
CreatedUser User `json:"created_user,omitempty" gorm:"foreignKey:CreatedBy;references:Id"`
|
CreatedUser User `gorm:"foreignKey:CreatedBy;references:Id"`
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user