refact:openteam

This commit is contained in:
Sakurasan
2025-01-01 23:10:01 +08:00
parent 1f5e1c221c
commit 65d6d12972
18 changed files with 1126 additions and 106 deletions

19
team/model/Token.go Normal file
View File

@@ -0,0 +1,19 @@
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;type:char(48);uniqueIndex:idx_token_key"`
Status bool `gorm:"column:status;default:true"` // enabled 0, disabled 1
Quota int64 `gorm:"column:quota;type:bigint;default:0"` // -1 means unlimited
UnlimitedQuota bool `gorm:"column:unlimited_quota;default:true"`
UsedQuota int64 `gorm:"column:used_quota;type:bigint;default:0"`
CreatedTime int64 `gorm:"column:created_time;type:bigint"`
ExpiredTime int64 `gorm:"column:expired_time;type:bigint;default:-1"` // -1 means never expired
}
func (Token) TableName() string {
return "token"
}