Repository navigation
Conversation
OM-275: agregué el endpoint GET product by id
Resuelto 2 bugs
OM-66-feat(categories): mover product-categories a modulos globales y agregar categorías globales
…eService en store.service
…ate user para tal caso en store.service
- Agregar deleteProductService con validación de propietario del comercio - Agregar deleteProduct controller con respuesta 204 No Content - Registrar ruta DELETE /products/:id protegida con autenticación - Actualizar errorHandler para compatibilidad con objetos de error legacy
…roducto - Validar y normalizar legacyStatus en errorHandler (rango 400-599) - Agregar guard defensivo de autenticación en deleteProduct controller - Reemplazar update por updateMany atómico con ownership en el WHERE para evitar race conditions
OM-262: Configuración para tests en el backend con Vitest+Supertest
OM-208(productos): agregar eliminación de producto con soft delete
|
Caution Review failedThe pull request is closed. ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: ⛔ Files ignored due to path filters (1)
📒 Files selected for processing (40)
📝 WalkthroughWalkthroughSe implementa una infraestructura completa de testing (Vitest + Supertest), se refactoriza la arquitectura de la aplicación separando la inicialización del servidor, y se añaden operaciones CRUD extensas con validación, autorización y manejo de errores para direcciones, productos, reseñas y categorías en múltiples módulos. Changes
Sequence Diagram(s)sequenceDiagram
participant Client
participant Server
participant Auth as Middleware Auth
participant Controller
participant Service
participant Database
Client->>Server: POST /api/users/addresses<br/>(con JWT en cookie)
Server->>Auth: Validar token JWT
Auth-->>Server: id_usuario válido
Server->>Controller: createAddress(req, res)
Controller->>Service: createAddressService(userId, requestedId, payload)
Service->>Database: Validar usuario propietario
Database-->>Service: Usuario verificado
Service->>Database: Contar direcciones activas
Database-->>Service: Conteo actual
alt Límite alcanzado
Service-->>Controller: Error 400
else Límite disponible
Service->>Database: Crear dirección + transacción
Database-->>Service: Dirección creada
Service-->>Controller: Datos de dirección
end
Controller-->>Client: 201 + dirección
sequenceDiagram
participant Client
participant Server
participant Auth as Middleware Auth
participant Controller
participant Service
participant Database
Client->>Server: POST /products/:id/reviews<br/>(crear reseña)
Server->>Auth: Validar autenticación
Auth-->>Server: customerId válido
Server->>Controller: createProductReview(req, res)
Controller->>Service: createProductReviewService(productId, customerId, data)
Service->>Database: Validar producto activo
Database-->>Service: Producto verificado
Service->>Database: Validar rol CUSTOMER
Database-->>Service: Cliente verificado
Service->>Database: Verificar orden DELIVERED con producto
Database-->>Service: Compra verificada
Service->>Database: Buscar reseña existente
alt Reseña activa existe
Service-->>Controller: Error 400
else Reseña eliminada existe
Service->>Database: Reactivar reseña
Database-->>Service: Reseña reactivada
Service-->>Controller: Resumen reseña
else Nueva reseña
Service->>Database: Crear reseña
Database-->>Service: Reseña creada
Service-->>Controller: Resumen reseña
end
Controller-->>Client: 201 + reseña
Estimated code review effort🎯 4 (Complex) | ⏱️ ~60 minutes Possibly related PRs
Suggested reviewers
Poem
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
📝 Coding Plan
Comment Tip CodeRabbit can suggest fixes for GitHub Check annotations.Configure the |
Summary by CodeRabbit
Notas de lanzamiento