rename validate func for privilege
This commit is contained in:
parent
bb81299c25
commit
302802946c
@ -49,7 +49,7 @@ func (p *PrivilegeInternal) Create(c *fiber.Ctx) error {
|
||||
return c.Status(fiber.StatusBadRequest).JSON(fiber.Map{"error": "Invalid request payload"})
|
||||
}
|
||||
|
||||
if !tools.Validate(req) {
|
||||
if !tools.ValidatePrivilege(req) {
|
||||
return c.Status(fiber.StatusBadRequest).JSON(fiber.Map{"error": "Missing required fields"})
|
||||
}
|
||||
|
||||
@ -73,7 +73,7 @@ func (p *PrivilegeInternal) Update(c *fiber.Ctx) error {
|
||||
return c.Status(fiber.StatusBadRequest).JSON(fiber.Map{"error": "Invalid request payload"})
|
||||
}
|
||||
|
||||
if !tools.Validate(req) {
|
||||
if !tools.ValidatePrivilege(req) {
|
||||
return c.Status(fiber.StatusBadRequest).JSON(fiber.Map{"error": "Missing required fields"})
|
||||
}
|
||||
|
||||
@ -168,7 +168,7 @@ func (p *PrivilegeInternal) PostMany(c *fiber.Ctx) error {
|
||||
}
|
||||
|
||||
for _, priv := range req.Privileges {
|
||||
if !tools.Validate(priv) {
|
||||
if !tools.ValidatePrivilege(priv) {
|
||||
return c.Status(fiber.StatusBadRequest).JSON(fiber.Map{"error": "Missing required fields"})
|
||||
}
|
||||
}
|
||||
@ -198,7 +198,7 @@ func (p *PrivilegeInternal) UpdateMany(c *fiber.Ctx) error {
|
||||
}
|
||||
|
||||
for _, priv := range req.Privileges {
|
||||
if !tools.Validate(priv) {
|
||||
if !tools.ValidatePrivilege(priv) {
|
||||
return c.Status(fiber.StatusBadRequest).JSON(fiber.Map{"error": "Missing required fields"})
|
||||
}
|
||||
}
|
||||
|
@ -5,7 +5,7 @@ import (
|
||||
"hub_admin_backend_service/internal/models"
|
||||
)
|
||||
|
||||
func Validate(req models.CreateUpdateReq) bool {
|
||||
func ValidatePrivilege(req models.CreateUpdateReq) bool {
|
||||
if req.Name == "" || req.PrivilegeId == "" || req.ServiceKey == "" || req.Type == "" || req.Value == "" || req.Description == "" {
|
||||
return false
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user