fix(niki): patch linter errors

This commit is contained in:
Iman Mirazimi 2024-01-02 19:05:26 +03:30
parent 7e5f49e63e
commit 7de5d5fdae
50 changed files with 380 additions and 181 deletions

View File

@ -3,9 +3,9 @@ package adminkindboxhandler
import (
"net/http"
httpmsg "git.gocasts.ir/ebhomengo/niki/param/admin/kind_box"
param "git.gocasts.ir/ebhomengo/niki/param/admin/kind_box"
"github.com/labstack/echo/v4"
httpmsg "git.gocasts.ir/ebhomengo/niki/pkg/http_msg"
echo "github.com/labstack/echo/v4"
)
func (h Handler) Add(c echo.Context) error {
@ -13,16 +13,18 @@ func (h Handler) Add(c echo.Context) error {
if bErr := c.Bind(&req); bErr != nil {
return echo.NewHTTPError(http.StatusBadRequest)
}
if fieldErrors, err := h.adminKindBoxVld.ValidateAdminAddRequest(c, req); err != nil {
if fieldErrors, err := h.adminKindBoxVld.ValidateAddRequest(req); err != nil {
msg, code := httpmsg.Error(err)
return c.JSON(code, echo.Map{
"message": msg,
"errors": fieldErrors,
})
}
resp, sErr := h.adminKindBoxSvc.Add(c, req)
resp, sErr := h.adminKindBoxSvc.Add(c.Request().Context(), req)
if sErr != nil {
msg, code := httpmsg.Error(sErr)
return echo.NewHTTPError(code, msg)
}

View File

@ -3,9 +3,9 @@ package adminkindboxhandler
import (
"net/http"
httpmsg "git.gocasts.ir/ebhomengo/niki/param/admin/kind_box"
param "git.gocasts.ir/ebhomengo/niki/param/admin/kind_box"
"github.com/labstack/echo/v4"
httpmsg "git.gocasts.ir/ebhomengo/niki/pkg/http_msg"
echo "github.com/labstack/echo/v4"
)
func (h Handler) Get(c echo.Context) error {
@ -13,16 +13,18 @@ func (h Handler) Get(c echo.Context) error {
if bErr := c.Bind(&req); bErr != nil {
return echo.NewHTTPError(http.StatusBadRequest)
}
if fieldErrors, err := h.adminKindBoxVld.ValidateAdminGetRequest(c, req); err != nil {
if fieldErrors, err := h.adminKindBoxVld.ValidateGetRequest(req); err != nil {
msg, code := httpmsg.Error(err)
return c.JSON(code, echo.Map{
"message": msg,
"errors": fieldErrors,
})
}
resp, sErr := h.adminKindBoxSvc.Get(c, req)
resp, sErr := h.adminKindBoxSvc.Get(c.Request().Context(), req)
if sErr != nil {
msg, code := httpmsg.Error(sErr)
return echo.NewHTTPError(code, msg)
}

View File

@ -3,9 +3,9 @@ package adminkindboxhandler
import (
"net/http"
httpmsg "git.gocasts.ir/ebhomengo/niki/param/admin/kind_box"
param "git.gocasts.ir/ebhomengo/niki/param/admin/kind_box"
"github.com/labstack/echo/v4"
httpmsg "git.gocasts.ir/ebhomengo/niki/pkg/http_msg"
echo "github.com/labstack/echo/v4"
)
func (h Handler) GetAll(c echo.Context) error {
@ -14,9 +14,10 @@ func (h Handler) GetAll(c echo.Context) error {
return echo.NewHTTPError(http.StatusBadRequest)
}
resp, sErr := h.adminKindBoxSvc.GetAll(c, req)
resp, sErr := h.adminKindBoxSvc.GetAll(c.Request().Context(), req)
if sErr != nil {
msg, code := httpmsg.Error(sErr)
return echo.NewHTTPError(code, msg)
}

View File

@ -1,7 +1,7 @@
package adminkindboxhandler
import (
"github.com/labstack/echo/v4"
echo "github.com/labstack/echo/v4"
)
func (h Handler) SetRoutes(e *echo.Echo) {
@ -11,5 +11,4 @@ func (h Handler) SetRoutes(e *echo.Echo) {
r.GET("/:id", h.Get).Name = "admin-getkindboxbyid"
r.GET("/", h.GetAll).Name = "admin-getallkindbox"
r.PATCH("/:id", h.Update).Name = "admin-updatekindbox"
// r.DELETE("/:id",h.Delete).Name = "admin-deletekindbox"
}

View File

@ -3,9 +3,9 @@ package adminkindboxhandler
import (
"net/http"
httpmsg "git.gocasts.ir/ebhomengo/niki/param/admin/kind_box"
param "git.gocasts.ir/ebhomengo/niki/param/admin/kind_box"
"github.com/labstack/echo/v4"
httpmsg "git.gocasts.ir/ebhomengo/niki/pkg/http_msg"
echo "github.com/labstack/echo/v4"
)
func (h Handler) Update(c echo.Context) error {
@ -13,16 +13,18 @@ func (h Handler) Update(c echo.Context) error {
if bErr := c.Bind(&req); bErr != nil {
return echo.NewHTTPError(http.StatusBadRequest)
}
if fieldErrors, err := h.adminKindBoxVld.ValidateAdminUpdateRequest(c, req); err != nil {
if fieldErrors, err := h.adminKindBoxVld.ValidateUpdateRequest(req); err != nil {
msg, code := httpmsg.Error(err)
return c.JSON(code, echo.Map{
"message": msg,
"errors": fieldErrors,
})
}
resp, sErr := h.adminKindBoxSvc.Update(c, req)
resp, sErr := h.adminKindBoxSvc.Update(c.Request().Context(), req)
if sErr != nil {
msg, code := httpmsg.Error(sErr)
return echo.NewHTTPError(code, msg)
}

View File

@ -3,9 +3,9 @@ package adminkindboxreqhandler
import (
"net/http"
httpmsg "git.gocasts.ir/ebhomengo/niki/param/admin/kind_box_req"
param "git.gocasts.ir/ebhomengo/niki/param/admin/kind_box_req"
"github.com/labstack/echo/v4"
httpmsg "git.gocasts.ir/ebhomengo/niki/pkg/http_msg"
echo "github.com/labstack/echo/v4"
)
func (h Handler) Add(c echo.Context) error {
@ -13,16 +13,18 @@ func (h Handler) Add(c echo.Context) error {
if bErr := c.Bind(&req); bErr != nil {
return echo.NewHTTPError(http.StatusBadRequest)
}
if fieldErrors, err := h.adminKindBoxReqVld.ValidateAdminAddRequest(c, req); err != nil {
if fieldErrors, err := h.adminKindBoxReqVld.ValidateAddRequest(req); err != nil {
msg, code := httpmsg.Error(err)
return c.JSON(code, echo.Map{
"message": msg,
"errors": fieldErrors,
})
}
resp, sErr := h.adminKindBoxReqSvc.Add(c, req)
resp, sErr := h.adminKindBoxReqSvc.Add(c.Request().Context(), req)
if sErr != nil {
msg, code := httpmsg.Error(sErr)
return echo.NewHTTPError(code, msg)
}

View File

@ -3,9 +3,9 @@ package adminkindboxreqhandler
import (
"net/http"
httpmsg "git.gocasts.ir/ebhomengo/niki/param/admin/kind_box_req"
param "git.gocasts.ir/ebhomengo/niki/param/admin/kind_box_req"
"github.com/labstack/echo/v4"
httpmsg "git.gocasts.ir/ebhomengo/niki/pkg/http_msg"
echo "github.com/labstack/echo/v4"
)
func (h Handler) Get(c echo.Context) error {
@ -13,16 +13,18 @@ func (h Handler) Get(c echo.Context) error {
if bErr := c.Bind(&req); bErr != nil {
return echo.NewHTTPError(http.StatusBadRequest)
}
if fieldErrors, err := h.adminKindBoxReqVld.ValidateAdminGetRequest(c, req); err != nil {
if fieldErrors, err := h.adminKindBoxReqVld.ValidateGetRequest(req); err != nil {
msg, code := httpmsg.Error(err)
return c.JSON(code, echo.Map{
"message": msg,
"errors": fieldErrors,
})
}
resp, sErr := h.adminKindBoxReqSvc.Get(c, req)
resp, sErr := h.adminKindBoxReqSvc.Get(c.Request().Context(), req)
if sErr != nil {
msg, code := httpmsg.Error(sErr)
return echo.NewHTTPError(code, msg)
}

View File

@ -3,9 +3,9 @@ package adminkindboxreqhandler
import (
"net/http"
httpmsg "git.gocasts.ir/ebhomengo/niki/param/admin/kind_box_req"
param "git.gocasts.ir/ebhomengo/niki/param/admin/kind_box_req"
"github.com/labstack/echo/v4"
httpmsg "git.gocasts.ir/ebhomengo/niki/pkg/http_msg"
echo "github.com/labstack/echo/v4"
)
func (h Handler) GetAll(c echo.Context) error {
@ -14,9 +14,10 @@ func (h Handler) GetAll(c echo.Context) error {
return echo.NewHTTPError(http.StatusBadRequest)
}
resp, sErr := h.adminKindBoxReqSvc.GetAll(c, req)
resp, sErr := h.adminKindBoxReqSvc.GetAll(c.Request().Context(), req)
if sErr != nil {
msg, code := httpmsg.Error(sErr)
return echo.NewHTTPError(code, msg)
}

View File

@ -14,7 +14,7 @@ type Handler struct {
}
func New(authConfig authservice.Config, authSvc authservice.Service,
adminKindBoxReqSvc adminkindboxreqservice.Service, adminKindBoxReqVld adminkindboxvalidator.Validator,
adminKindBoxReqSvc adminkindboxreqservice.Service, adminKindBoxReqVld adminkindboxreqvalidator.Validator,
) Handler {
return Handler{
authConfig: authConfig,

View File

@ -1,15 +1,14 @@
package adminkindboxreqhandler
import (
"github.com/labstack/echo/v4"
echo "github.com/labstack/echo/v4"
)
func (h Handler) SetRoutes(e *echo.Echo) {
r := e.Group("/admin/kindboxreqs")
r.POST("/").Name = "admin-addkindboxreq"
r.GET("/:id").Name = "admin-getkindboxreqbyid"
r.GET("/").Name = "admin-getallkindboxreq"
r.PUT("/:id").Name = "admin-updatekindboxreq"
// r.DELETE("/:id").Name = "admin-deletekindbox"
r.POST("/", h.Add).Name = "admin-addkindboxreq"
r.GET("/:id", h.Get).Name = "admin-getkindboxreqbyid"
r.GET("/", h.GetAll).Name = "admin-getallkindboxreq"
r.PUT("/:id", h.Update).Name = "admin-updatekindboxreq"
}

View File

@ -3,9 +3,9 @@ package adminkindboxreqhandler
import (
"net/http"
httpmsg "git.gocasts.ir/ebhomengo/niki/param/admin/kind_box_req"
param "git.gocasts.ir/ebhomengo/niki/param/admin/kind_box_req"
"github.com/labstack/echo/v4"
httpmsg "git.gocasts.ir/ebhomengo/niki/pkg/http_msg"
echo "github.com/labstack/echo/v4"
)
func (h Handler) Update(c echo.Context) error {
@ -13,16 +13,18 @@ func (h Handler) Update(c echo.Context) error {
if bErr := c.Bind(&req); bErr != nil {
return echo.NewHTTPError(http.StatusBadRequest)
}
if fieldErrors, err := h.adminKindBoxReqVld.ValidateAdminUpdateRequest(c, req); err != nil {
if fieldErrors, err := h.adminKindBoxReqVld.ValidateUpdateRequest(req); err != nil {
msg, code := httpmsg.Error(err)
return c.JSON(code, echo.Map{
"message": msg,
"errors": fieldErrors,
})
}
resp, sErr := h.adminKindBoxReqSvc.Update(c, req)
resp, sErr := h.adminKindBoxReqSvc.Update(c.Request().Context(), req)
if sErr != nil {
msg, code := httpmsg.Error(sErr)
return echo.NewHTTPError(code, msg)
}

View File

@ -1,30 +0,0 @@
package benefactorkindboxhandler
import (
"net/http"
httpmsg "git.gocasts.ir/ebhomengo/niki/param/benefactor/kind_box"
param "git.gocasts.ir/ebhomengo/niki/param/benefactor/kind_box"
"github.com/labstack/echo/v4"
)
func (h Handler) Add(c echo.Context) error {
var req param.KindBoxAddRequest
if bErr := c.Bind(&req); bErr != nil {
return echo.NewHTTPError(http.StatusBadRequest)
}
if fieldErrors, err := h.benefactorKindBoxVld.ValidateBenefactorAddRequest(c, req); err != nil {
msg, code := httpmsg.Error(err)
return c.JSON(code, echo.Map{
"message": msg,
"errors": fieldErrors,
})
}
resp, sErr := h.benefactorKindBoxSvc.Add(c, req)
if sErr != nil {
msg, code := httpmsg.Error(sErr)
return echo.NewHTTPError(code, msg)
}
return c.JSON(http.StatusCreated, resp)
}

View File

@ -3,9 +3,9 @@ package benefactorkindboxhandler
import (
"net/http"
httpmsg "git.gocasts.ir/ebhomengo/niki/param/benefactor/kind_box"
param "git.gocasts.ir/ebhomengo/niki/param/benefactor/kind_box"
"github.com/labstack/echo/v4"
httpmsg "git.gocasts.ir/ebhomengo/niki/pkg/http_msg"
echo "github.com/labstack/echo/v4"
)
func (h Handler) Get(c echo.Context) error {
@ -13,16 +13,18 @@ func (h Handler) Get(c echo.Context) error {
if bErr := c.Bind(&req); bErr != nil {
return echo.NewHTTPError(http.StatusBadRequest)
}
if fieldErrors, err := h.benefactorKindBoxVld.ValidateBenefactorGetRequest(c, req); err != nil {
if fieldErrors, err := h.benefactorKindBoxVld.ValidateGetRequest(req); err != nil {
msg, code := httpmsg.Error(err)
return c.JSON(code, echo.Map{
"message": msg,
"errors": fieldErrors,
})
}
resp, sErr := h.benefactorKindBoxSvc.Get(c, req)
resp, sErr := h.benefactorKindBoxSvc.Get(c.Request().Context(), req)
if sErr != nil {
msg, code := httpmsg.Error(sErr)
return echo.NewHTTPError(code, msg)
}

View File

@ -3,9 +3,9 @@ package benefactorkindboxhandler
import (
"net/http"
httpmsg "git.gocasts.ir/ebhomengo/niki/param/benefactor/kind_box"
param "git.gocasts.ir/ebhomengo/niki/param/benefactor/kind_box"
"github.com/labstack/echo/v4"
httpmsg "git.gocasts.ir/ebhomengo/niki/pkg/http_msg"
echo "github.com/labstack/echo/v4"
)
func (h Handler) GetAll(c echo.Context) error {
@ -14,9 +14,10 @@ func (h Handler) GetAll(c echo.Context) error {
return echo.NewHTTPError(http.StatusBadRequest)
}
resp, sErr := h.benefactorKindBoxSvc.GetAll(c, req)
resp, sErr := h.benefactorKindBoxSvc.GetAll(c.Request().Context(), req)
if sErr != nil {
msg, code := httpmsg.Error(sErr)
return echo.NewHTTPError(code, msg)
}

View File

@ -1,15 +1,12 @@
package benefactorkindboxhandler
import (
"github.com/labstack/echo/v4"
echo "github.com/labstack/echo/v4"
)
func (h Handler) SetRoutes(e *echo.Echo) {
r := e.Group("/benefactor/kindboxes")
r.POST("/").Name = "benefactor-addkindbox"
r.GET("/:id").Name = "benefactor-getkindboxbyid"
r.GET("/").Name = "benefactor-getallkindbox"
r.PUT("/:id").Name = "benefactor-updatekindbox"
// r.DELETE("/:id").Name = "benefactor-deletekindbox"
r.GET("/:id", h.Get).Name = "benefactor-getkindboxbyid"
r.GET("/", h.GetAll).Name = "benefactor-getallkindbox"
}

View File

@ -1,30 +0,0 @@
package benefactorkindboxhandler
import (
"net/http"
httpmsg "git.gocasts.ir/ebhomengo/niki/param/benefactor/kind_box"
param "git.gocasts.ir/ebhomengo/niki/param/benefactor/kind_box"
"github.com/labstack/echo/v4"
)
func (h Handler) Update(c echo.Context) error {
var req param.KindBoxUpdateRequest
if bErr := c.Bind(&req); bErr != nil {
return echo.NewHTTPError(http.StatusBadRequest)
}
if fieldErrors, err := h.benefactorKindBoxVld.ValidateBenefactorUpdateRequest(c, req); err != nil {
msg, code := httpmsg.Error(err)
return c.JSON(code, echo.Map{
"message": msg,
"errors": fieldErrors,
})
}
resp, sErr := h.benefactorKindBoxSvc.Update(c, req)
if sErr != nil {
msg, code := httpmsg.Error(sErr)
return echo.NewHTTPError(code, msg)
}
return c.JSON(http.StatusCreated, resp)
}

View File

@ -3,9 +3,9 @@ package benefactorkindboxreqhandler
import (
"net/http"
httpmsg "git.gocasts.ir/ebhomengo/niki/param/benefactor/kind_box_req"
param "git.gocasts.ir/ebhomengo/niki/param/benefactor/kind_box_req"
"github.com/labstack/echo/v4"
httpmsg "git.gocasts.ir/ebhomengo/niki/pkg/http_msg"
echo "github.com/labstack/echo/v4"
)
func (h Handler) Add(c echo.Context) error {
@ -13,16 +13,18 @@ func (h Handler) Add(c echo.Context) error {
if bErr := c.Bind(&req); bErr != nil {
return echo.NewHTTPError(http.StatusBadRequest)
}
if fieldErrors, err := h.benefactorKindBoxReqVld.ValidateBenefactorAddRequest(c, req); err != nil {
if fieldErrors, err := h.benefactorKindBoxReqVld.ValidateAddRequest(req); err != nil {
msg, code := httpmsg.Error(err)
return c.JSON(code, echo.Map{
"message": msg,
"errors": fieldErrors,
})
}
resp, sErr := h.benefactorKindBoxReqSvc.Add(c, req)
resp, sErr := h.benefactorKindBoxReqSvc.Add(c.Request().Context(), req)
if sErr != nil {
msg, code := httpmsg.Error(sErr)
return echo.NewHTTPError(code, msg)
}

View File

@ -3,9 +3,9 @@ package benefactorkindboxreqhandler
import (
"net/http"
httpmsg "git.gocasts.ir/ebhomengo/niki/param/benefactor/kind_box_req"
param "git.gocasts.ir/ebhomengo/niki/param/benefactor/kind_box_req"
"github.com/labstack/echo/v4"
httpmsg "git.gocasts.ir/ebhomengo/niki/pkg/http_msg"
echo "github.com/labstack/echo/v4"
)
func (h Handler) Get(c echo.Context) error {
@ -13,16 +13,18 @@ func (h Handler) Get(c echo.Context) error {
if bErr := c.Bind(&req); bErr != nil {
return echo.NewHTTPError(http.StatusBadRequest)
}
if fieldErrors, err := h.benefactorKindBoxReqVld.ValidateBenefactorGetRequest(c, req); err != nil {
if fieldErrors, err := h.benefactorKindBoxReqVld.ValidateGetRequest(req); err != nil {
msg, code := httpmsg.Error(err)
return c.JSON(code, echo.Map{
"message": msg,
"errors": fieldErrors,
})
}
resp, sErr := h.benefactorKindBoxReqSvc.Get(c, req)
resp, sErr := h.benefactorKindBoxReqSvc.Get(c.Request().Context(), req)
if sErr != nil {
msg, code := httpmsg.Error(sErr)
return echo.NewHTTPError(code, msg)
}

View File

@ -3,9 +3,9 @@ package benefactorkindboxreqhandler
import (
"net/http"
httpmsg "git.gocasts.ir/ebhomengo/niki/param/benefactor/kind_box_req"
param "git.gocasts.ir/ebhomengo/niki/param/benefactor/kind_box_req"
"github.com/labstack/echo/v4"
httpmsg "git.gocasts.ir/ebhomengo/niki/pkg/http_msg"
echo "github.com/labstack/echo/v4"
)
func (h Handler) GetAll(c echo.Context) error {
@ -14,9 +14,10 @@ func (h Handler) GetAll(c echo.Context) error {
return echo.NewHTTPError(http.StatusBadRequest)
}
resp, sErr := h.benefactorKindBoxReqSvc.GetAll(c, req)
resp, sErr := h.benefactorKindBoxReqSvc.GetAll(c.Request().Context(), req)
if sErr != nil {
msg, code := httpmsg.Error(sErr)
return echo.NewHTTPError(code, msg)
}

View File

@ -14,7 +14,7 @@ type Handler struct {
}
func New(authConfig authservice.Config, authSvc authservice.Service,
benefactorKindBoxReqSvc benefactorkindboxreqservice.Service, benefactorKindBoxReqVld benefactorkindboxvalidator.Validator,
benefactorKindBoxReqSvc benefactorkindboxreqservice.Service, benefactorKindBoxReqVld benefactorkindboxreqvalidator.Validator,
) Handler {
return Handler{
authConfig: authConfig,

View File

@ -1,15 +1,14 @@
package benefactorkindboxreqhandler
import (
"github.com/labstack/echo/v4"
echo "github.com/labstack/echo/v4"
)
func (h Handler) SetRoutes(e *echo.Echo) {
r := e.Group("/benefactor/kindboxreqs")
r.POST("/").Name = "benefactor-addkindboxreq"
r.GET("/:id").Name = "benefactor-get-kindboxreqbyid"
r.GET("/").Name = "benefactor-getallkindboxreq"
r.PUT("/:id").Name = "benefactor-updatekindboxreq"
// r.DELETE("/:id").Name = "benefactor-deletekindreqbox"
r.POST("/", h.Add).Name = "benefactor-addkindboxreq"
r.GET("/:id", h.Get).Name = "benefactor-get-kindboxreqbyid"
r.GET("/", h.GetAll).Name = "benefactor-getallkindboxreq"
r.PUT("/:id", h.Update).Name = "benefactor-updatekindboxreq"
}

View File

@ -3,9 +3,9 @@ package benefactorkindboxreqhandler
import (
"net/http"
httpmsg "git.gocasts.ir/ebhomengo/niki/param/benefactor/kind_box_req"
param "git.gocasts.ir/ebhomengo/niki/param/benefactor/kind_box_req"
"github.com/labstack/echo/v4"
httpmsg "git.gocasts.ir/ebhomengo/niki/pkg/http_msg"
echo "github.com/labstack/echo/v4"
)
func (h Handler) Update(c echo.Context) error {
@ -13,16 +13,18 @@ func (h Handler) Update(c echo.Context) error {
if bErr := c.Bind(&req); bErr != nil {
return echo.NewHTTPError(http.StatusBadRequest)
}
if fieldErrors, err := h.benefactorKindBoxReqVld.ValidateBenefactorUpdateRequest(c, req); err != nil {
if fieldErrors, err := h.benefactorKindBoxReqVld.ValidateUpdateRequest(req); err != nil {
msg, code := httpmsg.Error(err)
return c.JSON(code, echo.Map{
"message": msg,
"errors": fieldErrors,
})
}
resp, sErr := h.benefactorKindBoxReqSvc.Update(c, req)
resp, sErr := h.benefactorKindBoxReqSvc.Update(c.Request().Context(), req)
if sErr != nil {
msg, code := httpmsg.Error(sErr)
return echo.NewHTTPError(code, msg)
}

View File

@ -3,7 +3,7 @@ package httpserver
import (
"net/http"
"github.com/labstack/echo/v4"
echo "github.com/labstack/echo/v4"
)
func (s Server) healthCheck(c echo.Context) error {

View File

@ -3,9 +3,9 @@ package httpserver
import (
"fmt"
"git.gocasts.ir/ebhomengo/niki/config"
"github.com/labstack/echo/v4"
"github.com/labstack/echo/v4/middleware"
config "git.gocasts.ir/ebhomengo/niki/config"
echo "github.com/labstack/echo/v4"
middleware "github.com/labstack/echo/v4/middleware"
)
type Server struct {
@ -13,7 +13,7 @@ type Server struct {
Router *echo.Echo
}
func New(cfg Config) Server {
func New(cfg config.Config) Server {
return Server{
Router: echo.New(),
config: cfg,

18
entity/admin.go Normal file
View File

@ -0,0 +1,18 @@
package entity
import "time"
type Admin struct {
ID uint
FirstName string
LastName string
PhoneNumber string
Address string
Description string
Email string
City string
Gender UserGender
Status BenefactorStatus
Birthday time.Time
StatusChangedAt time.Time
}

38
entity/admin_status.go Normal file
View File

@ -0,0 +1,38 @@
package entity
type AdminStatus uint
const (
AdminActiveStatus AdminStatus = iota + 1
AdminDeactiveStatus
)
var AdminStatusStrings = map[AdminStatus]string{
AdminActiveStatus: "active",
AdminDeactiveStatus: "deactive",
}
func (s AdminStatus) String() string {
return AdminStatusStrings[s]
}
// AllAdminStatus returns a slice containing all string values of AdminStatus.
func AllAdminStatus() []string {
statusStrings := make([]string, len(AdminStatusStrings))
for status, str := range AdminStatusStrings {
statusStrings[int(status)-1] = str
}
return statusStrings
}
// MapToAdminStatus converts a string to the corresponding AdminStatus value.
func MapToAdminStatus(statusStr string) AdminStatus {
for status, str := range AdminStatusStrings {
if str == statusStr {
return status
}
}
return AdminStatus(0)
}

18
entity/benefactor.go Normal file
View File

@ -0,0 +1,18 @@
package entity
import "time"
type Benefactor struct {
ID uint
FirstName string
LastName string
PhoneNumber string
Address string
Description string
Email string
City string
Gender UserGender
Status BenefactorStatus
Birthday time.Time
StatusChangedAt time.Time
}

View File

@ -0,0 +1,38 @@
package entity
type BenefactorStatus uint
const (
BenefactorActiveStatus BenefactorStatus = iota + 1
BenefactorDeactiveStatus
)
var BenefactorStatusStrings = map[BenefactorStatus]string{
BenefactorActiveStatus: "active",
BenefactorDeactiveStatus: "deactive",
}
func (s BenefactorStatus) String() string {
return BenefactorStatusStrings[s]
}
// AllBenefactorStatus returns a slice containing all string values of BenefactorStatus.
func AllBenefactorStatus() []string {
statusStrings := make([]string, len(BenefactorStatusStrings))
for status, str := range BenefactorStatusStrings {
statusStrings[int(status)-1] = str
}
return statusStrings
}
// MapToBenefactorStatus converts a string to the corresponding BenefactorStatus value.
func MapToBenefactorStatus(statusStr string) BenefactorStatus {
for status, str := range BenefactorStatusStrings {
if str == statusStr {
return status
}
}
return BenefactorStatus(0)
}

View File

@ -8,21 +8,20 @@ const (
KindBoxReqRejectedStatus
)
const (
kindBoxReqPendingStatusStr = "pending"
kindBoxReqAcceptedStatusStr = "accepted"
kindBoxReqRejectedStatusStr = "rejected"
)
var kindBoxReqStatusStrings = map[KindBoxReqStatus]string{
KindBoxReqPendingStatus: "pending",
KindBoxReqAcceptedStatus: "accepted",
KindBoxReqRejectedStatus: "rejected",
}
func (s KindBoxReqStatus) String() string {
return KindBoxReqStatusStrings[s]
return kindBoxReqStatusStrings[s]
}
// AllKindBoxReqStatus returns a slice containing all string values of KindBoxReqStatus.
func AllKindBoxReqStatus() []string {
statusStrings := make([]string, len(KindBoxReqStatusStrings))
for status, str := range KindBoxReqStatusStrings {
statusStrings := make([]string, len(kindBoxStatusStrings))
for status, str := range kindBoxReqStatusStrings {
statusStrings[int(status)-1] = str
}
@ -31,7 +30,7 @@ func AllKindBoxReqStatus() []string {
// MapToKindBoxReqStatus converts a string to the corresponding KindBoxReqStatus value.
func MapToKindBoxReqStatus(statusStr string) KindBoxReqStatus {
for status, str := range KindBoxReqStatusStrings {
for status, str := range kindBoxReqStatusStrings {
if str == statusStr {
return status
}

44
entity/kind_box_type.go Normal file
View File

@ -0,0 +1,44 @@
package entity
type KindBoxType uint
// const (
// KindBoxPendingSendStatus KindBoxType = iota + 1
// KindBoxSentStatus
// KindBoxPendingReceivedStatus
// KindBoxReceivedStatus
// KindBoxEnumeratedStatus
// )
var KindBoxTypeStrings = map[KindBoxType]string{
// KindBoxPendingSendStatus: "pending-send",
// KindBoxSentStatus: "sent",
// KindBoxPendingReceivedStatus: "pending-received",
// KindBoxReceivedStatus: "received",
// KindBoxEnumeratedStatus: "enumerated",
}
func (s KindBoxType) String() string {
return KindBoxTypeStrings[s]
}
// AllKindBoxType returns a slice containing all string values of KindBoxType.
func AllKindBoxType() []string {
statusStrings := make([]string, len(KindBoxTypeStrings))
for status, str := range KindBoxTypeStrings {
statusStrings[int(status)-1] = str
}
return statusStrings
}
// MapToKindBoxType converts a string to the corresponding KindBoxType value.
func MapToKindBoxType(statusStr string) KindBoxType {
for status, str := range KindBoxTypeStrings {
if str == statusStr {
return status
}
}
return KindBoxType(0)
}

38
entity/user_gender.go Normal file
View File

@ -0,0 +1,38 @@
package entity
type UserGender uint
const (
UserMaleGender UserGender = iota + 1
UserFemaleGender
)
var UserGenderStrings = map[UserGender]string{
UserMaleGender: "male",
UserFemaleGender: "female",
}
func (s UserGender) String() string {
return UserGenderStrings[s]
}
// AllUserGender returns a slice containing all string values of UserGender.
func AllUserGender() []string {
statusStrings := make([]string, len(UserGenderStrings))
for status, str := range UserGenderStrings {
statusStrings[int(status)-1] = str
}
return statusStrings
}
// MapToUserGender converts a string to the corresponding UserGender value.
func MapToUserGender(statusStr string) UserGender {
for status, str := range UserGenderStrings {
if str == statusStr {
return status
}
}
return UserGender(0)
}

13
go.mod
View File

@ -6,6 +6,7 @@ require (
github.com/go-ozzo/ozzo-validation v3.6.0+incompatible
github.com/go-ozzo/ozzo-validation/v4 v4.3.0
github.com/knadh/koanf v1.5.0
github.com/labstack/echo/v4 v4.11.4
gopkg.in/natefinch/lumberjack.v2 v2.2.1
)
@ -13,9 +14,19 @@ require (
github.com/asaskevich/govalidator v0.0.0-20200108200545-475eaeb16496 // indirect
github.com/fatih/structs v1.1.0 // indirect
github.com/fsnotify/fsnotify v1.4.9 // indirect
github.com/golang-jwt/jwt v3.2.2+incompatible // indirect
github.com/labstack/gommon v0.4.2 // indirect
github.com/mattn/go-colorable v0.1.13 // indirect
github.com/mattn/go-isatty v0.0.20 // indirect
github.com/mitchellh/copystructure v1.2.0 // indirect
github.com/mitchellh/mapstructure v1.5.0 // indirect
github.com/mitchellh/reflectwalk v1.0.2 // indirect
golang.org/x/sys v0.0.0-20210603081109-ebe580a85c40 // indirect
github.com/valyala/bytebufferpool v1.0.0 // indirect
github.com/valyala/fasttemplate v1.2.2 // indirect
golang.org/x/crypto v0.17.0 // indirect
golang.org/x/net v0.19.0 // indirect
golang.org/x/sys v0.15.0 // indirect
golang.org/x/text v0.14.0 // indirect
golang.org/x/time v0.5.0 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
)

31
go.sum
View File

@ -66,6 +66,8 @@ github.com/go-test/deep v1.0.2-0.20181118220953-042da051cf31/go.mod h1:wGDj63lr6
github.com/godbus/dbus/v5 v5.0.4/go.mod h1:xhWf0FNVPg57R7Z0UbKHbJfkEywrmjJnf7w5xrFpKfA=
github.com/gogo/protobuf v1.1.1/go.mod h1:r8qH/GZQm5c6nD/R0oafs1akxWv10x8SbQlK7atdtwQ=
github.com/gogo/protobuf v1.3.2/go.mod h1:P1XiOD3dCwIKUDQYPy72D8LYyHL2YPYrpS2s69NZV8Q=
github.com/golang-jwt/jwt v3.2.2+incompatible h1:IfV12K8xAKAnZqdXVzCZ+TOjboZ2keLg81eXfW3O+oY=
github.com/golang-jwt/jwt v3.2.2+incompatible/go.mod h1:8pz2t5EyA70fFQQSrl6XZXzqecmYZeUEB8OUGHkxJ+I=
github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q=
github.com/golang/mock v1.1.1/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A=
github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U=
@ -156,14 +158,23 @@ github.com/kr/pretty v0.2.0/go.mod h1:ipq/a2n7PKx3OHsz4KJII5eveXtPO4qwEXGdVfWzfn
github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ=
github.com/kr/text v0.1.0 h1:45sCR5RtlFHMR4UwH9sdQ5TC8v0qDQCHnXt+kaKSTVE=
github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI=
github.com/labstack/echo/v4 v4.11.4 h1:vDZmA+qNeh1pd/cCkEicDMrjtrnMGQ1QFI9gWN1zGq8=
github.com/labstack/echo/v4 v4.11.4/go.mod h1:noh7EvLwqDsmh/X/HWKPUl1AjzJrhyptRyEbQJfxen8=
github.com/labstack/gommon v0.4.2 h1:F8qTUNXgG1+6WQmqoUWnz8WiEU60mXVVw0P4ht1WRA0=
github.com/labstack/gommon v0.4.2/go.mod h1:QlUFxVM+SNXhDL/Z7YhocGIBYOiwB0mXm1+1bAPHPyU=
github.com/mattn/go-colorable v0.0.9/go.mod h1:9vuHe8Xs5qXnSaW/c/ABM9alt+Vo+STaOChaDxuIBZU=
github.com/mattn/go-colorable v0.1.4/go.mod h1:U0ppj6V5qS13XJ6of8GYAs25YV2eR4EVcfRqFIhoBtE=
github.com/mattn/go-colorable v0.1.6/go.mod h1:u6P/XSegPjTcexA+o6vUJrdnUu04hMope9wVRipJSqc=
github.com/mattn/go-colorable v0.1.13 h1:fFA4WZxdEF4tXPZVKMLwD8oUnCTTo08duU7wxecdEvA=
github.com/mattn/go-colorable v0.1.13/go.mod h1:7S9/ev0klgBDR4GtXTXX8a3vIGJpMovkB8vQcUbaXHg=
github.com/mattn/go-isatty v0.0.3/go.mod h1:M+lRXTBqGeGNdLjl/ufCoiOlB5xdOkqRJdNxMWT7Zi4=
github.com/mattn/go-isatty v0.0.8/go.mod h1:Iq45c/XA43vh69/j3iqttzPXn0bhXyGjM0Hdxcsrc5s=
github.com/mattn/go-isatty v0.0.10/go.mod h1:qgIWMr58cqv1PHHyhnkY9lrL7etaEgOFcMEpPG5Rm84=
github.com/mattn/go-isatty v0.0.11/go.mod h1:PhnuNfih5lzO57/f3n+odYbM4JtupLOxQOAqxQCu2WE=
github.com/mattn/go-isatty v0.0.12/go.mod h1:cbi8OIDigv2wuxKPP5vlRcQ1OAZbq2CE4Kysco4FUpU=
github.com/mattn/go-isatty v0.0.16/go.mod h1:kYGgaQfpe5nmfYZH+SKPsOc2e4SrIfOl2e/yFXSvRLM=
github.com/mattn/go-isatty v0.0.20 h1:xfD0iDuEKnDkl03q4limB+vH+GxLEtL/jb4xVJSWWEY=
github.com/mattn/go-isatty v0.0.20/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y=
github.com/matttproud/golang_protobuf_extensions v1.0.1/go.mod h1:D8He9yQNgCq6Z5Ld7szi9bcBfOoFv/3dc6xSMkL2PC0=
github.com/miekg/dns v1.1.26/go.mod h1:bPDLeHnStXmXAq1m/Ch/hvfNHr14JKNPMBo3VZKjuso=
github.com/miekg/dns v1.1.41/go.mod h1:p6aan82bvRIyn+zDIv9xYNUpwa73JcSh9BKwknJysuI=
@ -235,8 +246,13 @@ github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXf
github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI=
github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4=
github.com/stretchr/testify v1.5.1/go.mod h1:5W2xD1RspED5o8YsWQXVCued0rvSQ+mT+I5cxcmMvtA=
github.com/stretchr/testify v1.7.0 h1:nwc3DEeHmmLAfoZucVR881uASk0Mfjw8xYJ99tb5CcY=
github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcUk=
github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo=
github.com/valyala/bytebufferpool v1.0.0 h1:GqA5TC/0021Y/b9FG4Oi9Mr3q7XYx6KllzawFIhcdPw=
github.com/valyala/bytebufferpool v1.0.0/go.mod h1:6bBcMArwyJ5K/AmCkWv1jt77kVWyCJ6HpOuEn7z0Csc=
github.com/valyala/fasttemplate v1.2.2 h1:lxLXG0uE3Qnshl9QyaK6XJxMXlQZELvChBOCmQD0Loo=
github.com/valyala/fasttemplate v1.2.2/go.mod h1:KHLXt3tVN2HBp8eijSv/kGJopbvo7S+qRAEEKiv+SiQ=
github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74=
github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74=
github.com/yuin/goldmark v1.3.5/go.mod h1:mwnBkeHKe2W/ZEtQ+71ViKU8L12m81fl3OWwC1Zlc8k=
@ -251,6 +267,8 @@ golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACk
golang.org/x/crypto v0.0.0-20190923035154-9ee001bba392/go.mod h1:/lpIB1dKB+9EgE3H3cr1v9wB50oz8l4C4h62xy7jSTY=
golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI=
golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto=
golang.org/x/crypto v0.17.0 h1:r8bRNjWL3GshPW3gkd+RpvzWrZAwPS49OmTGZ/uhM4k=
golang.org/x/crypto v0.17.0/go.mod h1:gCAAfMLgwOJRpTjQ2zCCt2OcSfYMTeZVSRtQlPC7Nq4=
golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA=
golang.org/x/lint v0.0.0-20181026193005-c67002cb31c3/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE=
golang.org/x/lint v0.0.0-20190227174305-5b3e6a55c961/go.mod h1:wehouNa3lNwaWXcvxsM5YxQ5yQlVC4a0KAMCusXpPoU=
@ -277,6 +295,8 @@ golang.org/x/net v0.0.0-20201021035429-f5854403a974/go.mod h1:sp8m0HH+o8qH0wwXwY
golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg=
golang.org/x/net v0.0.0-20210405180319-a5a99cb37ef4/go.mod h1:p54w0d4576C0XHj96bSt6lcn1PtDYWL6XObtHCRCNQM=
golang.org/x/net v0.0.0-20210410081132-afb366fc7cd1/go.mod h1:9tjilg8BloeKEkVJvy7fQ90B1CfIiPueXVOjqfkSzI8=
golang.org/x/net v0.19.0 h1:zTwKpTd2XuCqf8huc7Fo2iSy+4RHPd10s4KzeTnVr1c=
golang.org/x/net v0.19.0/go.mod h1:CfAk/cbD4CthTvqiEl8NpboMuiuOYsAr/7NOjZJtv1U=
golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U=
golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw=
golang.org/x/oauth2 v0.0.0-20200107190931-bf48bf16ab8d/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw=
@ -318,8 +338,11 @@ golang.org/x/sys v0.0.0-20210303074136-134d130e1a04/go.mod h1:h1NjWce9XRLGQEsW7w
golang.org/x/sys v0.0.0-20210330210617-4fbd30eecc44/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20210403161142-5e06dd20ab57/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20210510120138-977fb7262007/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20210603081109-ebe580a85c40 h1:JWgyZ1qgdTaF3N3oxC+MdTV7qvEEgHo3otj+HB5CM7Q=
golang.org/x/sys v0.0.0-20210603081109-ebe580a85c40/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20220811171246-fbc7d0a398ab/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.15.0 h1:h48lPFYpsTvQJZF4EKyI4aLHaev3CxivZmv7yZig9pc=
golang.org/x/sys v0.15.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
golang.org/x/text v0.3.1-0.20181227161524-e6919f6577db/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk=
@ -327,7 +350,11 @@ golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk=
golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
golang.org/x/text v0.3.5/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
golang.org/x/text v0.14.0 h1:ScX5w1eTa3QqT8oi6+ziP7dTV1S2+ALU0bI+0zXKWiQ=
golang.org/x/text v0.14.0/go.mod h1:18ZOQIKpY8NJVqYksKHtTdi31H5itFRjB5/qKTNYzSU=
golang.org/x/time v0.0.0-20190308202827-9d24e82272b4/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ=
golang.org/x/time v0.5.0 h1:o7cqy6amK/52YcAKIPlM3a+Fpj35zvRj2TP+e1xFSfk=
golang.org/x/time v0.5.0/go.mod h1:3BpzKBy/shNhVucY/MWOyx10tF3SFh9QdLuxbVysPQM=
golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
golang.org/x/tools v0.0.0-20190114222345-bf090417da8b/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
golang.org/x/tools v0.0.0-20190226205152-f727befe758c/go.mod h1:9Yl7xja0Znq3iFh3HoIrodX9oNMXvdceNzlUR8zjMvY=

View File

@ -3,7 +3,7 @@ package adminkindboxservice
import (
"context"
param "git.gocasts.ir/ebhomengo/niki/param/benefactor/kind_box"
param "git.gocasts.ir/ebhomengo/niki/param/admin/kind_box"
richerror "git.gocasts.ir/ebhomengo/niki/pkg/rich_error"
)

23
service/auth/service.go Normal file
View File

@ -0,0 +1,23 @@
package authservice
import (
"time"
)
type Config struct {
SignKey string `koanf:"sign_key"`
AccessExpirationTime time.Duration `koanf:"access_expiration_time"`
RefreshExpirationTime time.Duration `koanf:"refresh_expiration_time"`
AccessSubject string `koanf:"access_subject"`
RefreshSubject string `koanf:"refresh_subject"`
}
type Service struct {
config Config
}
func New(cfg Config) Service {
return Service{
config: cfg,
}
}

View File

@ -1,7 +1,6 @@
package adminkindboxvalidator
import (
"context"
"errors"
param "git.gocasts.ir/ebhomengo/niki/param/admin/kind_box"
@ -11,7 +10,7 @@ import (
validation "github.com/go-ozzo/ozzo-validation/v4"
)
func (v Validator) ValidateAdminAddRequest(ctx context.Context, req param.KindBoxAddRequest) (map[string]string, error) {
func (v Validator) ValidateAddRequest(req param.KindBoxAddRequest) (map[string]string, error) {
const op = "adminkindboxvalidator.KindBoxAddRequest"
if err := validation.ValidateStruct(&req,

View File

@ -1,7 +1,6 @@
package adminkindboxvalidator
import (
"context"
"errors"
param "git.gocasts.ir/ebhomengo/niki/param/admin/kind_box"
@ -10,7 +9,7 @@ import (
validation "github.com/go-ozzo/ozzo-validation/v4"
)
func (v Validator) ValidateDeleteRequest(ctx context.Context, req param.KindBoxDeleteRequest) (map[string]string, error) {
func (v Validator) ValidateDeleteRequest(req param.KindBoxDeleteRequest) (map[string]string, error) {
const op = "adminkindboxvalidator.ValidateDeleteRequest"
if err := validation.ValidateStruct(&req,

View File

@ -1,7 +1,6 @@
package adminkindboxvalidator
import (
"context"
"errors"
param "git.gocasts.ir/ebhomengo/niki/param/admin/kind_box"
@ -10,7 +9,7 @@ import (
validation "github.com/go-ozzo/ozzo-validation/v4"
)
func (v Validator) ValidateGetByIDRequest(ctx context.Context, req param.KindBoxGetRequest) (map[string]string, error) {
func (v Validator) ValidateGetRequest(req param.KindBoxGetRequest) (map[string]string, error) {
const op = "adminkindboxvalidator.ValidateGetRequest"
if err := validation.ValidateStruct(&req,

View File

@ -11,7 +11,7 @@ import (
validation "github.com/go-ozzo/ozzo-validation/v4"
)
func (v Validator) ValidateUpdateRequest(ctx context.Context, req param.KindBoxUpdateRequest) (map[string]string, error) {
func (v Validator) ValidateUpdateRequest(req param.KindBoxUpdateRequest) (map[string]string, error) {
const op = "adminkindboxvalidator.ValidateUpdateRequest"
if err := validation.ValidateStruct(&req,

View File

@ -1,7 +1,6 @@
package adminkindboxreqvalidator
import (
"context"
"errors"
param "git.gocasts.ir/ebhomengo/niki/param/admin/kind_box_req"
@ -10,7 +9,7 @@ import (
validation "github.com/go-ozzo/ozzo-validation/v4"
)
func (v Validator) ValidateAddRequest(ctx context.Context, req param.KindBoxReqAddRequest) (map[string]string, error) {
func (v Validator) ValidateAddRequest(req param.KindBoxReqAddRequest) (map[string]string, error) {
const op = "adminkindboxreqvalidator.ValidateAddRequest"
if err := validation.ValidateStruct(&req,

View File

@ -1,7 +1,6 @@
package adminkindboxreqvalidator
import (
"context"
"errors"
param "git.gocasts.ir/ebhomengo/niki/param/admin/kind_box_req"
@ -10,7 +9,7 @@ import (
validation "github.com/go-ozzo/ozzo-validation/v4"
)
func (v Validator) ValidateDeleteRequest(ctx context.Context, req param.KindBoxReqDeleteRequest) (map[string]string, error) {
func (v Validator) ValidateDeleteRequest(req param.KindBoxReqDeleteRequest) (map[string]string, error) {
const op = "adminkindboxreqvalidator.ValidateDeleteRequest"
if err := validation.ValidateStruct(&req,

View File

@ -1,7 +1,6 @@
package adminkindboxreqvalidator
import (
"context"
"errors"
param "git.gocasts.ir/ebhomengo/niki/param/admin/kind_box_req"
@ -10,7 +9,7 @@ import (
validation "github.com/go-ozzo/ozzo-validation/v4"
)
func (v Validator) ValidateGetByIDRequest(ctx context.Context, req param.KindBoxReqGetRequest) (map[string]string, error) {
func (v Validator) ValidateGetRequest(req param.KindBoxReqGetRequest) (map[string]string, error) {
const op = "adminkindboxreqvalidator.ValidateGetRequest"
if err := validation.ValidateStruct(&req,

View File

@ -1,7 +1,6 @@
package adminkindboxreqvalidator
import (
"context"
"errors"
param "git.gocasts.ir/ebhomengo/niki/param/admin/kind_box_req"
@ -10,7 +9,7 @@ import (
validation "github.com/go-ozzo/ozzo-validation/v4"
)
func (v Validator) ValidateUpdateRequest(ctx context.Context, req param.KindBoxReqUpdateRequest) (map[string]string, error) {
func (v Validator) ValidateUpdateRequest(req param.KindBoxReqUpdateRequest) (map[string]string, error) {
const op = "adminkindboxreqvalidator.ValidateUpdateRequest"
if err := validation.ValidateStruct(&req,

View File

@ -1,7 +1,6 @@
package benefactorkindboxvalidator
import (
"context"
"errors"
param "git.gocasts.ir/ebhomengo/niki/param/benefactor/kind_box"
@ -10,7 +9,7 @@ import (
validation "github.com/go-ozzo/ozzo-validation/v4"
)
func (v Validator) ValidateGetByIDRequest(ctx context.Context, req param.KindBoxGetRequest) (map[string]string, error) {
func (v Validator) ValidateGetRequest(req param.KindBoxGetRequest) (map[string]string, error) {
const op = "userkindboxvalidator.ValidateGetRequest"
if err := validation.ValidateStruct(&req,

View File

@ -1,7 +1,6 @@
package benefactorkindboxvalidator
import (
"context"
"errors"
param "git.gocasts.ir/ebhomengo/niki/param/benefactor/kind_box"
@ -10,7 +9,7 @@ import (
validation "github.com/go-ozzo/ozzo-validation/v4"
)
func (v Validator) ValidateUpdateRequest(ctx context.Context, req param.KindBoxGetAllRequest) (map[string]string, error) {
func (v Validator) ValidateUpdateRequest(req param.KindBoxGetAllRequest) (map[string]string, error) {
const op = "userkindboxvalidator.ValidateGetAllRequest"
if err := validation.ValidateStruct(&req,

View File

@ -1,7 +1,6 @@
package benefactorkindboxreqvalidator
import (
"context"
"errors"
param "git.gocasts.ir/ebhomengo/niki/param/benefactor/kind_box_req"
@ -10,7 +9,7 @@ import (
validation "github.com/go-ozzo/ozzo-validation/v4"
)
func (v Validator) ValidateAddRequest(ctx context.Context, req param.KindBoxReqAddRequest) (map[string]string, error) {
func (v Validator) ValidateAddRequest(req param.KindBoxReqAddRequest) (map[string]string, error) {
const op = "userkindboxreqvalidator.ValidateAddRequest"
if err := validation.ValidateStruct(&req,

View File

@ -1,7 +1,6 @@
package benefactorkindboxreqvalidator
import (
"context"
"errors"
param "git.gocasts.ir/ebhomengo/niki/param/benefactor/kind_box_req"
@ -10,7 +9,7 @@ import (
validation "github.com/go-ozzo/ozzo-validation/v4"
)
func (v Validator) ValidateDeleteRequest(ctx context.Context, req param.KindBoxReqDeleteRequest) (map[string]string, error) {
func (v Validator) ValidateDeleteRequest(req param.KindBoxReqDeleteRequest) (map[string]string, error) {
const op = "userkindboxreqvalidator.ValidateDeleteRequest"
if err := validation.ValidateStruct(&req,

View File

@ -9,7 +9,7 @@ import (
validation "github.com/go-ozzo/ozzo-validation/v4"
)
func (v Validator) ValidateGetRequest(ctx context.Context, req param.KindBoxReqGetRequest) (map[string]string, error) {
func (v Validator) ValidateGetRequest(req param.KindBoxReqGetRequest) (map[string]string, error) {
const op = "userkindboxreqvalidator.ValidateGetRequest"
if err := validation.ValidateStruct(&req,

View File

@ -1,7 +1,6 @@
package benefactorkindboxreqvalidator
import (
"context"
"errors"
param "git.gocasts.ir/ebhomengo/niki/param/benefactor/kind_box_req"
@ -10,7 +9,7 @@ import (
validation "github.com/go-ozzo/ozzo-validation/v4"
)
func (v Validator) ValidateGetAllRequest(ctx context.Context, req param.KindBoxReqGetAllRequest) (map[string]string, error) {
func (v Validator) ValidateGetAllRequest(req param.KindBoxReqGetAllRequest) (map[string]string, error) {
const op = "userkindboxreqvalidator.ValidateGetAllRequest"
if err := validation.ValidateStruct(&req,

View File

@ -1,7 +1,6 @@
package benefactorkindboxreqvalidator
import (
"context"
"errors"
param "git.gocasts.ir/ebhomengo/niki/param/benefactor/kind_box_req"
@ -10,7 +9,7 @@ import (
validation "github.com/go-ozzo/ozzo-validation/v4"
)
func (v Validator) ValidateUpdateRequest(ctx context.Context, req param.KindBoxReqUpdateRequest) (map[string]string, error) {
func (v Validator) ValidateUpdateRequest(req param.KindBoxReqUpdateRequest) (map[string]string, error) {
const op = "userkindboxreqvalidator.ValidateUpdateRequest"
if err := validation.ValidateStruct(&req,