Smail/backend/models/protocol_credential.go
smail 20a6eea3b3
Some checks are pending
Security Checks / security (push) Waiting to run
补齐邮件协议隔离回归并优化客户端设置
2026-09-06 22:28:20 +08:00

20 lines
1.0 KiB
Go

package models
import "time"
// ProtocolCredential 保存单个用户的邮件客户端协议开关和授权码哈希,不控制全局监听服务。
type ProtocolCredential struct {
ID int `xorm:"id bigint unsigned not null pk autoincr" json:"-"`
UserID int `xorm:"user_id bigint not null" json:"-"`
Protocol string `xorm:"protocol varchar(16) notnull" json:"protocol"`
Enabled bool `xorm:"enabled notnull default(0)" json:"enabled"`
CodeHash string `xorm:"code_hash varchar(255) notnull" json:"-"`
CodeVersion int `xorm:"code_version int notnull default(1)" json:"-"`
CreatedAt time.Time `xorm:"created_at datetime created notnull" json:"created_at"`
UpdatedAt time.Time `xorm:"updated_at datetime updated notnull" json:"updated_at"`
LastUsedAt *time.Time `xorm:"last_used_at datetime null" json:"last_used_at,omitempty"`
RevokedAt *time.Time `xorm:"revoked_at datetime null index" json:"revoked_at,omitempty"`
}
func (ProtocolCredential) TableName() string { return "protocol_credential" }