⚡ Optimized userinfo endpoint
This commit is contained in:
@ -19,20 +19,21 @@ const (
|
||||
type Account struct {
|
||||
BaseModel
|
||||
|
||||
Name string `json:"name" gorm:"uniqueIndex"`
|
||||
Nick string `json:"nick"`
|
||||
Avatar string `json:"avatar"`
|
||||
State AccountState `json:"state"`
|
||||
Profile AccountProfile `json:"profile"`
|
||||
Sessions []AuthSession `json:"sessions"`
|
||||
Challenges []AuthChallenge `json:"challenges"`
|
||||
Factors []AuthFactor `json:"factors"`
|
||||
Contacts []AccountContact `json:"contacts"`
|
||||
Events []ActionEvent `json:"events"`
|
||||
MagicTokens []MagicToken `json:"-" gorm:"foreignKey:AssignTo"`
|
||||
ThirdClients []ThirdClient `json:"clients"`
|
||||
ConfirmedAt *time.Time `json:"confirmed_at"`
|
||||
Permissions datatypes.JSONType[[]string] `json:"permissions"`
|
||||
Name string `json:"name" gorm:"uniqueIndex"`
|
||||
Nick string `json:"nick"`
|
||||
Avatar string `json:"avatar"`
|
||||
State AccountState `json:"state"`
|
||||
Profile AccountProfile `json:"profile"`
|
||||
Sessions []AuthSession `json:"sessions"`
|
||||
Challenges []AuthChallenge `json:"challenges"`
|
||||
Factors []AuthFactor `json:"factors"`
|
||||
Contacts []AccountContact `json:"contacts"`
|
||||
Events []ActionEvent `json:"events"`
|
||||
MagicTokens []MagicToken `json:"-" gorm:"foreignKey:AssignTo"`
|
||||
ThirdClients []ThirdClient `json:"clients"`
|
||||
Notifications []Notification `json:"notifications" gorm:"foreignKey:RecipientID"`
|
||||
ConfirmedAt *time.Time `json:"confirmed_at"`
|
||||
Permissions datatypes.JSONType[[]string] `json:"permissions"`
|
||||
}
|
||||
|
||||
func (v Account) GetPrimaryEmail() AccountContact {
|
||||
|
13
pkg/models/notifications.go
Normal file
13
pkg/models/notifications.go
Normal file
@ -0,0 +1,13 @@
|
||||
package models
|
||||
|
||||
import "time"
|
||||
|
||||
type Notification struct {
|
||||
BaseModel
|
||||
|
||||
Subject string `json:"subject"`
|
||||
Content string `json:"content"`
|
||||
IsImportant bool `json:"is_important"`
|
||||
ReadAt *time.Time `json:"read_at"`
|
||||
RecipientID uint `json:"recipient_id"`
|
||||
}
|
Reference in New Issue
Block a user