niki/service/kind_box/get_by_id.go

16 lines
526 B
Go

package kindboxservice
import (
param "git.gocasts.ir/ebhomengo/niki/param/kind_box"
richerror "git.gocasts.ir/ebhomengo/niki/pkg/rich_error"
)
func (s Service) GetByID(req param.KindBoxGetByIDRequest) (param.KindBoxGetByIDResponse, error) {
const op = "kindboxservice.GetByID"
kindBox, err := s.repo.GetKindBoxByID(req.KindBoxID)
if err != nil {
return param.KindBoxGetByIDResponse{}, richerror.New(op).WithErr(err).WithKind(richerror.KindUnexpected)
}
return param.KindBoxGetByIDResponse{KindBox: kindBox}, nil
}