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