登录与授权等
This commit is contained in:
@@ -2,12 +2,13 @@ package entity
|
||||
|
||||
import (
|
||||
"gorm.io/gorm"
|
||||
"time"
|
||||
)
|
||||
|
||||
// Grant Grant是授权给实例的,给予实例访问权限
|
||||
type Grant struct {
|
||||
gorm.Model `json:"model"`
|
||||
Token string `gorm:"unique;not null" json:"token,omitempty"`
|
||||
TTL int `gorm:"not null;default:0" json:"ttl,omitempty"`
|
||||
GrantTo uint `gorm:"not null;default:0;comment:instances(id) 授权给实例,0表示无指定(所有)" json:"grant_to,omitempty"`
|
||||
Token string `gorm:"unique;not null" json:"token"`
|
||||
ExpireAt time.Time `gorm:"index" json:"expire_at"`
|
||||
GrantTo string `gorm:"not null;default:'';comment:instances(name)授权给实例,空表示无指定(所有)" json:"grant_to"`
|
||||
}
|
||||
|
||||
@@ -6,6 +6,6 @@ import (
|
||||
|
||||
type Instance struct {
|
||||
gorm.Model `json:"model"`
|
||||
Name string `gorm:"unique;not null" json:"name,omitempty"`
|
||||
UpdateURL string `gorm:"column:update_url;not null;default:'';comment:更新URL,未指定使用默认" json:"update_url,omitempty"`
|
||||
Name string `gorm:"unique;not null" json:"name"`
|
||||
UpdateURL string `gorm:"column:update_url;not null;default:'';comment:更新URL,未指定使用默认" json:"update_url"`
|
||||
}
|
||||
|
||||
7
pkg/dao/entity/metadata.go
Normal file
7
pkg/dao/entity/metadata.go
Normal file
@@ -0,0 +1,7 @@
|
||||
package entity
|
||||
|
||||
type Metadata struct {
|
||||
ID uint `json:"id"`
|
||||
Key string `gorm:"unique;not null" json:"key"`
|
||||
Value string `gorm:"not null;default:''" json:"value"`
|
||||
}
|
||||
@@ -5,7 +5,7 @@ import "gorm.io/gorm"
|
||||
// Token Token是授权给用户的,给予用户登录权限
|
||||
type Token struct {
|
||||
gorm.Model `json:"model"`
|
||||
Token string `gorm:"unique;not null" json:"token,omitempty"`
|
||||
GrantTo string `gorm:"index;not null;default:''" json:"grant_to,omitempty"`
|
||||
TTL int `gorm:"not null;default:0" json:"ttl,omitempty"`
|
||||
Token string `gorm:"unique;not null" json:"token"`
|
||||
GrantTo string `gorm:"index;not null;default:''" json:"grant_to"`
|
||||
TTL int `gorm:"not null;default:0" json:"ttl"`
|
||||
}
|
||||
|
||||
@@ -4,7 +4,7 @@ import "gorm.io/gorm"
|
||||
|
||||
type Update struct {
|
||||
gorm.Model `json:"model"`
|
||||
HashID string `gorm:"index;not null" json:"hash_id,omitempty"`
|
||||
Comment string `gorm:"not null;default:'';comment:更新内容或注释" json:"comment,omitempty"`
|
||||
Changes string `gorm:"not null;comment:更改的文件列表,逗号分隔,引用files(hash_id)" json:"changes,omitempty"`
|
||||
HashID string `gorm:"index;not null" json:"hash_id"`
|
||||
Comment string `gorm:"not null;default:'';comment:更新内容或注释" json:"comment"`
|
||||
Changes string `gorm:"not null;comment:更改的文件列表,逗号分隔,引用files(hash_id)" json:"changes"`
|
||||
}
|
||||
|
||||
@@ -4,7 +4,7 @@ import "gorm.io/gorm"
|
||||
|
||||
type User struct {
|
||||
gorm.Model `json:"model"`
|
||||
Username string `gorm:"unique;not null" json:"username,omitempty"`
|
||||
Password string `gorm:"not null" json:"password,omitempty"`
|
||||
Roles string `gorm:"not null;default:''" json:"roles,omitempty"`
|
||||
Username string `gorm:"unique;not null" json:"username"`
|
||||
Password string `gorm:"not null" json:"password"`
|
||||
Roles string `gorm:"not null;default:''" json:"roles"`
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user