Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Leandro-reis/challenge-implementation #314

Open
wants to merge 43 commits into
base: main
Choose a base branch
from

Conversation

leandroepr
Copy link

No description provided.

leandroepr added 30 commits May 30, 2024 11:24
… function

The Calculator class was removed as it was no longer needed. It was used only to test the jest and typescript configuration
Include the GetCurrencyRateByCode use-case to support the test
- Added PostgreSQL database setup to the application using Docker
- Configured docker-compose.yml for PostgreSQL service
- Created initialization scripts for database schema and seed data
- Created new repository class `CurrencyRateRepositoryApi` to manage currency rates.
- Implemented methods to find, add, and delete currency rates.
- Integrated the repository with the remote API gateway for fetching data.
- Updated the `CurrencyApiGateway` to support filtering and fetching currencies and rates.
- Added necessary imports and updated the application logic to use the new repository.
…port internal modules

- Added `index.ts` files in various module directories to simplify imports and exports.
- Updated all files to use the new restructured import paths.
- Organized project structure to improve code clarity and maintainability.
- Installed and configured Prettier and ESLint for code formatting and linting.
- Added .prettierrc and .eslintrc.json configuration files.
- Integrated Prettier with ESLint to ensure consistent code style.
- Reformatted all source files according to Prettier and ESLint rules.
- Updated import paths and adjusted formatting in various modules.
- Integrate swagger-ui-express library to serve API documentation
- Add swagger.json file to define API specifications
- Configure Express server to serve the Swagger UI at /api-docs endpoint
- Created ListCurrenciesController class to handle GET requests for listing currencies.
- Integrated ListCurrenciesQuery to execute the query and retrieve the currency data.
- Added route registration for '/currencies' endpoint in ExpressAdapter.
- Update swagger documentation
- Refactored CurrencyController into separate controllers, each handling a specific route.
- Updated routes and imports to use the new controllers.
- Modified main setups to instantiate and use the new controllers.
- Improved code modularity and maintainability by following the Single Responsibility Principle.
- Removed route handling responsibility from controllers to improve separation of concerns.
- Updated the following controllers to focus only on handling their specific logic:
  - ConvertCurrencyController
  - CreateCurrencyController
  - DeleteCurrencyController
  - GetCurrencyByCodeController
  - ListCurrenciesController
- Updated the main application setup files to register routes separately from the controller logic.
- Modified `main-express-pg.ts`, `main-express.ts`, `main-gateway.ts`, and `main-hapi.ts` to use the new routing structure.

Affected files:
- src/application/query/*
- src/application/use-case/*
- src/infra/http-server/*
- src/main/*
- Created a new CurrenciesRoutes class to handle the registration of routes.
- Removed route handling responsibility from the main files to improve separation of concerns.
- Updated the following files to utilize the new CurrenciesRoutes class:
  - main-express-pg.ts
  - main-express.ts
  - main-gateway.ts
  - main-hapi.ts
- Added error handling in ConvertCurrencyController to catch NotFoundError and return a 404 response with the appropriate message.
- Renamed 'currency-rate-not-found.error.ts' to 'currency-not-found.error.ts';
- Updated 'delete-currency.controller.ts' to handle 'CurrencyNotFoundError' and return a 404 response.
- Refactored tests to improve structure and maintainability.
- Expanded test coverage to ensure comprehensive validation of the currency management process.
- Ensured error handling is properly tested to maintain robustness.
…ity and ease of use.

- Renamed files to be more self-explanatory:
  - main-express-gateway-offline.ts
  - main-express-gateway-online.ts
  - main-express-with-fake.ts
  - main-hapi-with-fake.ts
- Updated package.json scripts:
  - Added `start` script
  - Added `dev:express+gw-on` script
  - Renamed existing scripts for consistency and clarity
- Added Dockerfile with appropriate configuration for building and running the app.
- Updated docker-compose.yml to include the app service and configure environment variables.
- Installed and configured dotenv for managing environment variables.
- Updated main*.ts files to use environment variables for database connection strings.
- Updated gateway online configuration to utilize environment variables.
- Modified database connection logic to use environment variables for connection string.

These changes ensure the application can be built and run in a Docker environment with proper environment variable management for configuration consistency.
…ME with the challenge implementation information
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.

1 participant