mirror of
https://gitlab.com/mbugroup/lti-api.git
synced 2026-05-20 21:41:55 +00:00
cd4c908334
- Remove JSON tags from Product, Warehouse, and CreatedUser relations - Keep GORM tags for database functionality - Simplify entity definition for better maintainability
24 lines
709 B
Go
24 lines
709 B
Go
package entities
|
|
|
|
import (
|
|
"time"
|
|
|
|
"gorm.io/gorm"
|
|
)
|
|
|
|
type ProductWarehouse struct {
|
|
Id uint `gorm:"primaryKey;autoIncrement"`
|
|
ProductId uint `gorm:"not null"`
|
|
WarehouseId uint `gorm:"not null"`
|
|
Quantity float64 `gorm:"default:0"`
|
|
CreatedAt time.Time `gorm:"autoCreateTime"`
|
|
UpdatedAt time.Time `gorm:"autoUpdateTime"`
|
|
CreatedBy uint `gorm:"not null"`
|
|
DeletedAt gorm.DeletedAt `json:"-" gorm:"index"`
|
|
|
|
// Relations
|
|
Product Product `gorm:"foreignKey:ProductId;references:Id"`
|
|
Warehouse Warehouse `gorm:"foreignKey:WarehouseId;references:Id"`
|
|
CreatedUser User `gorm:"foreignKey:CreatedBy;references:Id"`
|
|
}
|