27 lines
1.3 KiB
Go
27 lines
1.3 KiB
Go
package model
|
|
|
|
import "time"
|
|
|
|
// UserSession tracks the DeviseTokenAuth client session displayed by Chatwoot's
|
|
// profile Active Sessions page.
|
|
type UserSession struct {
|
|
ID uint `gorm:"primaryKey" json:"id"`
|
|
UserID uint `gorm:"not null;index;uniqueIndex:idx_user_session_client" json:"user_id"`
|
|
ClientID string `gorm:"size:255;not null;uniqueIndex:idx_user_session_client" json:"client_id"`
|
|
IPAddress string `gorm:"size:255" json:"ip_address"`
|
|
UserAgent string `gorm:"type:text" json:"-"`
|
|
BrowserName string `gorm:"size:255" json:"browser_name"`
|
|
BrowserVersion string `gorm:"size:255" json:"browser_version"`
|
|
DeviceName string `gorm:"size:255" json:"device_name"`
|
|
PlatformName string `gorm:"size:255" json:"platform_name"`
|
|
PlatformVersion string `gorm:"size:255" json:"platform_version"`
|
|
City string `gorm:"size:255" json:"city"`
|
|
Country string `gorm:"size:255" json:"country"`
|
|
CountryCode string `gorm:"size:32" json:"country_code"`
|
|
LastActivityAt *time.Time `json:"last_activity_at"`
|
|
CreatedAt time.Time `gorm:"autoCreateTime" json:"created_at"`
|
|
UpdatedAt time.Time `gorm:"autoUpdateTime" json:"updated_at"`
|
|
}
|
|
|
|
func (UserSession) TableName() string { return "user_sessions" }
|