forked from ebhomengo/niki
1
0
Fork 0

fix linter errors

This commit is contained in:
Abolfazl Nourzad 2024-01-25 21:29:18 +03:30
parent 96eb93bb69
commit 6853ddaf64
Signed by: abolfazl
GPG Key ID: 183534166EB62E0B
10 changed files with 27 additions and 14 deletions

View File

@ -4,9 +4,8 @@ import (
echo "github.com/labstack/echo/v4"
)
func (h Handler) SetRoutes(e *echo.Echo) {
func (h Handler) SetRoutes(_ *echo.Echo) {
//nolint
// r.POST("/", h.Add).Name = "admin-addkindbox"
// r.GET("/:id", h.Get).Name = "admin-getkindboxbyid"
// r.GET("/", h.GetAll).Name = "admin-getallkindbox"

View File

@ -63,7 +63,6 @@ func setupServices(cfg config.Config) (
adminSvc adminservice.Service, adminVld adminvalidator.Validator,
adminAuthSvc adminauthservice.Service,
adminKindBoxReqSvc adminkindboxreqservice.Service, adminKindBoxReqVld adminkindboxreqvalidator.Validator,
) {
authSvc = authservice.New(cfg.Auth)

View File

@ -2,6 +2,7 @@ package mysqlkindbox
import (
"context"
"git.gocasts.ir/ebhomengo/niki/entity"
"git.gocasts.ir/ebhomengo/niki/logger"
errmsg "git.gocasts.ir/ebhomengo/niki/pkg/err_msg"

View File

@ -6,6 +6,7 @@ import (
"errors"
"git.gocasts.ir/ebhomengo/niki/entity"
"git.gocasts.ir/ebhomengo/niki/logger"
errmsg "git.gocasts.ir/ebhomengo/niki/pkg/err_msg"
richerror "git.gocasts.ir/ebhomengo/niki/pkg/rich_error"
)
@ -32,7 +33,11 @@ func (d DB) AcceptKindBoxReq(ctx context.Context, kindBoxReqID, countAccepted ui
op := richerror.Op("mysqlkindboxreq.AcceptKindBoxReq")
statement, err := d.conn.Conn().
Prepare(`update kind_box_reqs set count_accepted = ? , status = ? where id = ?`)
defer statement.Close()
defer func() {
dErr := statement.Close()
logger.L().Error(dErr.Error())
}()
if err != nil {
return richerror.New(op).WithErr(err).
WithMessage(errmsg.ErrorMsgSomethingWentWrong).WithKind(richerror.KindUnexpected)
@ -78,7 +83,10 @@ func (d DB) RejectKindBoxReq(ctx context.Context, kindBoxReqID uint, description
op := richerror.Op("mysqlkindboxreq.RejectKindBoxReq")
statement, err := d.conn.Conn().
Prepare(`update kind_box_reqs set description = ? , status = ? where id = ?`)
defer statement.Close()
defer func() {
dErr := statement.Close()
logger.L().Error(dErr.Error())
}()
if err != nil {
return richerror.New(op).WithErr(err).
WithMessage(errmsg.ErrorMsgSomethingWentWrong).WithKind(richerror.KindUnexpected)
@ -96,7 +104,10 @@ func (d DB) RollbackKindBoxRequestStatus(ctx context.Context, id uint) error {
op := richerror.Op("mysqlkindboxreq.RollbackKindBoxRequestStatus")
statement, err := d.conn.Conn().
Prepare(`update kind_box_reqs set status = ? where id = ?`)
defer statement.Close()
defer func() {
dErr := statement.Close()
logger.L().Error(dErr.Error())
}()
if err != nil {
return richerror.New(op).WithErr(err).
WithMessage(errmsg.ErrorMsgSomethingWentWrong).WithKind(richerror.KindUnexpected)
@ -106,5 +117,6 @@ func (d DB) RollbackKindBoxRequestStatus(ctx context.Context, id uint) error {
return richerror.New(op).WithErr(eErr).
WithMessage(errmsg.ErrorMsgSomethingWentWrong).WithKind(richerror.KindUnexpected)
}
return nil
}

View File

@ -2,6 +2,7 @@ package adminkindboxreqservice
import (
"context"
"git.gocasts.ir/ebhomengo/niki/logger"
adminkindboxparam "git.gocasts.ir/ebhomengo/niki/param/admin/kind_box"
param "git.gocasts.ir/ebhomengo/niki/param/admin/kind_box_req"
@ -38,6 +39,7 @@ func (s Service) Accept(ctx context.Context, req param.KindBoxReqAcceptRequest)
// log error
logger.L().Error(rErr.Error())
}
return param.KindBoxReqAcceptResponse{}, richerror.New(op).WithErr(kErr)
}

View File

@ -4,8 +4,8 @@ import (
"context"
"errors"
"fmt"
"git.gocasts.ir/ebhomengo/niki/entity"
"git.gocasts.ir/ebhomengo/niki/entity"
errmsg "git.gocasts.ir/ebhomengo/niki/pkg/err_msg"
)