Development#37
Merged
Merged
Conversation
… update tests and handlers accordingly
…fields; adjust order search request pagination field
…m CreateProductInput; add currency and active fields; update related tests and handlers
…ne request handling in product handler
…y methods and enhance query handling
…Variant methods, and update product stock calculation
…tRequest fields for better handling
…havior with variants
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This pull request introduces significant refactoring and enhancements to the product and discount use cases, focusing on simplifying currency management, improving stock calculation, and enhancing product lifecycle operations. Key changes include removing currency-specific price handling, introducing stock recalculation logic, and refining discount application methods.
Product Use Case Changes:
Currency Management Simplification:
CurrencyPriceInputand all related logic for handling currency-specific prices inCreateProductInput,CreateVariantInput,UpdateVariantInput, andAddVariantInput. Products and variants now use a single currency specified during creation. ([[1]](https://github.com/Zenfulcode/CommercifyGO/pull/37/files#diff-c590c807754d06047fffec1aba0a62b2b7a9a4addfa29b6261f94bda1cf51777L48-R56),[[2]](https://github.com/Zenfulcode/CommercifyGO/pull/37/files#diff-c590c807754d06047fffec1aba0a62b2b7a9a4addfa29b6261f94bda1cf51777L75),[[3]](https://github.com/Zenfulcode/CommercifyGO/pull/37/files#diff-c590c807754d06047fffec1aba0a62b2b7a9a4addfa29b6261f94bda1cf51777L312),[[4]](https://github.com/Zenfulcode/CommercifyGO/pull/37/files#diff-c590c807754d06047fffec1aba0a62b2b7a9a4addfa29b6261f94bda1cf51777L407))Stock Management Enhancements:
CalculateStockmethod to automatically recalculate product stock after operations like adding, updating, or deleting variants. ([[1]](https://github.com/Zenfulcode/CommercifyGO/pull/37/files#diff-c590c807754d06047fffec1aba0a62b2b7a9a4addfa29b6261f94bda1cf51777R174),[[2]](https://github.com/Zenfulcode/CommercifyGO/pull/37/files#diff-c590c807754d06047fffec1aba0a62b2b7a9a4addfa29b6261f94bda1cf51777R297-R306),[[3]](https://github.com/Zenfulcode/CommercifyGO/pull/37/files#diff-c590c807754d06047fffec1aba0a62b2b7a9a4addfa29b6261f94bda1cf51777L506-R400))[internal/application/usecase/product_usecase.goL479-R367](https://github.com/Zenfulcode/CommercifyGO/pull/37/files#diff-c590c807754d06047fffec1aba0a62b2b7a9a4addfa29b6261f94bda1cf51777L479-R367))Lifecycle Improvements:
Activeflag toCreateProductInputandUpdateProductInputto manage product activation status. Removed default variant creation logic and simplified variant handling. ([[1]](https://github.com/Zenfulcode/CommercifyGO/pull/37/files#diff-c590c807754d06047fffec1aba0a62b2b7a9a4addfa29b6261f94bda1cf51777L184-R139),[[2]](https://github.com/Zenfulcode/CommercifyGO/pull/37/files#diff-c590c807754d06047fffec1aba0a62b2b7a9a4addfa29b6261f94bda1cf51777L258))Search and Listing Updates:
SearchProductswithListProductsto streamline product listing with pagination and filtering by active status. ([[1]](https://github.com/Zenfulcode/CommercifyGO/pull/37/files#diff-c590c807754d06047fffec1aba0a62b2b7a9a4addfa29b6261f94bda1cf51777L541-R469),[[2]](https://github.com/Zenfulcode/CommercifyGO/pull/37/files#diff-c590c807754d06047fffec1aba0a62b2b7a9a4addfa29b6261f94bda1cf51777L598-L682))Discount Use Case Changes:
Discount Application Refinement:
SearchtoListfor improved filtering capabilities. ([internal/application/usecase/discount_usecase.goL303-R303](https://github.com/Zenfulcode/CommercifyGO/pull/37/files#diff-9e8bf920baed4c5d4fd9ba5fc752d75135c3613d636feab41bda8cda59aac496L303-R303))switchstatements for better readability and maintainability. ([internal/application/usecase/discount_usecase.goL319-R324](https://github.com/Zenfulcode/CommercifyGO/pull/37/files#diff-9e8bf920baed4c5d4fd9ba5fc752d75135c3613d636feab41bda8cda59aac496L319-R324))Entity Changes:
Date Handling Adjustments:
IsValidmethod inDiscountentity to ensure date comparisons are performed in local time. ([internal/domain/entity/discount.goL107-R110](https://github.com/Zenfulcode/CommercifyGO/pull/37/files#diff-b9542e31b8777a66fb2801254847a19bc444d36daf2e1d3f96842df8bce9c009L107-R110))