modified: main_dc/yalarba/api_yal/internal/models/account.go
modified: "main_dc/yalarba/api_yal/internal/models/\320\276bject.go" for eagerloading use references
This commit is contained in:
@@ -29,5 +29,5 @@ type Account struct {
|
||||
|
||||
|
||||
// Связь: один Account имеет много Objects
|
||||
Objects []Object `json:"objects"` // Обратная связь
|
||||
Objects []Object `gorm:"foreignKey:OwnerID" json:"objects"`
|
||||
}
|
||||
|
||||
@@ -8,7 +8,7 @@ type Object struct {
|
||||
|
||||
// owner account ID
|
||||
OwnerID uint `json:"owner_id"`
|
||||
Owner Account `gorm:"foreignKey:OwnerID" json:"owner"`
|
||||
Owner Account `gorm:"foreignKey:OwnerID;references:ID" json:"owner"`
|
||||
|
||||
// Основная информация
|
||||
ShortName string `gorm:"not null" json:"short_name"`
|
||||
|
||||
Reference in New Issue
Block a user