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)
|
||||
if protoOffer == nil {
|
||||
fmt.Printf("Warning: received nil offer for ID %s\n", offerMapping.Offer.OfferId)
|
||||
resultOffers = append(resultOffers, &pb.GetProductsResponse_Offer{})
|
||||
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)
|
||||
|
||||
}
|
||||
|
||||
return resultOffers, nil
|
||||
|
||||
Reference in New Issue
Block a user