fix: update model relationships
This commit is contained in:
parent
25c7d6d4fb
commit
628f1b4aca
|
@ -12,6 +12,6 @@ type Account struct {
|
|||
Password *string
|
||||
CreatedAt time.Time
|
||||
UpdatedAt time.Time
|
||||
LoginTokens []LoginSession `gorm:"references:ID"`
|
||||
Keys []Key `gorm:"references:ID"`
|
||||
LoginTokens []LoginSession
|
||||
Keys []Key
|
||||
}
|
||||
|
|
|
@ -8,7 +8,8 @@ import (
|
|||
type Key struct {
|
||||
gorm.Model
|
||||
ID uint `gorm:"primaryKey"`
|
||||
Account Account `gorm:"references:ID"`
|
||||
AccountID uint
|
||||
Account Account
|
||||
PublicKey string
|
||||
PrivateKey string
|
||||
CreatedAt time.Time
|
||||
|
|
|
@ -8,7 +8,8 @@ import (
|
|||
type KeyChallenge struct {
|
||||
gorm.Model
|
||||
ID uint `gorm:"primaryKey"`
|
||||
Account Account `gorm:"foreignKey:AccountID"`
|
||||
AccountID uint
|
||||
Account Account
|
||||
Challenge string `gorm:"not null"`
|
||||
Expiration time.Time
|
||||
}
|
||||
|
|
|
@ -8,8 +8,9 @@ import (
|
|||
type LoginSession struct {
|
||||
gorm.Model
|
||||
ID uint `gorm:"primaryKey"`
|
||||
AccountID uint
|
||||
Token string `gorm:"uniqueIndex"`
|
||||
Account Account `gorm:"foreignKey:AccountID"`
|
||||
Account Account
|
||||
Expiration time.Time
|
||||
CreatedAt time.Time
|
||||
UpdatedAt time.Time
|
||||
|
|
Loading…
Reference in New Issue