登录功能完成
This commit is contained in:
13
pkg/dao/entity/grant.go
Normal file
13
pkg/dao/entity/grant.go
Normal file
@@ -0,0 +1,13 @@
|
||||
package entity
|
||||
|
||||
import (
|
||||
"gorm.io/gorm"
|
||||
)
|
||||
|
||||
// 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"`
|
||||
}
|
||||
11
pkg/dao/entity/instance.go
Normal file
11
pkg/dao/entity/instance.go
Normal file
@@ -0,0 +1,11 @@
|
||||
package entity
|
||||
|
||||
import (
|
||||
"gorm.io/gorm"
|
||||
)
|
||||
|
||||
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"`
|
||||
}
|
||||
11
pkg/dao/entity/token.go
Normal file
11
pkg/dao/entity/token.go
Normal file
@@ -0,0 +1,11 @@
|
||||
package entity
|
||||
|
||||
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"`
|
||||
}
|
||||
10
pkg/dao/entity/update.go
Normal file
10
pkg/dao/entity/update.go
Normal file
@@ -0,0 +1,10 @@
|
||||
package entity
|
||||
|
||||
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"`
|
||||
}
|
||||
@@ -3,9 +3,8 @@ package entity
|
||||
import "gorm.io/gorm"
|
||||
|
||||
type User struct {
|
||||
gorm.Model
|
||||
Username string `gorm:"unique;not null"`
|
||||
Password string `gorm:"not null"`
|
||||
Instance string `gorm:"not null;default:''"`
|
||||
Role string `gorm:"not null;default:0"`
|
||||
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"`
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user