# πŸ—οΈ Estructura Clean Architecture - Backend ## πŸ“ Estructura de Carpetas ``` backend/src/ β”œβ”€β”€ domain/ # 🎯 DOMAIN LAYER β”‚ β”œβ”€β”€ entities/ # Entidades de negocio β”‚ β”‚ β”œβ”€β”€ ContentItem.ts β”‚ β”‚ β”œβ”€β”€ Drug.ts β”‚ β”‚ β”œβ”€β”€ GlossaryTerm.ts β”‚ β”‚ β”œβ”€β”€ MediaResource.ts β”‚ β”‚ β”œβ”€β”€ MedicalReview.ts β”‚ β”‚ └── index.ts β”‚ β”‚ β”‚ β”œβ”€β”€ value-objects/ # Objetos de valor inmutables β”‚ β”‚ β”œβ”€β”€ ContentStatus.ts β”‚ β”‚ β”œβ”€β”€ ContentPriority.ts β”‚ β”‚ └── index.ts β”‚ β”‚ β”‚ β”œβ”€β”€ services/ # Servicios de dominio (pendiente) β”‚ β”œβ”€β”€ repositories/ # Interfaces de repositorios β”‚ β”‚ β”œβ”€β”€ IContentRepository.ts β”‚ β”‚ β”œβ”€β”€ IDrugRepository.ts β”‚ β”‚ β”œβ”€β”€ IGlossaryRepository.ts β”‚ β”‚ β”œβ”€β”€ IMediaRepository.ts β”‚ β”‚ β”œβ”€β”€ IReviewRepository.ts β”‚ β”‚ └── index.ts β”‚ β”‚ β”‚ └── events/ # Eventos de dominio (pendiente) β”‚ β”œβ”€β”€ application/ # πŸ”§ APPLICATION LAYER β”‚ β”œβ”€β”€ services/ # Servicios de aplicaciΓ³n (pendiente) β”‚ β”œβ”€β”€ use-cases/ # Casos de uso (pendiente) β”‚ └── dto/ # Data Transfer Objects (pendiente) β”‚ β”œβ”€β”€ infrastructure/ # πŸ”Œ INFRASTRUCTURE LAYER β”‚ β”œβ”€β”€ repositories/ # Implementaciones (pendiente) β”‚ β”œβ”€β”€ database/ # Acceso a BD (pendiente) β”‚ β”œβ”€β”€ storage/ # Almacenamiento (pendiente) β”‚ β”œβ”€β”€ cache/ # CachΓ© (pendiente) β”‚ └── external/ # Servicios externos (pendiente) β”‚ β”œβ”€β”€ presentation/ # 🌐 PRESENTATION LAYER β”‚ β”œβ”€β”€ routes/ # Rutas Express (existente) β”‚ β”œβ”€β”€ middleware/ # Middleware (existente) β”‚ └── validators/ # Validadores Zod (existente) β”‚ └── shared/ # πŸ”— CΓ“DIGO COMPARTIDO β”œβ”€β”€ types/ # Tipos compartidos β”œβ”€β”€ errors/ # Errores compartidos └── utils/ # Utilidades compartidas ``` ## βœ… Estado Actual ### Completado (Ticket 1.1) - βœ… Estructura de carpetas creada - βœ… Interfaces de repositorios definidas - βœ… Entidades de dominio creadas (tipos TypeScript) - βœ… Value Objects creados (ContentStatus, ContentPriority) - βœ… Tipos compartidos exportados - βœ… Errores de dominio definidos - βœ… Utilidades compartidas ### Pendiente - ⏳ Implementaciones de repositorios (Infrastructure) - ⏳ Servicios de aplicaciΓ³n (Application) - ⏳ Casos de uso (Application) - ⏳ Value Objects adicionales (DoseRange, PatientAge, etc.) - ⏳ Servicios de dominio (Domain) ## πŸ“ PrΓ³ximos Pasos 1. **Ticket 1.2:** Crear schemas Zod compartidos 2. **Ticket 1.3:** Refactorizar `drugs.ts` del frontend 3. **Ticket 1.4:** Refactorizar `procedures.ts` del frontend 4. **Ticket 1.5:** Eliminar duplicidades --- **Última actualizaciΓ³n:** 2025-01-25