feat: improve market category ID assignment in offer mapping logic
This commit is contained in:
@@ -185,12 +185,15 @@ func (r *apiRepository) processOfferMappings(offerMappings []ymclient.GetOfferMa
|
|||||||
protoOffer := r.converter.YmOfferToProtoOffer(offerMapping.Offer)
|
protoOffer := r.converter.YmOfferToProtoOffer(offerMapping.Offer)
|
||||||
if protoOffer == nil {
|
if protoOffer == nil {
|
||||||
fmt.Printf("Warning: received nil offer for ID %s\n", offerMapping.Offer.OfferId)
|
fmt.Printf("Warning: received nil offer for ID %s\n", offerMapping.Offer.OfferId)
|
||||||
resultOffers = append(resultOffers, &pb.GetProductsResponse_Offer{})
|
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
protoOffer.MarketCategoryId = *offerMapping.Mapping.MarketCategoryId
|
if mapping, ok := offerMapping.GetMappingOk(); ok {
|
||||||
|
if marketCategoryId, ok := mapping.GetMarketCategoryIdOk(); ok {
|
||||||
|
protoOffer.MarketCategoryId = *marketCategoryId
|
||||||
|
}
|
||||||
|
}
|
||||||
resultOffers = append(resultOffers, protoOffer)
|
resultOffers = append(resultOffers, protoOffer)
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return resultOffers, nil
|
return resultOffers, nil
|
||||||
|
|||||||
Reference in New Issue
Block a user