chore: add request validations

This commit is contained in:
2025-06-03 20:23:06 +01:00
parent e00cefb8e4
commit 0879aec750
6 changed files with 67 additions and 15 deletions
+19
View File
@@ -0,0 +1,19 @@
package api
import (
"net/http"
"github.com/go-playground/validator/v10"
"github.com/labstack/echo/v4"
)
type CustomValidator struct {
validator *validator.Validate
}
func (validator *CustomValidator) Validate(i any) error {
if err := validator.validator.Struct(i); err != nil {
return echo.NewHTTPError(http.StatusBadRequest, err.Error())
}
return nil
}