2024-01-02 14:04:16 +00:00
|
|
|
package benefactorkindboxservice
|
2023-12-26 17:52:20 +00:00
|
|
|
|
|
|
|
import (
|
|
|
|
"context"
|
|
|
|
|
2023-12-26 17:53:25 +00:00
|
|
|
param "git.gocasts.ir/ebhomengo/niki/param/benefactor/kind_box"
|
2023-12-26 17:52:20 +00:00
|
|
|
richerror "git.gocasts.ir/ebhomengo/niki/pkg/rich_error"
|
|
|
|
)
|
|
|
|
|
2023-12-26 17:53:25 +00:00
|
|
|
func (s Service) Get(ctx context.Context, req param.KindBoxGetRequest) (param.KindBoxGetResponse, error) {
|
|
|
|
const op = "userkindboxservice.Get"
|
2023-12-26 17:52:20 +00:00
|
|
|
|
2023-12-26 17:53:25 +00:00
|
|
|
kindBox, err := s.repo.GetKindBox(ctx, req.KindBoxID)
|
2023-12-26 17:52:20 +00:00
|
|
|
if err != nil {
|
2023-12-26 17:53:25 +00:00
|
|
|
return param.KindBoxGetResponse{}, richerror.New(op).WithErr(err).WithKind(richerror.KindUnexpected)
|
2023-12-26 17:52:20 +00:00
|
|
|
}
|
|
|
|
|
2023-12-26 17:53:25 +00:00
|
|
|
return param.KindBoxGetResponse{KindBox: kindBox}, nil
|
2023-12-26 17:52:20 +00:00
|
|
|
}
|