fix(niki): fix linter errors

This commit is contained in:
imirazimi 2023-12-28 21:08:45 +03:30
parent 4a5cc910db
commit f7fb18a501
5 changed files with 0 additions and 79 deletions

View File

@ -10,60 +10,6 @@ const (
KindBoxEnumeratedStatus
)
const (
kindBoxPendingSendStatus = "pending-send"
kindBoxSentStatus = "sent"
kindBoxPendingReceivedStatus = "pending-received"
kindBoxReceivedStatus = "received"
kindBoxEnumeratedStatus = "enumerated"
)
func (s KindBoxStatus) String() string {
switch s {
case KindBoxPendingSendStatus:
return kindBoxPendingSendStatus
case KindBoxSentStatus:
return kindBoxSentStatus
case KindBoxPendingReceivedStatus:
return kindBoxPendingReceivedStatus
case KindBoxReceivedStatus:
return kindBoxReceivedStatus
case KindBoxEnumeratedStatus:
return kindBoxEnumeratedStatus
}
return ""
}
func MapToKindBoxStatus(statusStr string) KindBoxStatus {
switch statusStr {
case kindBoxPendingSendStatus:
return KindBoxPendingSendStatus
case kindBoxSentStatus:
return KindBoxSentStatus
case kindBoxPendingReceivedStatus:
return KindBoxPendingReceivedStatus
case kindBoxReceivedStatus:
return KindBoxReceivedStatus
case kindBoxEnumeratedStatus:
return KindBoxEnumeratedStatus
}
return KindBoxStatus(0)
}
package entity
type KindBoxStatus uint
const (
KindBoxPendingSendStatus KindBoxStatus = iota + 1
KindBoxSentStatus
KindBoxPendingReceivedStatus
KindBoxReceivedStatus
KindBoxEnumeratedStatus
)
var kindBoxStatusStrings = map[KindBoxStatus]string{
KindBoxPendingSendStatus: "pending-send",
KindBoxSentStatus: "sent",
@ -94,12 +40,3 @@ func MapToKindBoxStatus(statusStr string) KindBoxStatus {
}
return KindBoxStatus(0)
}
// AllKindBoxStatus returns a slice containing all string values of KindBoxStatus.
func AllKindBoxStatus() []string {
statusStrings := make([]string, len(kindBoxStatusStrings))
for status, str := range kindBoxStatusStrings {
statusStrings[int(status)-1] = str
}
return statusStrings
}

View File

@ -4,7 +4,6 @@ import (
"context"
param "git.gocasts.ir/ebhomengo/niki/param/benefactor/kind_box"
errmsg "git.gocasts.ir/ebhomengo/niki/pkg/err_msg"
richerror "git.gocasts.ir/ebhomengo/niki/pkg/rich_error"
)

View File

@ -5,7 +5,6 @@ import (
entity "git.gocasts.ir/ebhomengo/niki/entity"
param "git.gocasts.ir/ebhomengo/niki/param/admin/kind_box"
errmsg "git.gocasts.ir/ebhomengo/niki/pkg/err_msg"
richerror "git.gocasts.ir/ebhomengo/niki/pkg/rich_error"
)

View File

@ -5,7 +5,6 @@ import (
entity "git.gocasts.ir/ebhomengo/niki/entity"
param "git.gocasts.ir/ebhomengo/niki/param/admin/kind_box_req"
errmsg "git.gocasts.ir/ebhomengo/niki/pkg/err_msg"
richerror "git.gocasts.ir/ebhomengo/niki/pkg/rich_error"
)
@ -16,17 +15,6 @@ func (s Service) Update(ctx context.Context, req param.KindBoxReqUpdateRequest)
const op = "adminkindboxreqservice.Update"
kbr, gErr := s.repo.GetKindBoxReq(ctx, req.KindBoxReqID)
if gErr != nil {
return param.KindBoxReqUpdateResponse{}, richerror.New(op).WithErr(gErr).WithKind(richerror.KindUnexpected)
}
if kbr.BenefactorID != req.BenefactorID {
return param.KindBoxReqUpdateResponse{}, richerror.New(op).WithMessage(errmsg.ErrorMsgUserNotAllowed).WithKind(richerror.KindForbidden)
}
if kbr.Status != entity.KindBoxReqPendingStatus {
return param.KindBoxReqUpdateResponse{}, richerror.New(op).WithMessage(errmsg.ErrorMsgInvalidStatus).WithKind(richerror.KindInvalid)
}
kindBoxReq, uErr := s.repo.UpdateKindBoxReq(ctx, req.KindBoxReqID, entity.KindBoxReq{
BenefactorID: req.BenefactorID,
TypeID: req.TypeID,

View File

@ -4,7 +4,6 @@ import (
"context"
param "git.gocasts.ir/ebhomengo/niki/param/benefactor/kind_box"
errmsg "git.gocasts.ir/ebhomengo/niki/pkg/err_msg"
richerror "git.gocasts.ir/ebhomengo/niki/pkg/rich_error"
)
@ -15,7 +14,6 @@ func (s Service) Get(ctx context.Context, req param.KindBoxGetRequest) (param.Ki
if err != nil {
return param.KindBoxGetResponse{}, richerror.New(op).WithErr(err).WithKind(richerror.KindUnexpected)
}
return param.KindBoxGetResponse{KindBox: kindBox}, nil
}