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

[Back] EF Optimize | ProductDetachCategory | ProductPatchCategory - [Front] AdminProductCategory | X-Update | TypeNamespace #95

Merged
merged 3 commits into from
Jan 23, 2024

Conversation

Aloento
Copy link
Owner

@Aloento Aloento commented Jan 23, 2024

No description provided.

…atchCategory` method in `Patch.cs` and the modification of the `AdminProductCategory` function in `Category.tsx`. The `ProductPatchCategory` method now includes a more comprehensive check and handling of product categories, including the creation of new categories, checking if the current category is in use, and deleting unused categories. The `AdminProductCategory` function has been updated to include a check for the truthiness of `cate` before calling the `run` function.

Changes:

1. Refactored the `ProductPatchCategory` method in `Patch.cs` to include a more comprehensive check and handling of product categories. The method now checks if the new category exists, creates a new one if it doesn't, checks if the product's current category is the same as the new one, checks if the current category is in use if they are not the same and the current category is not null, deletes the current category if it's not in use, assigns the new category to the product, and saves the changes to the database.

2. Modified the `AdminProductCategory` function in `Category.tsx` to check if `cate` is truthy before calling the `run` function. If `cate` is falsy, the function does nothing.

3. Imported the `Subtitle2` component from `@fluentui/react-components` in `Card.tsx` and updated the `GalleryCard` function to wrap the `Link` component inside a `Subtitle2` component in the `CardFooter`.

4. Updated the `version` in the author comment for the `GalleryCard` function in `Card.tsx` from `0.1.4` to `0.1.5`.
…ramework Plus library in the `Delete.cs` and `Patch.cs` files, and the Entity Framework Extensions library in the `Program.cs` file. This is indicated by the addition of the `Z.EntityFramework.Plus` and `Z.EntityFramework.Extensions` namespaces respectively. The methods in these files have been updated to use the new features provided by these libraries. Additionally, the `SoarCraft.AwaiShop.csproj` project file has been updated with new NuGet packages and versions.

Changes:

1. The `.editorconfig` file was updated to change the preferences for unused value assignment and expression statement from `discard_variable` to `unused_local_variable`.
2. The `Z.EntityFramework.Plus` namespace was added to `Delete.cs` and `Patch.cs` files, indicating the use of the Entity Framework Plus library.
3. The `ProductDeleteType` method in `Delete.cs` was updated to use the `IncludeOptimized` method from Entity Framework Plus.
4. A new method `ProductDeleteCategory` was added to `Delete.cs`, which deletes a category from a product if the category has no other products.
5. The `ProductPatchCategory` method in `Patch.cs` was updated to use the `DeferredSingle` and `DeferredSingleOrDefault` methods from Entity Framework Plus.
6. The `Z.EntityFramework.Extensions` namespace was added to `Program.cs`, indicating the use of the Entity Framework Extensions library.
7. The `EntityFrameworkManager.IsCommunity` property was set to `true` in `Program.cs`, indicating the use of the community version of Entity Framework Extensions.
8. The versions of several NuGet packages were updated in `SoarCraft.AwaiShop.csproj`.
9. The `Z.EntityFramework.Plus.EFCore` package was added to `SoarCraft.AwaiShop.csproj`, indicating the use of the Entity Framework Plus library in the project.
10. The `ProductData` import and `AdminProductGet` import were added to `Delete.ts`, and the `useProduct` and `useCategory` methods were updated to use these imports.
11. The `SignalR.ts` file was updated to change the cache expiration time from 1 month to 1 week.
12. The `Get` method in `Table.ts` was updated to change the `expire` parameter from optional to required.
…dding new types and methods, and updating import statements across multiple files. The `ProductDeleteCategory` method in `Delete.cs` has been renamed to `ProductDetachCategory`, and the import statements in `OrderInfo.tsx`, `Delete.ts`, `Get.ts`, and `Post.ts` have been updated. New types have been added to `Entity.ts` and `Data.ts`, and new methods have been added to `Get.ts`, `Data.ts`, and `Get.tsx`. The `Order` and `Comment` methods in `Entity.ts`, the `Product`, `Lexical`, `Photo`, `Type`, and `Variant` methods in `Data.ts`, and the `useMe` method in `Get.tsx` have been updated. The `OrderGet` class in `Get.ts` and the `ProductGet` class in `Get.ts` now extend `OrderEntity` and `ProductData` respectively.

1. The method `ProductDeleteCategory` in `Delete.cs` has been renamed to `ProductDetachCategory`.
2. The import statement in `OrderInfo.tsx` has been updated to include `OrderEntity` from `"~/ShopNet/Order/Entity"`.
3. The `Order` type in `OrderInfo.tsx` has been changed from `Awaited<ReturnType<typeof Hub.Order.Get.Order>>` to `OrderEntity.Order`.
4. The version annotation in `Category.tsx` has been updated from `0.3.2` to `0.3.4`.
5. New code has been added to `Category.tsx` to handle the detaching of a category from a product.
6. The import statement in `Delete.ts` has been updated to remove `dayjs`.
7. The `useProduct` method in `Delete.ts` has been updated to use `AdminProductGet.ListUpdate` instead of `this.UpdateCache`.
8. The `useCategory` method in `Delete.ts` has been updated to use `ProductDetachCategory` instead of `ProductDeleteCategory` and `ProductData.ProductUpdate` instead of `this.UpdateCache`.
9. The import statement in `Get.ts` has been updated to include `dayjs`.
10. The `useList` method in `Get.ts` has been updated to use `this.list` instead of `"ProductGetList"`, and a new method `ListUpdate` has been added.
11. The import statement in `Post.ts` has been updated to remove `dayjs` and include `AdminProductGet`.
12. The `useCreate` method in `Post.ts` has been updated to use `AdminProductGet.ListUpdate` instead of `this.UpdateCache`.
13. New types have been added to `Entity.ts` under the namespace `OrderEntity`.
14. The `Order` and `Comment` methods in `Entity.ts` have been updated to return the new types from `OrderEntity`.
15. The import statement in `Get.ts` has been updated to remove `ShopNet` and include `OrderEntity`.
16. The `OrderGet` class in `Get.ts` now extends `OrderEntity` instead of `ShopNet`.
17. The `PhotoList` method in `Get.ts` has been updated to return `ProductData.Photo[]` instead of `Awaited<ReturnType<typeof this.Photo>>[]`.
18. The `Order` method in `Get.ts` has been removed.
19. New types have been added to `Data.ts` under the namespace `ProductData`.
20. The `Product`, `Lexical`, `Photo`, `Type`, and `Variant` methods in `Data.ts` have been updated to return the new types from `ProductData`.
21. A new method `ProductUpdate` has been added to `Data.ts`.
22. The `ProductGet` class in `Get.ts` now extends `ProductData` instead of `ShopNet`.
23. The `useMe` method in `Get.tsx` has been updated to return `UserGet.Me` instead of `IUserGetMe`.
24. A new method `MeUpdate` has been added to `Get.tsx`.
25. The `useUpdate` method in `Post.ts` has been updated to use `UserGet.MeUpdate` instead of `this.UpdateCache`.
@Aloento Aloento self-assigned this Jan 23, 2024
@Aloento Aloento merged commit 514e56a into master Jan 23, 2024
1 check passed
@Aloento Aloento deleted the Dev branch January 23, 2024 22:21
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