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
|
||||
}
|
||||
|
|
|
@ -7,8 +7,9 @@ import (
|
|||
|
||||
type Key struct {
|
||||
gorm.Model
|
||||
ID uint `gorm:"primaryKey"`
|
||||
Account Account `gorm:"references:ID"`
|
||||
ID uint `gorm:"primaryKey"`
|
||||
AccountID uint
|
||||
Account Account
|
||||
PublicKey string
|
||||
PrivateKey string
|
||||
CreatedAt time.Time
|
||||
|
|
|
@ -7,8 +7,9 @@ import (
|
|||
|
||||
type KeyChallenge struct {
|
||||
gorm.Model
|
||||
ID uint `gorm:"primaryKey"`
|
||||
Account Account `gorm:"foreignKey:AccountID"`
|
||||
Challenge string `gorm:"not null"`
|
||||
ID uint `gorm:"primaryKey"`
|
||||
AccountID uint
|
||||
Account Account
|
||||
Challenge string `gorm:"not null"`
|
||||
Expiration time.Time
|
||||
}
|
||||
|
|
|
@ -7,9 +7,10 @@ import (
|
|||
|
||||
type LoginSession struct {
|
||||
gorm.Model
|
||||
ID uint `gorm:"primaryKey"`
|
||||
Token string `gorm:"uniqueIndex"`
|
||||
Account Account `gorm:"foreignKey:AccountID"`
|
||||
ID uint `gorm:"primaryKey"`
|
||||
AccountID uint
|
||||
Token string `gorm:"uniqueIndex"`
|
||||
Account Account
|
||||
Expiration time.Time
|
||||
CreatedAt time.Time
|
||||
UpdatedAt time.Time
|
||||
|
|
Loading…
Reference in New Issue