重构增加模型枚举值定义

This commit is contained in:
2025-05-09 18:56:17 +08:00
parent d5a242d6b4
commit 071a0e1a6c
29 changed files with 252 additions and 138 deletions

View File

@@ -4,6 +4,7 @@ import (
"fmt"
"platform/web/auth"
"platform/web/core"
channel2 "platform/web/domains/channel"
q "platform/web/queries"
s "platform/web/services"
"time"
@@ -90,7 +91,7 @@ func ListChannels(c *fiber.Ctx) error {
type CreateChannelReq struct {
ResourceId int32 `json:"resource_id" validate:"required"`
AuthType s.ChannelAuthType `json:"auth_type" validate:"required"`
Protocol s.ChannelProtocol `json:"protocol" validate:"required"`
Protocol channel2.Protocol `json:"protocol" validate:"required"`
Count int `json:"count" validate:"required"`
Prov string `json:"prov"`
City string `json:"city"`
@@ -98,7 +99,7 @@ type CreateChannelReq struct {
}
type CreateChannelRespItem struct {
Proto s.ChannelProtocol `json:"-"`
Proto channel2.Protocol `json:"-"`
Host string `json:"host"`
Port int32 `json:"port"`
Username *string `json:"username,omitempty"`
@@ -198,7 +199,7 @@ func RemoveChannels(c *fiber.Ctx) error {
// 检查权限
authCtx, err := auth.Protect(c, []auth.PayloadType{
auth.PayloadUser,
auth.PayloadClientConfidential,
auth.PayloadSecuredServer,
}, []string{})
if err != nil {
return err