forked from ebhomengo/niki
1
0
Fork 0
niki/service/benefactor/address/delete.go

22 lines
733 B
Go
Raw Normal View History

package benefactoraddressservice
import (
"context"
param "git.gocasts.ir/ebhomengo/niki/param/benefactor/address"
richerror "git.gocasts.ir/ebhomengo/niki/pkg/rich_error"
)
func (s Service) Delete(ctx context.Context, req param.DeleteAddressRequest) (param.DeleteAddressResponse, error) {
const op = "benefactoraddressservice.Delete"
if fieldErrors, vErr := s.vld.ValidateDeleteRequest(ctx, req); vErr != nil {
return param.DeleteAddressResponse{FieldErrors: fieldErrors}, richerror.New(op).WithErr(vErr)
}
err := s.repo.DeleteBenefactorAddress(ctx, req.AddressID, req.BenefactorID)
if err != nil {
return param.DeleteAddressResponse{}, richerror.New(op).WithErr(err)
}
return param.DeleteAddressResponse{}, nil
}