Skip to content

Feat: Configurar proyecto React Native con arquitectura hexagonal y mejoras en infraestructura#1

Open
raicoacosta wants to merge 18 commits into
jjmayorgaq:mainfrom
raicoacosta:main
Open

Feat: Configurar proyecto React Native con arquitectura hexagonal y mejoras en infraestructura#1
raicoacosta wants to merge 18 commits into
jjmayorgaq:mainfrom
raicoacosta:main

Conversation

@raicoacosta

Copy link
Copy Markdown

🎯 Resumen

Este PR establece la base del proyecto React Native con arquitectura hexagonal (Clean Architecture) y realiza mejoras críticas en la configuración del repositorio, gestión de dependencias y corrección de bugs de renderizado.

🔧 Cambios Principales

1. Configuración del Repositorio

  • Creado .gitignore mejorado (209 líneas)
    • Patrones para OSX, VS Code, JetBrains, Node, TypeScript
    • Exclusiones de archivos de build de Android (.cxx/**) e iOS
    • Excepciones para archivos de lock (yarn.lock, package-lock.json, Gemfile.lock)

2. Limpieza del Repositorio 🧹

  • Eliminados 355 archivos de tracking git:
    • android/app/.cxx/** - Archivos de build de CMake (354 archivos)
    • .watchmanconfig - Configuración no necesaria en repo
    • ios/RNTemplateHexagonal.xcworkspace/contents.xcworkspacedata - Generado automáticamente
    • .bundle/config y ios/Podfile.lock - Archivos de dependencias

3. Arquitectura Hexagonal Implementada 🏗️

Domain Layer (Capa de Dominio)

  • ✅ Entidades: CreditCard con 12 propiedades de dominio
  • ✅ DTOs con validación Zod 4.1.12
  • ✅ Mappers: dtoToCreditCard y dtoToAllCreditCards
  • ✅ Repository pattern con interfaces IGetAll e IPost

Application Layer (Capa de Aplicación)

  • ✅ UseCase: CreditCardUseCase con método executeGetAll()
  • ✅ Provider de Context API: CreditCardUseCaseProvider
  • ✅ Custom hook: useCreditCardImpl()

Infrastructure Layer (Capa de Infraestructura)

  • ✅ HTTP Implementation con Axios
  • ✅ Storage Implementation con AsyncStorage
  • ✅ Contratos/Interfaces para inversión de dependencias

4. Corrección de Bugs Críticos 🐛

App.tsx - 5 bugs corregidos:

  1. useMemo(async () => ...) → ✅ React.useEffect(() => invokeCreditcards())
  2. ❌ Variable _ (ESLint error) → ✅ _creditCardsError
  3. ❌ Duplicate Provider → ✅ Provider movido a index.js (single source of truth)
  4. ❌ Missing keys in .map() → ✅ key={creditCard.productNumber}
  5. ❌ Unused imports → ✅ Limpiados

index.js - Provider hierarchy:

<SafeAreaProvider>
  <CreditCardUseCaseProvider>
    <App />
  </CreditCardUseCaseProvider>
</SafeAreaProvider>

- Added MainActivity.kt and MainApplication.kt for Android setup.
- Created iOS project files including AppDelegate.swift, Info.plist, and LaunchScreen.storyboard.
- Configured Xcode project settings and schemes for building and running the app.
- Included assets for app icons and privacy information.
- Set up React Native integration with new architecture support.
- Added MainActivity and MainApplication for Android setup.
- Created iOS project structure including AppDelegate, Info.plist, and LaunchScreen storyboard.
- Configured Xcode project settings and schemes for building and running the app.
- Included necessary assets and privacy information for iOS.
- Set up React Native delegate and factory for application lifecycle management.
…pace-from' y actualizar configuraciones de proyecto
…a gestión de errores en el repositorio de tarjetas de crédito
…ive tests

- Added Money value object with methods for creation, addition, subtraction, multiplication, and comparison.
- Implemented ProductNumber value object with validation and masking functionality.
- Created unit tests for Money and ProductNumber to ensure correct behavior and error handling.

feat: Introduce Logger interface and LoggerService implementation

- Defined ILogger interface for structured logging with various log levels.
- Implemented LoggerService to handle logging with context and remote capabilities.
- Added emoji representation for different log levels for better visibility in console.

feat: Develop use cases for credit card management

- Created use cases for creating, deleting, fetching all, and fetching by ID for credit cards.
- Integrated logging into use cases to track operations and errors.
- Utilized Result pattern for error handling in use cases.

feat: Establish CreditCard repository interfaces and implementations

- Defined ICreditCardRepository interface for credit card data operations.
- Implemented HttpCreditCardRepository for HTTP-based data fetching and manipulation.
- Developed MockCreditCardRepository for testing and development purposes with mock data.

feat: Add domain exceptions for credit card operations

- Created specific exceptions for credit card domain errors to improve error handling.
- Implemented validation logic for credit card attributes, including expiration date and product number.

feat: Introduce Result type for functional error handling

- Implemented Result class to encapsulate success and error states, facilitating cleaner error management in use cases.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants