Skip to content

Conversation

@technologic-technologic
Copy link
Owner

  • Repository query fix, test compliance upgrades, and dependency hardening

Summary

Bundle of maintenance updates to improve data retrieval correctness, test stability, and supply-chain security.

Changes

  • Repository query: adjust query to return correct results under current filters/sorting (eliminates edge-case mismatch).
  • Test compliance: simplify and stabilize tests (leaner specs, proper Mockito matchers, pageable assertions), reduce flakiness.
  • Build/security: upgrade pom.xml to clear scanner alerts:

More info below

Modified Product's ID attribute to comply with database RAW Id type
BS is operative now. Complying to the requirements.
Changing the version to 1.0.0, although is not going tio be necessary.
Added javadocs comments for documentation.

Nice to have in the feature:
*Availability to restore the stock using web browser cache, or something like that. Probably cookies of some sort.
Modified pom.xml:
 - Moved hardcoded versions to the properties block
Modified pom.xml:
 - Added lombok dependency (version:1.18.38) to manage getters & setters
Modified Product.java:
 - Deleted getters & setters
 - Enabled lombok dependency to keep the code clean
 - ...Next project will use ID instead of UUID
* Deleted application.properties
* Created application.yml
* Deleted unused FilteredSearch.java. Following the YAGNI principle. Wasn´t needed
Modified ProductServiceImpl.java
 - Added method/logic to delete products.
* Products are DELETED as no safe-delete was needed in this project
ProductServiceImpl.java:
 - Removed hardcoded value from updateStock method
 - Added condition to avoid a db call to save the same information

ProductService.java & InventoryManagerController.java:
 - Updated method signatures to return a DTO to prevent exposing sensitive data. No multiple layers needed.

ProductFilter.java:
 - Updated quantityEquals method to comply with client requests
Modified files:
- ProductRepository.java: added definition to repository to make the necessary query
- ProductMapper.java: Transform the InventorySummaryInterface from the repository method to a response appropriate data type for the endpoint.
- InventoryService.java: added definition for the summary/metrics new method
- InventoryServiceImpl.java: added implementation of the new method from the InventoryService.java
- InventoryManagerController.java: added endpoint for summary
* Create ai agent for PRs
* Update ai-pr-summary.yml
Following YAGNI principles, deleted unused InventorySummary.java; deleted unused hello.html and reformatted other files.
Added server port property 
Added port property to server within application.yml file and set the port to 9090 to make the server run on this port.

PR Summary
WHAT Changed
Updated the application.yml configuration file to change the server port from the default to 9090.
Modified README 
Modified readme to show the current storage technology -> runtime local database.
Modified the agent prompt and strengthen the fallback function
Allows cross-origin requests from the new frontend port.
* Update repository query logic

- Fixed logic of the query to maths the requirements.

* Updated show-sql setting

- Updated the show-sql as theres no longer need of the  logs

---------

Signed-off-by: Leonardo Trevizo <leonardo.trevizo@encora.com>
- Updated the test to be more compliant
- Updated the pom to comply with security, avoiding current vulnerabilities

Signed-off-by: Leonardo Trevizo <leonardo.trevizo@encora.com>
Gen-AI module - > Repository query fix, test compliance upgrades, and dependency hardening
@github-actions
Copy link

PR Summary

WHAT Changed

  • New GitHub Action Workflow: Added a new workflow file .github/workflows/ai-pr-summary.yml to automate PR summaries using OpenAI's API.
  • Updated README: Modified the README.md to reflect the new features and changes in the project.
  • Refactored Codebase:
    • Replaced the ProductService and ProductServiceImpl with an InventoryService and InventoryServiceImpl to improve inventory management.
    • Introduced new response classes (ProductListResponse, ProductShortResponse, InventorySummaryResponse) for better API responses.
    • Updated the Product entity to use UUIDs instead of Long for IDs.
    • Added new endpoints for inventory summary and filtering products.
  • Database Changes: Switched from in-memory storage to H2 database with JDBC for persistence.
  • New Tests: Added comprehensive tests for the new service and controller functionalities.

WHY It Matters

  • Automation: The new GitHub Action automates PR summaries, improving code review efficiency.
  • Improved Structure: Refactoring enhances the maintainability and scalability of the codebase.
  • Better API Responses: New response classes and endpoints provide clearer and more structured data to API consumers.
  • Persistence: Transitioning to H2 allows for persistent data storage, which is crucial for real-world applications.

RISKS

  • Dependency on OpenAI API: The workflow relies on the OpenAI API, which may introduce points of failure if the API is down or changes.
  • Database Migration: Changing the data storage mechanism may lead to data loss if not handled properly during migration.

TESTS to Add

  • Integration Tests: Ensure that the new endpoints work as expected with the database.
  • Unit Tests: For the new service methods and response mappers.
  • Error Handling Tests: To verify that the application handles errors gracefully, especially with the new database interactions.

BREAKING CHANGES

  • ID Type Change: The Product entity now uses UUIDs instead of Longs for IDs, which may affect existing database records and API consumers.
  • Service Interface Changes: The previous ProductService interface has been removed, and its methods have been replaced with those in InventoryService.

Changed File Paths

  • .github/workflows/ai-pr-summary.yml
  • README.md
  • src/main/java/com/encorazone/inventory_manager/controller/InventoryManagerController.java
  • src/main/java/com/encorazone/inventory_manager/domain/Product.java
  • src/main/java/com/encorazone/inventory_manager/service/InventoryService.java
  • src/test/java/com/encorazone/inventory_manager/controller/InventoryManagerControllerTests.java
  • src/test/java/com/encorazone/inventory_manager/service/InventoryServiceImplTests.java

@technologic-technologic technologic-technologic merged commit 468dd62 into main Oct 17, 2025
1 check passed
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