🎨新增客户端状态字段

This commit is contained in:
coward
2024-03-11 14:53:28 +08:00
parent 16799ee5d8
commit 71d6090f94
10 changed files with 1002 additions and 0 deletions

View File

@@ -34,6 +34,7 @@ type Client struct {
EnableAfterCreation int `json:"enableAfterCreation" gorm:"type:int(1);default 1;comment:'是否创建后启用'"`
Keys string `json:"keys" gorm:"type:text;default null;comment:'公钥和密钥的json串'"`
UserId string `json:"userId" gorm:"type:char(36);not null;comment:'创建人id'"`
Enabled bool `json:"enabled" gorm:"type:tinyint(1);default 1;comment:'状态0 - 禁用 | 1 - 正常)'"`
User *User `json:"user" gorm:"foreignKey:UserId"`
}

View File

@@ -15,12 +15,14 @@ type Server struct {
type Client struct {
ID string `json:"id"`
Name string `json:"name"`
Email string `json:"email"`
PublicKey string `json:"publicKey"`
PresharedKey string `json:"presharedKey"`
AllowedIPS string `json:"allowedIps"`
PersistentKeepalive string `json:"persistentKeepalive"`
Endpoint string `json:"endpoint"`
CreateUser string `json:"createUser"`
Enabled bool `json:"enabled"`
CreatedAt string `json:"createdAt"`
UpdatedAt string `json:"updatedAt"`
}

25
model/vo/client.go Normal file
View File

@@ -0,0 +1,25 @@
package vo
import (
"wireguard-dashboard/model/entity"
"wireguard-dashboard/model/template_data"
)
type Client struct {
Id string `json:"id"`
Name string `json:"name"`
Email string `json:"email"`
SubnetRange string `json:"subnetRange"`
IpAllocation string `json:"ipAllocation"`
AllowedIPS string `json:"allowedIPS"`
ExtraAllowedIPS string `json:"extraAllowedIPS"`
Endpoint string `json:"endpoint"`
UseServerDNS int `json:"useServerDNS"`
EnableAfterCreation int `json:"enableAfterCreation"`
KeysStr string `json:"-" gorm:"keys_str"`
Keys template_data.Keys `json:"keys" gorm:"-"`
CreateUser string `json:"createUser"`
Enabled bool `json:"enabled"`
CreatedAt entity.JsonTime `json:"createAt"`
UpdatedAt entity.JsonTime `json:"updatedAt"`
}