niki/service/benefactor/address/city_exit_by_id.go

20 lines
637 B
Go

package benefactoraddressservice
import (
"context"
addressparam "git.gocasts.ir/ebhomengo/niki/param/benefactor/address"
richerror "git.gocasts.ir/ebhomengo/niki/pkg/rich_error"
)
func (s Service) CityExistByID(ctx context.Context, req addressparam.CityExistByIDRequest) (addressparam.CityExistByIDResponse, error) {
const op = "benefactoraddressservice.CityExistByID"
isExisted, err := s.repo.IsExistCityByID(ctx, req.ID)
if err != nil {
return addressparam.CityExistByIDResponse{}, richerror.New(op).WithErr(err).WithKind(richerror.KindUnexpected)
}
return addressparam.CityExistByIDResponse{Existed: isExisted}, nil
}