feat: Add build status docs and fix proto dependencies
This commit is contained in:
177
docs/PROTO-DEPENDENCIES.md
Normal file
177
docs/PROTO-DEPENDENCIES.md
Normal file
@@ -0,0 +1,177 @@
|
||||
# BackOffice Proto Dependencies
|
||||
|
||||
> این فایل وابستگیهای proto بین BackOffice UI و BackOffice.BFF را مستند میکند
|
||||
|
||||
## Proto های موجود در BackOffice.BFF
|
||||
|
||||
| Proto Project | وضعیت | نوع Reference در UI |
|
||||
|---------------|-------|---------------------|
|
||||
| Category.Protobuf | ✅ موجود | NuGet |
|
||||
| ClubMembership.Protobuf | ✅ موجود | ProjectReference |
|
||||
| Commission.Protobuf | ✅ موجود | ProjectReference |
|
||||
| Common.Protobuf | ✅ موجود | ProjectReference |
|
||||
| Configuration.Protobuf | ✅ موجود | ProjectReference |
|
||||
| Health.Protobuf | ✅ موجود | ProjectReference |
|
||||
| ManualPayment.Protobuf | ✅ موجود | ProjectReference |
|
||||
| NetworkMembership.Protobuf | ✅ موجود | ProjectReference |
|
||||
| Otp.Protobuf | ✅ موجود | NuGet |
|
||||
| Package.Protobuf | ✅ موجود | NuGet |
|
||||
| Products.Protobuf | ✅ موجود | **ProjectReference** (تغییر داده شد) |
|
||||
| PublicMessage.Protobuf | ✅ موجود | ProjectReference |
|
||||
| Role.Protobuf | ✅ موجود | NuGet |
|
||||
| User.Protobuf | ✅ موجود | NuGet |
|
||||
| UserAddress.Protobuf | ✅ موجود | NuGet |
|
||||
| UserOrder.Protobuf | ✅ موجود | NuGet |
|
||||
| UserRole.Protobuf | ✅ موجود | NuGet |
|
||||
|
||||
## Proto های مورد نیاز (وجود ندارند)
|
||||
|
||||
| Proto Project | صفحات وابسته | سرویسهای وابسته |
|
||||
|---------------|-------------|------------------|
|
||||
| DiscountProduct.Protobuf | `Pages/DiscountShop/*` | `Services/DiscountProduct/*` |
|
||||
| DiscountCategory.Protobuf | `Pages/DiscountShop/*` | `Services/DiscountCategory/*` |
|
||||
| DiscountOrder.Protobuf | `Pages/DiscountShop/*` | `Services/DiscountOrder/*` |
|
||||
| Tag.Protobuf | `Pages/Tag/*` | `Services/Tag/*` |
|
||||
| ProductTag.Protobuf | `Pages/Products/BulkEdit` | - |
|
||||
|
||||
## متدهای Proto مورد نیاز (وجود ندارند)
|
||||
|
||||
### UserOrder.Protobuf
|
||||
|
||||
```protobuf
|
||||
// متدهای جدید مورد نیاز
|
||||
rpc CancelOrder(CancelOrderRequest) returns (CancelOrderResponse);
|
||||
rpc ApplyDiscountToOrder(ApplyDiscountToOrderRequest) returns (ApplyDiscountToOrderResponse);
|
||||
rpc UpdateOrderStatus(UpdateOrderStatusRequest) returns (UpdateOrderStatusResponse);
|
||||
|
||||
// فیلدهای جدید در GetUserOrderResponse
|
||||
message GetUserOrderResponse {
|
||||
// ... existing fields ...
|
||||
int64 vat_amount = X;
|
||||
int32 vat_percentage = X;
|
||||
int64 vat_base_amount = X;
|
||||
int64 vat_total_amount = X;
|
||||
}
|
||||
|
||||
// PaymentStatus enum needs None value
|
||||
enum PaymentStatus {
|
||||
None = 0;
|
||||
Success = 1;
|
||||
Reject = 2;
|
||||
Pending = 3;
|
||||
}
|
||||
```
|
||||
|
||||
### Products.Protobuf
|
||||
|
||||
```protobuf
|
||||
// متدهای جدید مورد نیاز
|
||||
rpc AddProductImage(AddProductImageRequest) returns (AddProductImageResponse);
|
||||
rpc RemoveProductImage(RemoveProductImageRequest) returns (google.protobuf.Empty);
|
||||
|
||||
// فیلدهای جدید در CreateNewProductsRequest
|
||||
message CreateNewProductsRequest {
|
||||
// ... existing fields ...
|
||||
bytes image_file = X;
|
||||
bytes thumbnail_file = X;
|
||||
}
|
||||
|
||||
// یا بهتر:
|
||||
message ImageFileModel {
|
||||
bytes content = 1;
|
||||
string file_name = 2;
|
||||
string content_type = 3;
|
||||
}
|
||||
```
|
||||
|
||||
### ManualPayment.Protobuf
|
||||
|
||||
نیاز به بررسی - ممکن است متدهایی کم باشد
|
||||
|
||||
### PublicMessage.Protobuf
|
||||
|
||||
نیاز به بررسی - ممکن است متدهایی کم باشد
|
||||
|
||||
---
|
||||
|
||||
## نحوه ساخت Proto Project جدید
|
||||
|
||||
```bash
|
||||
# 1. ساخت پوشه
|
||||
mkdir -p BackOffice.BFF/src/Protobufs/BackOffice.BFF.Tag.Protobuf/Protos
|
||||
|
||||
# 2. ساخت csproj
|
||||
cat > BackOffice.BFF/src/Protobufs/BackOffice.BFF.Tag.Protobuf/BackOffice.BFF.Tag.Protobuf.csproj << 'EOF'
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net9.0</TargetFramework>
|
||||
<Nullable>enable</Nullable>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Protobuf Include="Protos\*.proto" GrpcServices="Client" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Google.Protobuf" Version="3.29.3" />
|
||||
<PackageReference Include="Grpc.Net.Client" Version="2.71.0" />
|
||||
<PackageReference Include="Grpc.Tools" Version="2.69.0">
|
||||
<PrivateAssets>all</PrivateAssets>
|
||||
<IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets>
|
||||
</PackageReference>
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
EOF
|
||||
|
||||
# 3. ساخت proto file
|
||||
cat > BackOffice.BFF/src/Protobufs/BackOffice.BFF.Tag.Protobuf/Protos/tag.proto << 'EOF'
|
||||
syntax = "proto3";
|
||||
|
||||
package tag;
|
||||
|
||||
option csharp_namespace = "BackOffice.BFF.Tag.Protobuf.Protos.Tag";
|
||||
|
||||
// ... define services and messages
|
||||
EOF
|
||||
|
||||
# 4. اضافه کردن به solution
|
||||
dotnet sln BackOffice.BFF/src/BackOffice.BFF.sln add BackOffice.BFF/src/Protobufs/BackOffice.BFF.Tag.Protobuf/BackOffice.BFF.Tag.Protobuf.csproj
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## تغییرات اعمال شده در Products.Protobuf
|
||||
|
||||
### Namespace Change
|
||||
```protobuf
|
||||
// FROM:
|
||||
option csharp_namespace = "CMSMicroservice.Protobuf.Protos.Products";
|
||||
|
||||
// TO:
|
||||
option csharp_namespace = "BackOffice.BFF.Products.Protobuf.Protos.Products";
|
||||
```
|
||||
|
||||
### اضافه شدن public_messages.proto
|
||||
فایل از `ClubMembership.Protobuf` کپی شد با namespace:
|
||||
```protobuf
|
||||
option csharp_namespace = "BackOffice.BFF.Products.Protobuf.Protos";
|
||||
```
|
||||
|
||||
### RPC های جدید
|
||||
```protobuf
|
||||
rpc GetProductGallery(GetProductGalleryRequest) returns (GetProductGalleryResponse);
|
||||
rpc GetCategories(GetCategoriesRequest) returns (GetCategoriesResponse);
|
||||
rpc UpdateProductCategories(UpdateProductCategoriesRequest) returns (google.protobuf.Empty);
|
||||
rpc GetProductsForCategory(GetProductsForCategoryRequest) returns (GetProductsForCategoryResponse);
|
||||
rpc UpdateCategoryProducts(UpdateCategoryProductsRequest) returns (google.protobuf.Empty);
|
||||
```
|
||||
|
||||
### Message های جدید
|
||||
- CategoryItem
|
||||
- CategoryProductItem
|
||||
- GetProductGalleryRequest/Response
|
||||
- ProductGalleryImage
|
||||
- GetCategoriesRequest/Response
|
||||
- UpdateProductCategoriesRequest
|
||||
- GetProductsForCategoryRequest/Response
|
||||
- UpdateCategoryProductsRequest
|
||||
Reference in New Issue
Block a user