package adminbenefactorservice import ( "context" param "git.gocasts.ir/ebhomengo/niki/param/admin/benefactor" richerror "git.gocasts.ir/ebhomengo/niki/pkg/rich_error" ) func (s Service) UpdateStatus(ctx context.Context, req param.BenefactorUpdateStatusRequest) (param.BenefactorUpdateStatusResponse, error) { const op = "adminbenefactorservice.UpdateStatus" if fieldErrors, vErr := s.vld.ValidateUpdateStatusRequest(ctx, req); vErr != nil { return param.BenefactorUpdateStatusResponse{FieldErrors: fieldErrors}, richerror.New(op).WithErr(vErr) } benefactor, err := s.repo.GetByID(ctx, req.ID) if err != nil { return param.BenefactorUpdateStatusResponse{}, richerror.New(op).WithErr(err) } if uErr := s.repo.UpdateStatusBenefactor(ctx, benefactor, req.Status); uErr != nil { return param.BenefactorUpdateStatusResponse{}, richerror.New(op).WithErr(uErr) } return param.BenefactorUpdateStatusResponse{}, nil }