You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
19 lines
1.1 KiB
19 lines
1.1 KiB
package model
|
|
|
|
import "time"
|
|
|
|
// UserLoginSession stores token fingerprints and the device metadata for one login.
|
|
type UserLoginSession struct {
|
|
ID int64 `gorm:"primaryKey;column:id;type:BIGINT;not null" json:"id"`
|
|
UserID int64 `gorm:"column:user_id;type:BIGINT;not null;index" json:"userId"`
|
|
AccessTokenID string `gorm:"column:access_token_id;type:VARCHAR(64);not null;uniqueIndex" json:"-"`
|
|
RefreshTokenID string `gorm:"column:refresh_token_id;type:VARCHAR(64);not null;uniqueIndex" json:"-"`
|
|
UserAgent string `gorm:"column:user_agent;type:VARCHAR(512)" json:"userAgent"`
|
|
IP string `gorm:"column:ip;type:VARCHAR(64)" json:"ip"`
|
|
LastActiveAt time.Time `gorm:"column:last_active_at;not null" json:"lastActiveAt"`
|
|
ExpiresAt time.Time `gorm:"column:expires_at;not null" json:"expiresAt"`
|
|
RevokedAt *time.Time `gorm:"column:revoked_at" json:"revokedAt"`
|
|
CreatedAt time.Time `gorm:"column:created_at;not null" json:"createdAt"`
|
|
}
|
|
|
|
func (UserLoginSession) TableName() string { return "user_login_session" }
|
|
|