Skip to content

feature/add-stock-product#83

Merged
andres15alvarez merged 6 commits into
devfrom
feature/add-stock-product
Apr 27, 2025
Merged

feature/add-stock-product#83
andres15alvarez merged 6 commits into
devfrom
feature/add-stock-product

Conversation

@andres15alvarez
Copy link
Copy Markdown
Member

This pull request introduces several updates to improve the functionality, maintainability, and clarity of the codebase. Key changes include adding the @Expose decorator to DTOs for better serialization, introducing a new getProducts method in the ProductsService with enhanced filtering capabilities, and implementing a virtual column for stock calculation in the ProductPresentation entity. Additionally, some dependencies were updated, and unused repositories were removed.

Enhancements to DTOs:

  • Added the @Expose decorator to properties in CategoryDTO, ManufacturerDTO, and ProductDTO to enable controlled serialization. The @Type decorator was also introduced in ProductDTO for nested object transformation. ([[1]](https://github.com/PharmaTechVe/api/pull/83/files#diff-9bf124d4c46627b8d2c1d39974abd76ef5c0913dc4c3f414c204e343f243f2e9R2-R19), [[2]](https://github.com/PharmaTechVe/api/pull/83/files#diff-e12a4d8a96c805cdae4b3fd234088af73b59256488ba93544886c5de4f1d1c5eR2-R14), [[3]](https://github.com/PharmaTechVe/api/pull/83/files#diff-f15b7608e25d980cbe574edaa3ee0e2fb62816b80c6ac2acfeaff58f02d8d41dR29-R78))

Improvements to ProductsService:

  • Added a new getProducts method with advanced filtering options (e.g., by category, manufacturer, branch, and price range). This method is more flexible and replaces the older version, which has been marked as deprecated. ([[1]](https://github.com/PharmaTechVe/api/pull/83/files#diff-96a20d758e030b096d5569de349503fa568238e0ab514be78826ed9c9f445625R122-R215), [[2]](https://github.com/PharmaTechVe/api/pull/83/files#diff-96a20d758e030b096d5569de349503fa568238e0ab514be78826ed9c9f445625L59-R49))
  • Removed unused repository injections (e.g., Product, Manufacturer, Category, etc.), simplifying the service's dependency list. ([src/products/products.service.tsL3-L30](https://github.com/PharmaTechVe/api/pull/83/files#diff-96a20d758e030b096d5569de349503fa568238e0ab514be78826ed9c9f445625L3-L30))

Entity Enhancements:

  • Introduced a @VirtualColumn in the ProductPresentation entity to calculate stock dynamically based on inventory data. ([src/products/entities/product-presentation.entity.tsR46-R52](https://github.com/PharmaTechVe/api/pull/83/files#diff-88948ad8709ca59cb3ca1f35cd0335a91d13d4677f55b74c13a8c33516e5531aR46-R52))

Dependency Updates:

  • Updated the typeorm dependency from version 0.3.20 to 0.3.22 in package.json. ([package.jsonL46-R46](https://github.com/PharmaTechVe/api/pull/83/files#diff-7ae45ad102eab3b6d7e7896acd08c427a9b25b346470d7bc6507b6481575d519L46-R46))

Controller Serialization:

  • Updated the ProductsController to use plainToInstance for transforming and serializing the response data into ProductPresentationDTO with explicit and implicit conversion options. ([src/products/products.controller.tsL127-R134](https://github.com/PharmaTechVe/api/pull/83/files#diff-057c369854000322460bf5f5a7a7271d71e83e676a2f33cf2cd50a9923f938f3L127-R134))

@andres15alvarez andres15alvarez added the feature New feature or request label Apr 26, 2025
@andres15alvarez andres15alvarez self-assigned this Apr 26, 2025
@andres15alvarez andres15alvarez merged commit a272d82 into dev Apr 27, 2025
2 checks passed
@andres15alvarez andres15alvarez deleted the feature/add-stock-product branch April 27, 2025 14:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

feature New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants