Add category service and product category support

This commit is contained in:
masoodafar-web
2025-11-28 11:00:59 +03:30
parent f8ad0a6845
commit 518285531a
16 changed files with 345 additions and 5 deletions
@@ -0,0 +1,25 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net7.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<Version>0.0.1</Version>
<PackageId>Foursat.FrontOffice.BFF.Category.Protobuf</PackageId>
<GeneratePackageOnBuild>False</GeneratePackageOnBuild>
<DebugSymbols>False</DebugSymbols>
<DebugType>None</DebugType>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Google.Protobuf" Version="3.23.3" />
<PackageReference Include="Grpc.Core.Api" Version="2.54.0" />
<PackageReference Include="FluentValidation.DependencyInjectionExtensions" Version="11.2.2" />
<PackageReference Include="Google.Api.CommonProtos" Version="2.10.0" />
<PackageReference Include="Grpc.Tools" Version="2.55.1">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
</ItemGroup>
<ItemGroup>
<Protobuf Include="Protos\category.proto" ProtoRoot="Protos\" GrpcServices="Both" />
</ItemGroup>
</Project>
@@ -0,0 +1,32 @@
syntax = "proto3";
package category;
import "google/protobuf/empty.proto";
import "google/protobuf/wrappers.proto";
import "google/protobuf/duration.proto";
import "google/protobuf/timestamp.proto";
option csharp_namespace = "FrontOffice.BFF.Category.Protobuf.Protos.Category";
service CategoryContract {
rpc GetAllCategories(GetCategoriesRequest) returns (GetCategoriesResponse);
}
message GetCategoriesRequest {
google.protobuf.Int64Value parent_id = 1;
}
message GetCategoriesResponse {
repeated CategoryDto categories = 1;
}
message CategoryDto {
int64 id = 1;
string name = 2;
string title = 3;
google.protobuf.StringValue description = 4;
google.protobuf.StringValue image_path = 5;
google.protobuf.Int64Value parent_id = 6;
bool is_active = 7;
int32 sort_order = 8;
}
@@ -3,7 +3,7 @@
<TargetFramework>net7.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<Version>0.0.12</Version>
<Version>0.0.13</Version>
<PackageId>Foursat.FrontOffice.BFF.Products.Protobuf</PackageId>
<GeneratePackageOnBuild>False</GeneratePackageOnBuild>
<DebugSymbols>False</DebugSymbols>
@@ -45,6 +45,7 @@ message GetProductsResponse
int32 view_count = 12;
int32 remaining_count = 13;
repeated ProductGalleryItem gallery = 14;
repeated ProductCategoryPath categories = 15;
}
message GetAllProductsByFilterRequest
{
@@ -62,6 +63,7 @@ message GetAllProductsByFilterFilter
google.protobuf.Int64Value price = 6;
google.protobuf.Int32Value discount = 7;
google.protobuf.Int32Value rate = 8;
google.protobuf.Int64Value category_id = 9;
}
message GetAllProductsByFilterResponse
{
@@ -83,6 +85,7 @@ message GetAllProductsByFilterResponseModel
int32 sale_count = 11;
int32 view_count = 12;
int32 remaining_count = 13;
repeated ProductCategoryPath categories = 14;
}
message ProductGalleryItem
@@ -94,6 +97,20 @@ message ProductGalleryItem
string image_thumbnail_path = 5;
}
message ProductCategoryPath
{
int64 category_id = 1;
string title = 2;
repeated CategoryNode path = 3;
}
message CategoryNode
{
int64 id = 1;
string title = 2;
google.protobuf.Int64Value parent_id = 3;
}
message PaginationState
{
int32 page_number = 1;