feat(14.1-01): add OAuth identities table and empty-list Index
- Model golem15_user_oauth_identities with Encrypted tokens and empty Fillable
- gormigrate 202610050001 with both unique indexes, cascade FK, and jsonb profile_data
- OAuthIdentitiesIndex returns {"data":[]} for a signed-in caller with no rows
This commit is contained in:
32
models/oauth_identity.go
Normal file
32
models/oauth_identity.go
Normal file
@@ -0,0 +1,32 @@
|
||||
package models
|
||||
|
||||
import (
|
||||
"time"
|
||||
|
||||
"git.golem15.com/golem15/summercms/modules/lagoon"
|
||||
)
|
||||
|
||||
// OAuthIdentity is one linked social-login provider for a user.
|
||||
type OAuthIdentity struct {
|
||||
ID uint `gorm:"column:id;primaryKey"`
|
||||
UserID uint `gorm:"column:user_id"`
|
||||
Provider string `gorm:"column:provider"`
|
||||
ProviderID string `gorm:"column:provider_id"`
|
||||
AccessToken lagoon.Encrypted `gorm:"column:access_token" json:"-"`
|
||||
RefreshToken lagoon.Encrypted `gorm:"column:refresh_token" json:"-"`
|
||||
TokenExpiresAt *time.Time `gorm:"column:token_expires_at"`
|
||||
ProfileData lagoon.Jsonable[map[string]any] `gorm:"column:profile_data"`
|
||||
LinkedAt *time.Time `gorm:"column:linked_at"`
|
||||
CreatedAt time.Time `gorm:"column:created_at"`
|
||||
UpdatedAt time.Time `gorm:"column:updated_at"`
|
||||
}
|
||||
|
||||
func (OAuthIdentity) TableName() string { return "golem15_user_oauth_identities" }
|
||||
|
||||
func (OAuthIdentity) Fillable() []string { return []string{} }
|
||||
|
||||
func (OAuthIdentity) Hidden() []string {
|
||||
return []string{"access_token", "refresh_token", "profile_data"}
|
||||
}
|
||||
|
||||
func init() { Register(OAuthIdentity{}) }
|
||||
Reference in New Issue
Block a user