Repository navigation
feat: agregar image_url en respuestas de productos (store y búsqueda) - #99
Conversation
📝 WalkthroughRecorridoSe agregó Cambios
Estimación de esfuerzo en revisión del código🎯 1 (Trivial) | ⏱️ ~5 minutos PRs posiblemente relacionados
Revisores sugeridos
Poema
🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@src/modules/commerce/commerces/store.service.js`:
- Line 949: El fallback legacyStoreSelect no incluye el campo image_url que se
añadió al select principal, causando respuesta inconsistente; en la función
legacyStoreSelect y/o en el mapper usado por store.controller (consultar
legacyStoreSelect y el mapper que transforma la fila a JSON) añade/normaliza
image_url (ej: siempre asignar image_url = row.image_url || null o derivarlo
desde image_path) para garantizar que ambos paths devuelvan la misma estructura
JSON; actualiza el mapper central para cubrir ambos selects y evitar lógica
duplicada entre legacyStoreSelect y el select principal.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: b4ba4afe-0f96-44dc-a969-7bb54e687e2f
📒 Files selected for processing (2)
src/modules/commerce/commerces/store.service.jssrc/modules/commerce/products/product.service.js
| quantity: true, | ||
| visible: true, | ||
| is_offer: true, | ||
| image_url: true, |
There was a problem hiding this comment.
Mantener contrato estable también en el fallback legado.
En Line 949 se agrega image_url en la ruta principal, pero en legacyStoreSelect (Lines 983-1014) ese campo no está. Si se activa ese fallback, el campo puede desaparecer del JSON que el controller devuelve directo (src/modules/commerce/commerces/store.controller.js, Lines 66-72), generando respuesta inconsistente.
💡 Propuesta simple: normalizar `image_url` en el mapper para ambos paths
const mapStoreProductPricing = (product) => {
const pricing = getProductPricing(product);
return {
...product,
+ image_url: product?.image_url ?? null,
price: pricing.price,
original_price: pricing.originalPrice,
offer_price: pricing.offerPrice,
is_offer: pricing.isOffer
};
};🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.
In `@src/modules/commerce/commerces/store.service.js` at line 949, El fallback
legacyStoreSelect no incluye el campo image_url que se añadió al select
principal, causando respuesta inconsistente; en la función legacyStoreSelect y/o
en el mapper usado por store.controller (consultar legacyStoreSelect y el mapper
que transforma la fila a JSON) añade/normaliza image_url (ej: siempre asignar
image_url = row.image_url || null o derivarlo desde image_path) para garantizar
que ambos paths devuelvan la misma estructura JSON; actualiza el mapper central
para cubrir ambos selects y evitar lógica duplicada entre legacyStoreSelect y el
select principal.
Summary by CodeRabbit
New Features