mirror of
https://git.fightbot.fun/hxuanyu/FileRelay.git
synced 2026-02-15 08:51:44 +08:00
Initial commit
This commit is contained in:
22
internal/model/api_token.go
Normal file
22
internal/model/api_token.go
Normal file
@@ -0,0 +1,22 @@
|
||||
package model
|
||||
|
||||
import (
|
||||
"time"
|
||||
)
|
||||
|
||||
const (
|
||||
ScopeUpload = "upload" // 上传权限
|
||||
ScopePickup = "pickup" // 取件/下载权限
|
||||
ScopeAdmin = "admin" // 管理权限
|
||||
)
|
||||
|
||||
type APIToken struct {
|
||||
ID uint `gorm:"primaryKey" json:"id"`
|
||||
Name string `json:"name"`
|
||||
TokenHash string `gorm:"uniqueIndex;not null" json:"-"`
|
||||
Scope string `json:"scope"`
|
||||
ExpireAt *time.Time `json:"expire_at"`
|
||||
LastUsedAt *time.Time `json:"last_used_at"`
|
||||
Revoked bool `gorm:"default:false" json:"revoked"`
|
||||
CreatedAt time.Time `json:"created_at"`
|
||||
}
|
||||
Reference in New Issue
Block a user