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

🩹[Fix]: Separate File system operations and database operations for images in internal/queries/products.go #187

Open
jesuisdolfin opened this issue Mar 3, 2025 · 0 comments

Comments

@jesuisdolfin
Copy link

Upon reviewing the internal/queries/product.go file, I observed that the deleteImage method currently handles two distinct responsibilities: deleting the image associated with the product and removing the file path linked to the image. This implementation results in a high level of coupling between the database logic and the filesystem logic.

To improve the design and maintainability of the code, I would suggest separating these two functionalities into distinct methods. This approach would effectively reduce the coupling and ensure that the deleteImage method has a single, well-defined responsibility. Such a change would align with the Single Responsibility Principle, promoting cleaner and more modular code. Additionally, it would enhance the overall decoupling of the file, making the system easier to maintain and extend in the future.

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

No branches or pull requests

1 participant