feat: improve market category ID assignment in offer mapping logic

This commit is contained in:
2025-08-19 11:28:00 +03:00
parent 818e3f3252
commit e2b4b22095

View File

@@ -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