Skip to content
This repository has been archived by the owner on Mar 24, 2024. It is now read-only.

[Back] ProductDetachCategory | ProductPostPhoto | PhotoEntity - [Front] AdminProductPhotoEdit | AdminProductPhoto #96

Merged
merged 2 commits into from
Jan 25, 2024

Conversation

Aloento
Copy link
Owner

@Aloento Aloento commented Jan 25, 2024

No description provided.

…ds 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.
@Aloento Aloento self-assigned this Jan 25, 2024
@Aloento Aloento merged commit 1a5fa23 into master Jan 25, 2024
1 check passed
@Aloento Aloento deleted the Dev branch January 25, 2024 20:23
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant