Skip to content

DTOs and Product delete refactor#35

Merged
gustaavik merged 21 commits into
mainfrom
development
Jun 14, 2025
Merged

DTOs and Product delete refactor#35
gustaavik merged 21 commits into
mainfrom
development

Conversation

@gustaavik
Copy link
Copy Markdown
Member

This pull request introduces several changes across multiple files to improve functionality, enhance usability, and streamline code. The most significant updates include the addition of a CategoryUseCase implementation, improvements to CheckoutUseCase for shipping method handling, updates to product variant logic in ProductUseCase, and enhancements to database and development tooling via .dockerignore and Makefile.

New Feature: Category Use Case Implementation

  • Added CategoryUseCase in internal/application/usecase/category_usecase.go, enabling category creation, updating, deletion, and retrieval, with validation for parent categories and unique constraints.

Checkout Use Case Enhancements

  • Updated CheckoutUseCase to integrate ShippingUseCase for calculating shipping options and validating shipping methods, improving modularity and error handling. [1] [2] [3] [4]

Product Variant Logic Improvements

  • Modified ProductUseCase to set has_variants=true only for products with multiple variants, ensuring logical consistency in product data. [1] [2]
  • Updated product fields to include weight and removed redundant fields like CurrencyPrices in UpdateProductInput.

Development and Tooling Updates

  • Expanded .dockerignore to exclude unnecessary files and directories, reducing the Docker build context size.
  • Added a comprehensive Makefile with commands for database management, application setup, testing, and development workflows.

Minor Improvements and Fixes

  • Simplified error handling in OrderUseCase methods and adjusted FailOrder to accept an Order entity instead of an ID. [1] [2] [3]
  • Removed redundant logic from seedProductVariants and optimized handling of has_variants for products with multiple variants. [1] [2] [3]

gustaavik added 21 commits June 6, 2025 19:29
… instead of ShippingMethod, enhancing shipping cost calculation and DTO structure
- Rename conversion function from `ConvertToCheckoutDTO` to `toCheckoutDTO` for consistency.
- Update tests to reflect the new function name.
- Modify `SuccessResponseWithMessage` to accept pointer types for better handling of nil values.
- Implement `ConvertToOrderDTO` function to streamline order conversion logic.
- Refactor API handlers to utilize new response creation methods and reduce redundancy in error handling.
- Enhance pagination logic in admin checkout listing.
…teProductInput and introduce Weight; enhance error responses in product handler
…ted orders and active checkouts; update repositories and tests accordingly
@gustaavik gustaavik merged commit af553cd into main Jun 14, 2025
5 checks 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.

1 participant