Skip to content

Conversation

@IvanM9
Copy link
Contributor

@IvanM9 IvanM9 commented Nov 25, 2025

Descripción

Este PR resuelve el issue #39 - "El array de categories no contiene id y no está bien construido"

Problema

Cuando se recibían los datos del wardrobe, el array de categories tenía una estructura anidada innecesaria:

{
  "categories": [
    { "category": { "name": "Tops" } },
    { "category": { "name": "Casual" } }
  ]
}

Esto requería hacer "drilling" de categories.category en el frontend para acceder a los datos.

Solución

Se implementó la transformación de datos para aplanar la estructura, devolviendo ahora:

{
  "categories": [
    { "id": "uuid-1", "name": "Tops" },
    { "id": "uuid-2", "name": "Casual" }
  ]
}

Cambios realizados

  • wardrobe.service.ts:
    • getClothes(): Agregado id al select de categorías y transformación para aplanar la estructura
    • getClothesById(): Agregada transformación para aplanar la estructura de categorías

Beneficios

  • ✅ Proporciona el id de cada categoría para operaciones del frontend
  • ✅ Elimina el anidamiento innecesario de categories.category
  • ✅ Mantiene consistencia entre los diferentes endpoints
  • ✅ Simplifica el consumo de la API desde el frontend

Closes #39

Include category id in select query and flatten categories structure
from { category: { id, name } } to { id, name } for proper API response.

Closes #39
@IvanM9 IvanM9 linked an issue Nov 25, 2025 that may be closed by this pull request
@IvanM9 IvanM9 changed the base branch from dev to main November 25, 2025 02:37
@IvanM9 IvanM9 added the bug Something isn't working label Nov 25, 2025
@IvanM9 IvanM9 requested a review from josueJouvin November 25, 2025 02:38
IvanM9 and others added 3 commits December 17, 2025 22:18
- Implement comprehensive tests for CombinationsService, covering methods such as generateCombinations, saveCombination, getCombinations, updateStatusCombination, getCombinationById, addItemsToCombination, updateStatusItemFromCombination, and more.
- Add unit tests for WardrobeService, including create, getClothes, getClothesById, update, updateStatus, addCategory, deactivateCategory, uploadFiles, deactivateImage, and activateImage methods.
- Mock dependencies like PrismaService, MultimediaService, and Logger for isolated testing.
- Ensure proper error handling and validation in tests, including scenarios for existing items, inactive statuses, and database errors.
@IvanM9 IvanM9 merged commit 721b378 into main Dec 18, 2025
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

El array de categories no contiene id u no esta bien construido

3 participants