This repository has been archived by the owner on Mar 24, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Back] ProductDetachCategory | ProductPostPhoto | PhotoEntity - [Fron…
…t] AdminProductPhotoEdit | AdminProductPhoto (#96) * The most significant changes revolve around the modification of methods and classes related to product photos in an e-commerce application. The changes aim to improve readability, efficiency, and real-time responsiveness of the application. The changes also allow the application to handle more complex scenarios, better track and manage photos, and improve cache management. 1. `ProductDetachCategory` method in `Delete.cs` has been refactored for improved readability and efficiency. It now checks if the product has a category before removing it and deletes the category if it has no associated products. The method now returns a boolean indicating the success of the operation. 2. `ProductPostPhoto` method in `Post.cs` has been modified to return the ID of the newly added photo instead of a boolean, providing more useful information to the caller. 3. `PhotoEntity` method in `Entity.cs` has been simplified to return a single photo entity based on its ID. 4. `AdminProductPhotoEdit` function in `Edit.tsx` now takes an additional `ProductId` property, allowing it to perform operations related to the product that the photo belongs to. 5. `AdminProductPhoto` function in `index.tsx` now uses the `useLiveQuery` hook from `dexie-react-hooks` to fetch photo data, improving the real-time responsiveness of the application. 6. `usePhoto` methods in `Delete.ts` and `Post.ts` have been updated to take additional parameters and perform additional operations, allowing them to handle more complex scenarios. 7. `Photo` type in `Data.ts` has been updated to include `PhotoId` and `ProductId` properties, allowing the application to better track and manage photos. 8. `PhotoList` method in `Get.ts` has been updated to use a constant for the cache key, and a new `PhotoListUpdate` method has been added, improving the cache management of the application. * Refactor photo update logic and remove unused code
- Loading branch information
Showing
10 changed files
with
79 additions
and
80 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
Oops, something went wrong.