Hidden() already listed profile_data, but encoding/json would still emit the Jsonable field. Tag it json:"-" so the DATA-07 marshal backstop holds. Co-authored-by: Cursor <cursoragent@cursor.com>
33 lines
1.3 KiB
Go
33 lines
1.3 KiB
Go
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" json:"-"`
|
|
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{}) }
|