mirror of
https://github.com/EZ-Api/ez-api.git
synced 2026-01-13 17:47:51 +00:00
refactor(deps): use foundation shared utilities
This commit is contained in:
@@ -8,6 +8,7 @@ import (
|
||||
"github.com/ez-api/ez-api/internal/dto"
|
||||
"github.com/ez-api/ez-api/internal/model"
|
||||
"github.com/ez-api/ez-api/internal/service"
|
||||
groupx "github.com/ez-api/foundation/group"
|
||||
"github.com/ez-api/foundation/provider"
|
||||
"github.com/gin-gonic/gin"
|
||||
"gorm.io/gorm"
|
||||
@@ -157,7 +158,7 @@ func (h *Handler) UpdateProvider(c *gin.Context) {
|
||||
update["models"] = strings.Join(req.Models, ",")
|
||||
}
|
||||
if strings.TrimSpace(req.Group) != "" {
|
||||
update["group"] = normalizeGroup(req.Group)
|
||||
update["group"] = groupx.Normalize(req.Group)
|
||||
}
|
||||
if req.AutoBan != nil {
|
||||
update["auto_ban"] = *req.AutoBan
|
||||
@@ -354,10 +355,3 @@ func (h *Handler) IngestLog(c *gin.Context) {
|
||||
h.logger.Write(rec)
|
||||
c.JSON(http.StatusAccepted, gin.H{"status": "queued"})
|
||||
}
|
||||
|
||||
func normalizeGroup(group string) string {
|
||||
if strings.TrimSpace(group) == "" {
|
||||
return "default"
|
||||
}
|
||||
return group
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user