This commit is contained in:
@@ -3,7 +3,6 @@ package grpc
|
||||
import (
|
||||
"context"
|
||||
"strconv"
|
||||
"time"
|
||||
|
||||
"git.techease.ru/Smart-search/smart-search-back/pkg/errors"
|
||||
pb "git.techease.ru/Smart-search/smart-search-back/pkg/pb/request"
|
||||
@@ -91,14 +90,23 @@ func (h *RequestHandler) GetMailingListByID(ctx context.Context, req *pb.GetMail
|
||||
return nil, errors.ToGRPCError(err, h.logger, "RequestService.GetMailingListByID")
|
||||
}
|
||||
|
||||
suppliers := make([]*pb.Supplier, 0, len(detail.Suppliers))
|
||||
for _, s := range detail.Suppliers {
|
||||
suppliers = append(suppliers, &pb.Supplier{
|
||||
Id: strconv.Itoa(s.CompanyID),
|
||||
Name: s.CompanyName,
|
||||
Email: s.Email,
|
||||
Phone: s.Phone,
|
||||
Url: s.URL,
|
||||
})
|
||||
}
|
||||
|
||||
return &pb.GetMailingListByIDResponse{
|
||||
Item: &pb.MailingItem{
|
||||
RequestId: detail.RequestID.String(),
|
||||
RequestTxt: detail.Title,
|
||||
FinalTz: detail.MailText,
|
||||
MailingStatus: "sent",
|
||||
CreatedAt: timestamppb.New(time.Now()),
|
||||
SuppliersFound: int32(len(detail.Suppliers)),
|
||||
Detail: &pb.MailingDetail{
|
||||
RequestId: detail.RequestID.String(),
|
||||
Title: detail.Title,
|
||||
MailText: detail.MailText,
|
||||
Suppliers: suppliers,
|
||||
},
|
||||
}, nil
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user