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:
2026-02-11 07:08:54 +05:00
parent da90a21fd3
commit 4e3cdb8ad9
2 changed files with 2 additions and 2 deletions
@@ -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"`