team api
This commit is contained in:
20
team/model/token.go
Normal file
20
team/model/token.go
Normal file
@@ -0,0 +1,20 @@
|
||||
package model
|
||||
|
||||
// 用户的token
|
||||
type Token struct {
|
||||
ID int64 `gorm:"column:id;primaryKey;autoIncrement"`
|
||||
UserID int64 `gorm:"column:user_id;not null;index:idx_token_user_id"`
|
||||
Name string `gorm:"column:name;index:idx_token_name"`
|
||||
Key string `gorm:"column:key;not null;uniqueIndex:idx_token_key;comment:token key"`
|
||||
Status int64 `gorm:"column:status;default:1;check:status IN (0,1)"` // enabled 1, disabled 0
|
||||
Quota int64 `gorm:"column:quota;type:bigint;default:0"` // default 0
|
||||
UnlimitedQuota bool `gorm:"column:unlimited_quota;default:true"` // set Quota 1 unlimited
|
||||
UsedQuota int64 `gorm:"column:used_quota;type:bigint;default:0"`
|
||||
CreatedAt int64 `gorm:"column:created_at;type:bigint;autoCreateTime"`
|
||||
ExpiredAt int64 `gorm:"column:expired_at;type:bigint;default:-1"` // -1 means never expired
|
||||
User User `gorm:"foreignKey:UserID;constraint:OnUpdate:CASCADE,OnDelete:CASCADE" json:"user"`
|
||||
}
|
||||
|
||||
func (Token) TableName() string {
|
||||
return "tokens"
|
||||
}
|
||||
Reference in New Issue
Block a user