Add response DTOs for withdrawal and club activation commands

This commit is contained in:
masoodafar-web
2025-11-30 23:39:31 +03:30
parent 698c044be6
commit bfeb6456af
56 changed files with 3043 additions and 1 deletions

593
docs/cms-integration.md Normal file
View File

@@ -0,0 +1,593 @@
# BackOffice.BFF - CMS Integration Documentation
**Date**: 2025-11-30
**Status**: ✅ Integrated
**CMS Package Version**: 0.0.140
---
## 📋 Overview
BackOffice.BFF به CMS Microservice متصل شد و حالا می‌تواند به سرویس‌های Network-Club-Commission دسترسی داشته باشد.
این Integration به BackOffice امکان می‌دهد:
- مدیریت کامیسیون‌های کاربران
- مشاهده ساختار شبکه Binary Tree
- فعال/غیرفعال کردن عضویت باشگاه
- مشاهده گزارشات هفتگی کمیسیون
---
## 🏗️ Architecture
```
┌─────────────────────────────────────────────────────────┐
│ BackOffice.BFF (API Gateway) │
│ │
│ ┌──────────────────────────────────────────────────┐ │
│ │ IApplicationContractContext │ │
│ │ - Users (existing) │ │
│ │ - Products (existing) │ │
│ │ - Orders (existing) │ │
│ │ ✨ Commissions (NEW) │ │
│ │ ✨ NetworkMemberships (NEW) │ │
│ │ ✨ ClubMemberships (NEW) │ │
│ └──────────────────────────────────────────────────┘ │
│ ↓ gRPC │
└─────────────────────────────────────────────────────────┘
┌─────────────────────────────────────────────────────────┐
│ CMS Microservice │
│ https://cms.kbs1.ir │
│ │
│ ┌─────────────────────┐ ┌─────────────────────────┐ │
│ │ CommissionContract │ │ NetworkMembershipContract│ │
│ │ - GetWeeklyPool │ │ - GetUserNetworkInfo │ │
│ │ - GetUserPayouts │ │ - GetNetworkTree │ │
│ │ - ProcessWithdrawal │ │ - CalculateLegBalances │ │
│ └─────────────────────┘ └─────────────────────────┘ │
│ │
│ ┌─────────────────────┐ │
│ │ ClubMembershipContract│ │
│ │ - ActivateClub │ │
│ │ - DeactivateClub │ │
│ │ - GetClubStatus │ │
│ └─────────────────────┘ │
└─────────────────────────────────────────────────────────┘
```
---
## 📦 Integration Details
### 1⃣ NuGet Package
**Package**: `Foursat.CMSMicroservice.Protobuf`
**Version**: `0.0.140` (Updated from 0.0.137)
**File**: `/BackOffice.BFF/src/BackOffice.BFF.Domain/BackOffice.BFF.Domain.csproj`
```xml
<PackageReference Include="Foursat.CMSMicroservice.Protobuf" Version="0.0.140" />
```
**What's New in 0.0.140**:
-`commission.proto` - Commission system contracts
-`networkmembership.proto` - Binary tree network contracts
-`clubmembership.proto` - Club membership contracts
-`configuration.proto` - System configuration contracts
---
### 2⃣ Interface Definition
**File**: `/BackOffice.BFF/src/BackOffice.BFF.Application/Common/Interfaces/IApplicationContractContext.cs`
```csharp
public interface IApplicationContractContext
{
// ... existing services ...
// Network & Commission System (NEW)
CommissionContract.CommissionContractClient Commissions { get; }
NetworkMembershipContract.NetworkMembershipContractClient NetworkMemberships { get; }
ClubMembershipContract.ClubMembershipContractClient ClubMemberships { get; }
}
```
---
### 3⃣ Implementation
**File**: `/BackOffice.BFF/src/BackOffice.BFF.Infrastructure/Services/ApplicationContractContext.cs`
```csharp
public class ApplicationContractContext : IApplicationContractContext
{
// ... existing implementations ...
// Network & Commission System
public CommissionContract.CommissionContractClient Commissions
=> GetService<CommissionContract.CommissionContractClient>();
public NetworkMembershipContract.NetworkMembershipContractClient NetworkMemberships
=> GetService<NetworkMembershipContract.NetworkMembershipContractClient>();
public ClubMembershipContract.ClubMembershipContractClient ClubMemberships
=> GetService<ClubMembershipContract.ClubMembershipContractClient>();
}
```
---
### 4⃣ gRPC Configuration
**File**: `/BackOffice.BFF/src/BackOffice.BFF.WebApi/appsettings.json`
```json
{
"GrpcChannelOptions": {
"FMSMSAddress": "https://dl.afrino.co",
"CMSMSAddress": "https://cms.kbs1.ir"
}
}
```
**Auto-Registration**:
- gRPC clients به صورت خودکار توسط `ConfigureGrpcServices.BatchRegisterGrpcClients()` ثبت می‌شوند
- بر اساس نام Assembly (`CMSMicroservice.Protobuf`)
- با Address مشخص شده در `appsettings.json`
---
## 🔌 Available Services
### 1⃣ CommissionContract
**Namespace**: `CMSMicroservice.Protobuf.Protos.Commission`
#### Commands:
```csharp
// محاسبه بالانس های هفتگی
await _context.Commissions.CalculateWeeklyBalancesAsync(
new CalculateWeeklyBalancesRequest { WeekNumber = "2025-W48" });
// محاسبه Pool هفتگی
await _context.Commissions.CalculateWeeklyCommissionPoolAsync(
new CalculateWeeklyCommissionPoolRequest { WeekNumber = "2025-W48" });
// پردازش Payout های کاربران
await _context.Commissions.ProcessUserPayoutsAsync(
new ProcessUserPayoutsRequest { WeekNumber = "2025-W48" });
// درخواست برداشت توسط کاربر
await _context.Commissions.RequestWithdrawalAsync(
new RequestWithdrawalRequest
{
UserId = 123,
Amount = 500000
});
// پردازش برداشت (توسط Admin)
await _context.Commissions.ProcessWithdrawalAsync(
new ProcessWithdrawalRequest
{
PayoutId = 456,
Status = WithdrawalStatus.Approved
});
```
#### Queries:
```csharp
// دریافت Pool هفتگی
var pool = await _context.Commissions.GetWeeklyCommissionPoolAsync(
new GetWeeklyCommissionPoolRequest { WeekNumber = "2025-W48" });
// دریافت Payout های یک کاربر
var payouts = await _context.Commissions.GetUserPayoutsAsync(
new GetUserPayoutsRequest
{
UserId = 123,
PageNumber = 1,
PageSize = 10
});
// دریافت تاریخچه Withdrawal ها
var withdrawals = await _context.Commissions.GetWithdrawalHistoryAsync(
new GetWithdrawalHistoryRequest
{
UserId = 123,
Status = WithdrawalStatus.Pending
});
```
---
### 2⃣ NetworkMembershipContract
**Namespace**: `CMSMicroservice.Protobuf.Protos.NetworkMembership`
#### Queries:
```csharp
// دریافت اطلاعات شبکه یک کاربر
var networkInfo = await _context.NetworkMemberships.GetUserNetworkInfoAsync(
new GetUserNetworkInfoRequest { UserId = 123 });
// دریافت درخت شبکه (Binary Tree)
var tree = await _context.NetworkMemberships.GetNetworkTreeAsync(
new GetNetworkTreeRequest
{
RootUserId = 123,
MaxDepth = 5
});
// دریافت بالانس های هفتگی
var balances = await _context.NetworkMemberships.GetUserWeeklyBalancesAsync(
new GetUserWeeklyBalancesRequest
{
UserId = 123,
WeekNumber = "2025-W48"
});
// محاسبه بالانس Leg های یک کاربر
var legBalances = await _context.NetworkMemberships.CalculateLegBalancesAsync(
new CalculateLegBalancesRequest { UserId = 123 });
```
---
### 3⃣ ClubMembershipContract
**Namespace**: `CMSMicroservice.Protobuf.Protos.ClubMembership`
#### Commands:
```csharp
// فعال کردن عضویت باشگاه
await _context.ClubMemberships.ActivateClubMembershipAsync(
new ActivateClubMembershipRequest
{
UserId = 123,
ActivationDate = Timestamp.FromDateTime(DateTime.UtcNow)
});
// غیرفعال کردن عضویت باشگاه
await _context.ClubMemberships.DeactivateClubMembershipAsync(
new DeactivateClubMembershipRequest
{
UserId = 123,
Reason = "User request"
});
```
#### Queries:
```csharp
// دریافت وضعیت عضویت باشگاه
var status = await _context.ClubMemberships.GetClubMembershipStatusAsync(
new GetClubMembershipStatusRequest { UserId = 123 });
// لیست تمام اعضای باشگاه
var members = await _context.ClubMemberships.GetAllClubMembersAsync(
new GetAllClubMembersRequest
{
IsActive = true,
PageNumber = 1,
PageSize = 20
});
```
---
## 📝 Usage Example in BFF
### Example 1: Create Commission Query Handler
**File**: `/BackOffice.BFF/src/BackOffice.BFF.Application/CommissionCQ/Queries/GetUserPayouts/GetUserPayoutsQuery.cs`
```csharp
public record GetUserPayoutsQuery : IRequest<GetUserPayoutsResponseDto>
{
public long UserId { get; init; }
public int PageNumber { get; init; } = 1;
public int PageSize { get; init; } = 10;
}
public class GetUserPayoutsQueryHandler
: IRequestHandler<GetUserPayoutsQuery, GetUserPayoutsResponseDto>
{
private readonly IApplicationContractContext _context;
public GetUserPayoutsQueryHandler(IApplicationContractContext context)
{
_context = context;
}
public async Task<GetUserPayoutsResponseDto> Handle(
GetUserPayoutsQuery request,
CancellationToken cancellationToken)
{
var response = await _context.Commissions.GetUserPayoutsAsync(
request.Adapt<GetUserPayoutsRequest>(),
cancellationToken: cancellationToken);
return response.Adapt<GetUserPayoutsResponseDto>();
}
}
```
---
### Example 2: Create Network Tree Query Handler
**File**: `/BackOffice.BFF/src/BackOffice.BFF.Application/NetworkCQ/Queries/GetNetworkTree/GetNetworkTreeQuery.cs`
```csharp
public record GetNetworkTreeQuery : IRequest<GetNetworkTreeResponseDto>
{
public long RootUserId { get; init; }
public int MaxDepth { get; init; } = 5;
}
public class GetNetworkTreeQueryHandler
: IRequestHandler<GetNetworkTreeQuery, GetNetworkTreeResponseDto>
{
private readonly IApplicationContractContext _context;
public GetNetworkTreeQueryHandler(IApplicationContractContext context)
{
_context = context;
}
public async Task<GetNetworkTreeResponseDto> Handle(
GetNetworkTreeQuery request,
CancellationToken cancellationToken)
{
var response = await _context.NetworkMemberships.GetNetworkTreeAsync(
request.Adapt<GetNetworkTreeRequest>(),
cancellationToken: cancellationToken);
return response.Adapt<GetNetworkTreeResponseDto>();
}
}
```
---
### Example 3: Create Club Activation Command Handler
**File**: `/BackOffice.BFF/src/BackOffice.BFF.Application/ClubCQ/Commands/ActivateClub/ActivateClubCommand.cs`
```csharp
public record ActivateClubCommand : IRequest<Unit>
{
public long UserId { get; init; }
public DateTimeOffset? ActivationDate { get; init; }
}
public class ActivateClubCommandHandler
: IRequestHandler<ActivateClubCommand, Unit>
{
private readonly IApplicationContractContext _context;
public ActivateClubCommandHandler(IApplicationContractContext context)
{
_context = context;
}
public async Task<Unit> Handle(
ActivateClubCommand request,
CancellationToken cancellationToken)
{
await _context.ClubMemberships.ActivateClubMembershipAsync(
request.Adapt<ActivateClubMembershipRequest>(),
cancellationToken: cancellationToken);
return Unit.Value;
}
}
```
---
## 🔐 Authentication & Authorization
**JWT Token**:
- BackOffice.BFF به CMS با JWT Token متصل می‌شود
- Token از `ITokenProvider` گرفته می‌شود
- در Header با کلید `Authorization: Bearer {token}` ارسال می‌شود
**Implementation در `ConfigureGrpcServices.cs`**:
```csharp
private static async Task CallCredentials(
AuthInterceptorContext context,
Metadata metadata,
IServiceProvider serviceProvider)
{
var provider = serviceProvider.GetRequiredService<ITokenProvider>();
var token = await provider.GetTokenAsync();
metadata.Add("Authorization", $"Bearer {token}");
}
```
---
## 🧪 Testing
### Test Connection:
```csharp
// در یک Controller یا Handler:
var pool = await _context.Commissions.GetWeeklyCommissionPoolAsync(
new GetWeeklyCommissionPoolRequest { WeekNumber = "2025-W48" });
Console.WriteLine($"Total Pool Value: {pool.TotalPoolValue}");
Console.WriteLine($"Active Members: {pool.ActiveMembersCount}");
```
**Expected Output**:
```
Total Pool Value: 50000000
Active Members: 120
```
---
### Test with Postman/Swagger:
1. Start BackOffice.BFF:
```bash
cd /home/masoud/Apps/project/FourSat/BackOffice.BFF/src
dotnet run --project BackOffice.BFF.WebApi
```
2. Call API endpoint (example):
```http
GET /api/commission/weekly-pool?weekNumber=2025-W48
Authorization: Bearer {your-token}
```
3. Expected Response:
```json
{
"weekNumber": "2025-W48",
"totalPoolValue": 50000000,
"activeMembersCount": 120,
"isCalculated": true
}
```
---
## 📊 Status & Metrics
| Component | Status | Version | Notes |
|-----------|--------|---------|-------|
| **CMS Protobuf Package** | ✅ Active | 0.0.140 | With Network-Club-Commission |
| **gRPC Connection** | ✅ Configured | - | https://cms.kbs1.ir |
| **Auto-Registration** | ✅ Active | - | Via BatchRegisterGrpcClients |
| **Commission Client** | ✅ Ready | - | All commands & queries available |
| **Network Client** | ✅ Ready | - | Binary tree queries available |
| **Club Client** | ✅ Ready | - | Activation/Deactivation available |
| **Authentication** | ✅ Configured | JWT | Via ITokenProvider |
---
## 🔗 Related Documentation
### CMS Side:
- **Implementation Progress**: `/CMS/docs/implementation-progress.md`
- **Network System Design**: `/CMS/docs/network-club-commission-system.md`
- **Monitoring Setup**: `/CMS/docs/monitoring-alerts-consolidated-report.md`
- **Migration Guide**: `/CMS/docs/migration-network-parent-guide.md`
- **Binary Tree Registration**: `/CMS/docs/binary-tree-registration-guide.md`
### BFF Side:
- **This Document**: `/BackOffice.BFF/docs/cms-integration.md`
- **README**: `/BackOffice.BFF/README.md`
---
## 🚀 Next Steps
### Immediate:
1. ✅ Integration completed
2. ⏳ Create Commission/Network/Club CQRS handlers in BFF
3. ⏳ Add API endpoints in BackOffice.BFF.WebApi
4. ⏳ Test integration with real data
### Short-term:
5. ⏳ Add Swagger documentation for new endpoints
6. ⏳ Implement error handling for gRPC calls
7. ⏳ Add logging for commission operations
8. ⏳ Create admin dashboard for network visualization
### Long-term:
9. ⏳ Add real-time notifications (SignalR) for commission updates
10. ⏳ Implement caching for frequently accessed data
11. ⏳ Add reporting/analytics endpoints
12. ⏳ Performance optimization for large network trees
---
## 📞 Troubleshooting
### Issue 1: gRPC Connection Failed
**Error**: `Status(StatusCode="Unavailable", Detail="...")`
**Solutions**:
1. Check CMS service is running: `https://cms.kbs1.ir`
2. Verify network connectivity
3. Check firewall settings
4. Verify SSL certificate is valid
---
### Issue 2: Authentication Failed
**Error**: `Status(StatusCode="Unauthenticated", Detail="...")`
**Solutions**:
1. Verify `ITokenProvider` is registered in DI
2. Check JWT token is valid and not expired
3. Verify token has correct claims/permissions
4. Check Authorization header is being sent
---
### Issue 3: Package Version Mismatch
**Error**: `The type or namespace 'CommissionContract' could not be found`
**Solutions**:
1. Update package version in `.csproj`:
```xml
<PackageReference Include="Foursat.CMSMicroservice.Protobuf" Version="0.0.140" />
```
2. Run `dotnet restore`
3. Clean and rebuild solution
---
### Issue 4: Method Not Found
**Error**: `Method 'GetWeeklyPool' not found on service 'CommissionContract'`
**Solutions**:
1. Verify CMS service has the latest code deployed
2. Check Protobuf contract matches between CMS and BFF
3. Update both CMS and BFF to latest versions
4. Restart both services
---
## 🎯 Summary
### ✅ Completed:
- CMS Protobuf package updated to 0.0.140
- 3 new gRPC clients added to BFF:
* CommissionContract (8+ methods)
* NetworkMembershipContract (6+ methods)
* ClubMembershipContract (4+ methods)
- Auto-registration configured
- Authentication via JWT configured
- Build successful (0 errors)
### ⏳ Pending:
- Create CQRS handlers for Commission operations
- Create CQRS handlers for Network operations
- Create CQRS handlers for Club operations
- Add API Controllers/Endpoints
- Add Swagger documentation
- Integration testing
### 🔑 Key Points:
- **No manual registration needed**: gRPC clients auto-register via `BatchRegisterGrpcClients()`
- **Authentication handled**: JWT token automatically added to all requests
- **Type-safe**: All Protobuf contracts are strongly typed
- **Easy to use**: Simple interface via `IApplicationContractContext`
---
**Last Updated**: 2025-11-30
**Build Status**: ✅ Success
**Ready for**: Handler implementation & API endpoint creation

View File

@@ -17,6 +17,7 @@
<ItemGroup> <ItemGroup>
<ProjectReference Include="..\BackOffice.BFF.Domain\BackOffice.BFF.Domain.csproj" /> <ProjectReference Include="..\BackOffice.BFF.Domain\BackOffice.BFF.Domain.csproj" />
<ProjectReference Include="..\Protobufs\BackOffice.BFF.UserOrder.Protobuf\BackOffice.BFF.UserOrder.Protobuf.csproj" /> <ProjectReference Include="..\Protobufs\BackOffice.BFF.UserOrder.Protobuf\BackOffice.BFF.UserOrder.Protobuf.csproj" />
<ProjectReference Include="..\Protobufs\BackOffice.BFF.Commission.Protobuf\BackOffice.BFF.Commission.Protobuf.csproj" />
</ItemGroup> </ItemGroup>
</Project> </Project>

View File

@@ -0,0 +1,24 @@
namespace BackOffice.BFF.Application.ClubMembershipCQ.Commands.ActivateClub;
public record ActivateClubCommand : IRequest<ActivateClubResponseDto>
{
/// <summary>
/// شناسه کاربر
/// </summary>
public long UserId { get; init; }
/// <summary>
/// شناسه بسته (Package)
/// </summary>
public long PackageId { get; init; }
/// <summary>
/// کد فعال‌سازی (اختیاری)
/// </summary>
public string? ActivationCode { get; init; }
/// <summary>
/// مدت زمان عضویت به ماه (پیش‌فرض: 12)
/// </summary>
public int DurationMonths { get; init; } = 12;
}

View File

@@ -0,0 +1,38 @@
using CMSMicroservice.Protobuf.Protos.ClubMembership;
namespace BackOffice.BFF.Application.ClubMembershipCQ.Commands.ActivateClub;
public class ActivateClubCommandHandler : IRequestHandler<ActivateClubCommand, ActivateClubResponseDto>
{
private readonly IApplicationContractContext _context;
public ActivateClubCommandHandler(IApplicationContractContext context)
{
_context = context;
}
public async Task<ActivateClubResponseDto> Handle(ActivateClubCommand request, CancellationToken cancellationToken)
{
var grpcRequest = new ActivateClubMembershipRequest
{
UserId = request.UserId,
PackageId = request.PackageId,
DurationMonths = request.DurationMonths
};
// اگر کد فعال‌سازی ارسال شده، اضافه کن
if (!string.IsNullOrEmpty(request.ActivationCode))
{
grpcRequest.ActivationCode = request.ActivationCode;
}
var response = await _context.ClubMemberships.ActivateClubMembershipAsync(
grpcRequest,
cancellationToken: cancellationToken);
return new ActivateClubResponseDto
{
Message = "Club membership activated successfully"
};
}
}

View File

@@ -0,0 +1,9 @@
namespace BackOffice.BFF.Application.ClubMembershipCQ.Commands.ActivateClub;
public class ActivateClubResponseDto
{
/// <summary>
/// پیام موفقیت
/// </summary>
public string Message { get; set; } = "Club membership activated successfully";
}

View File

@@ -0,0 +1,19 @@
namespace BackOffice.BFF.Application.ClubMembershipCQ.Queries.GetAllClubMembers;
public record GetAllClubMembersQuery : IRequest<GetAllClubMembersResponseDto>
{
/// <summary>
/// فیلتر بر اساس وضعیت فعال/غیرفعال (null = همه)
/// </summary>
public bool? IsActive { get; init; }
/// <summary>
/// شماره صفحه (پیش‌فرض: 1)
/// </summary>
public int PageNumber { get; init; } = 1;
/// <summary>
/// تعداد در هر صفحه (پیش‌فرض: 20)
/// </summary>
public int PageSize { get; init; } = 20;
}

View File

@@ -0,0 +1,22 @@
using CMSMicroservice.Protobuf.Protos.ClubMembership;
namespace BackOffice.BFF.Application.ClubMembershipCQ.Queries.GetAllClubMembers;
public class GetAllClubMembersQueryHandler : IRequestHandler<GetAllClubMembersQuery, GetAllClubMembersResponseDto>
{
private readonly IApplicationContractContext _context;
public GetAllClubMembersQueryHandler(IApplicationContractContext context)
{
_context = context;
}
public async Task<GetAllClubMembersResponseDto> Handle(GetAllClubMembersQuery request, CancellationToken cancellationToken)
{
var response = await _context.ClubMemberships.GetAllClubMembershipsAsync(
request.Adapt<GetAllClubMembershipsRequest>(),
cancellationToken: cancellationToken);
return response.Adapt<GetAllClubMembersResponseDto>();
}
}

View File

@@ -0,0 +1,72 @@
namespace BackOffice.BFF.Application.ClubMembershipCQ.Queries.GetAllClubMembers;
public class GetAllClubMembersResponseDto
{
/// <summary>
/// لیست اعضای باشگاه
/// </summary>
public List<ClubMemberDto> Members { get; set; } = new();
/// <summary>
/// تعداد کل رکوردها
/// </summary>
public int TotalCount { get; set; }
/// <summary>
/// شماره صفحه فعلی
/// </summary>
public int PageNumber { get; set; }
/// <summary>
/// تعداد در هر صفحه
/// </summary>
public int PageSize { get; set; }
}
public class ClubMemberDto
{
/// <summary>
/// شناسه ClubMembership
/// </summary>
public long Id { get; set; }
/// <summary>
/// شناسه کاربر
/// </summary>
public long UserId { get; set; }
/// <summary>
/// نام کاربر
/// </summary>
public string UserName { get; set; } = string.Empty;
/// <summary>
/// تاریخ فعال‌سازی
/// </summary>
public DateTime ActivationDate { get; set; }
/// <summary>
/// مبلغ مشارکت اولیه (تومان)
/// </summary>
public decimal InitialContribution { get; set; }
/// <summary>
/// وضعیت فعال/غیرفعال
/// </summary>
public bool IsActive { get; set; }
/// <summary>
/// تاریخ غیرفعال شدن (در صورت وجود)
/// </summary>
public DateTime? DeactivationDate { get; set; }
/// <summary>
/// دلیل غیرفعال شدن (در صورت وجود)
/// </summary>
public string? DeactivationReason { get; set; }
/// <summary>
/// تاریخ ایجاد
/// </summary>
public DateTime CreatedAt { get; set; }
}

View File

@@ -0,0 +1,14 @@
namespace BackOffice.BFF.Application.CommissionCQ.Commands.ApproveWithdrawal;
public record ApproveWithdrawalCommand : IRequest<ApproveWithdrawalResponseDto>
{
/// <summary>
/// شناسه درخواست برداشت
/// </summary>
public long WithdrawalId { get; init; }
/// <summary>
/// یادداشت مدیر (اختیاری)
/// </summary>
public string? AdminNote { get; init; }
}

View File

@@ -0,0 +1,30 @@
using BackOffice.BFF.Commission.Protobuf;
namespace BackOffice.BFF.Application.CommissionCQ.Commands.ApproveWithdrawal;
public class ApproveWithdrawalCommandHandler : IRequestHandler<ApproveWithdrawalCommand, ApproveWithdrawalResponseDto>
{
private readonly IApplicationContractContext _context;
public ApproveWithdrawalCommandHandler(IApplicationContractContext context)
{
_context = context;
}
public async Task<ApproveWithdrawalResponseDto> Handle(ApproveWithdrawalCommand request, CancellationToken cancellationToken)
{
var grpcRequest = new ApproveWithdrawalRequest
{
WithdrawalId = request.WithdrawalId,
AdminNote = request.AdminNote ?? string.Empty
};
var response = await _context.Commissions.ApproveWithdrawalAsync(grpcRequest, cancellationToken: cancellationToken);
return new ApproveWithdrawalResponseDto
{
Success = response.Success,
Message = response.Message
};
}
}

View File

@@ -0,0 +1,7 @@
namespace BackOffice.BFF.Application.CommissionCQ.Commands.ApproveWithdrawal;
public record ApproveWithdrawalResponseDto
{
public bool Success { get; init; }
public string Message { get; init; } = string.Empty;
}

View File

@@ -0,0 +1,19 @@
namespace BackOffice.BFF.Application.CommissionCQ.Commands.ProcessWithdrawal;
public record ProcessWithdrawalCommand : IRequest<ProcessWithdrawalResponseDto>
{
/// <summary>
/// شناسه درخواست برداشت
/// </summary>
public long WithdrawalId { get; init; }
/// <summary>
/// شناسه تراکنش بانکی (اختیاری)
/// </summary>
public string? TransactionId { get; init; }
/// <summary>
/// یادداشت مدیر (اختیاری)
/// </summary>
public string? AdminNote { get; init; }
}

View File

@@ -0,0 +1,31 @@
using BackOffice.BFF.Commission.Protobuf;
namespace BackOffice.BFF.Application.CommissionCQ.Commands.ProcessWithdrawal;
public class ProcessWithdrawalCommandHandler : IRequestHandler<ProcessWithdrawalCommand, ProcessWithdrawalResponseDto>
{
private readonly IApplicationContractContext _context;
public ProcessWithdrawalCommandHandler(IApplicationContractContext context)
{
_context = context;
}
public async Task<ProcessWithdrawalResponseDto> Handle(ProcessWithdrawalCommand request, CancellationToken cancellationToken)
{
var grpcRequest = new ProcessWithdrawalRequest
{
WithdrawalId = request.WithdrawalId,
TransactionId = request.TransactionId ?? string.Empty,
AdminNote = request.AdminNote ?? string.Empty
};
var response = await _context.Commissions.ProcessWithdrawalAsync(grpcRequest, cancellationToken: cancellationToken);
return new ProcessWithdrawalResponseDto
{
Success = response.Success,
Message = response.Message
};
}
}

View File

@@ -0,0 +1,7 @@
namespace BackOffice.BFF.Application.CommissionCQ.Commands.ProcessWithdrawal;
public record ProcessWithdrawalResponseDto
{
public bool Success { get; init; }
public string Message { get; init; } = string.Empty;
}

View File

@@ -0,0 +1,14 @@
namespace BackOffice.BFF.Application.CommissionCQ.Commands.RejectWithdrawal;
public record RejectWithdrawalCommand : IRequest<RejectWithdrawalResponseDto>
{
/// <summary>
/// شناسه درخواست برداشت
/// </summary>
public long WithdrawalId { get; init; }
/// <summary>
/// دلیل رد (الزامی)
/// </summary>
public string RejectReason { get; init; } = string.Empty;
}

View File

@@ -0,0 +1,30 @@
using BackOffice.BFF.Commission.Protobuf;
namespace BackOffice.BFF.Application.CommissionCQ.Commands.RejectWithdrawal;
public class RejectWithdrawalCommandHandler : IRequestHandler<RejectWithdrawalCommand, RejectWithdrawalResponseDto>
{
private readonly IApplicationContractContext _context;
public RejectWithdrawalCommandHandler(IApplicationContractContext context)
{
_context = context;
}
public async Task<RejectWithdrawalResponseDto> Handle(RejectWithdrawalCommand request, CancellationToken cancellationToken)
{
var grpcRequest = new RejectWithdrawalRequest
{
WithdrawalId = request.WithdrawalId,
RejectReason = request.RejectReason
};
var response = await _context.Commissions.RejectWithdrawalAsync(grpcRequest, cancellationToken: cancellationToken);
return new RejectWithdrawalResponseDto
{
Success = response.Success,
Message = response.Message
};
}
}

View File

@@ -0,0 +1,7 @@
namespace BackOffice.BFF.Application.CommissionCQ.Commands.RejectWithdrawal;
public record RejectWithdrawalResponseDto
{
public bool Success { get; init; }
public string Message { get; init; } = string.Empty;
}

View File

@@ -0,0 +1,29 @@
namespace BackOffice.BFF.Application.CommissionCQ.Queries.GetAllWeeklyPools;
public record GetAllWeeklyPoolsQuery : IRequest<GetAllWeeklyPoolsResponseDto>
{
/// <summary>
/// از هفته (فیلتر اختیاری)
/// </summary>
public string? FromWeek { get; init; }
/// <summary>
/// تا هفته (فیلتر اختیاری)
/// </summary>
public string? ToWeek { get; init; }
/// <summary>
/// فقط Pool های محاسبه شده
/// </summary>
public bool? OnlyCalculated { get; init; }
/// <summary>
/// شماره صفحه
/// </summary>
public int PageIndex { get; init; } = 1;
/// <summary>
/// تعداد در صفحه
/// </summary>
public int PageSize { get; init; } = 10;
}

View File

@@ -0,0 +1,41 @@
using CMSMicroservice.Protobuf.Protos.Commission;
namespace BackOffice.BFF.Application.CommissionCQ.Queries.GetAllWeeklyPools;
public class GetAllWeeklyPoolsQueryHandler : IRequestHandler<GetAllWeeklyPoolsQuery, GetAllWeeklyPoolsResponseDto>
{
private readonly IApplicationContractContext _context;
public GetAllWeeklyPoolsQueryHandler(IApplicationContractContext context)
{
_context = context;
}
public async Task<GetAllWeeklyPoolsResponseDto> Handle(GetAllWeeklyPoolsQuery request, CancellationToken cancellationToken)
{
var grpcRequest = new GetAllWeeklyPoolsRequest
{
PageIndex = request.PageIndex,
PageSize = request.PageSize
};
if (!string.IsNullOrWhiteSpace(request.FromWeek))
{
grpcRequest.FromWeek = request.FromWeek;
}
if (!string.IsNullOrWhiteSpace(request.ToWeek))
{
grpcRequest.ToWeek = request.ToWeek;
}
if (request.OnlyCalculated.HasValue)
{
grpcRequest.OnlyCalculated = request.OnlyCalculated.Value;
}
var response = await _context.Commissions.GetAllWeeklyPoolsAsync(grpcRequest, cancellationToken: cancellationToken);
return response.Adapt<GetAllWeeklyPoolsResponseDto>();
}
}

View File

@@ -0,0 +1,27 @@
namespace BackOffice.BFF.Application.CommissionCQ.Queries.GetAllWeeklyPools;
public record GetAllWeeklyPoolsResponseDto
{
public MetaDataDto MetaData { get; init; } = new();
public List<WeeklyCommissionPoolDto> Models { get; init; } = new();
}
public record WeeklyCommissionPoolDto
{
public long Id { get; init; }
public string WeekNumber { get; init; } = string.Empty;
public long TotalPoolAmount { get; init; }
public int TotalBalances { get; init; }
public long ValuePerBalance { get; init; }
public bool IsCalculated { get; init; }
public DateTime? CalculatedAt { get; init; }
public DateTime Created { get; init; }
}
public record MetaDataDto
{
public int TotalCount { get; init; }
public int PageSize { get; init; }
public int CurrentPage { get; init; }
public int TotalPages { get; init; }
}

View File

@@ -0,0 +1,24 @@
namespace BackOffice.BFF.Application.CommissionCQ.Queries.GetUserPayouts;
public record GetUserPayoutsQuery : IRequest<GetUserPayoutsResponseDto>
{
/// <summary>
/// شناسه کاربر
/// </summary>
public long UserId { get; init; }
/// <summary>
/// شماره هفته (اختیاری - برای فیلتر)
/// </summary>
public string? WeekNumber { get; init; }
/// <summary>
/// شماره صفحه (پیش‌فرض: 1)
/// </summary>
public int PageNumber { get; init; } = 1;
/// <summary>
/// تعداد در هر صفحه (پیش‌فرض: 10)
/// </summary>
public int PageSize { get; init; } = 10;
}

View File

@@ -0,0 +1,22 @@
using CMSMicroservice.Protobuf.Protos.Commission;
namespace BackOffice.BFF.Application.CommissionCQ.Queries.GetUserPayouts;
public class GetUserPayoutsQueryHandler : IRequestHandler<GetUserPayoutsQuery, GetUserPayoutsResponseDto>
{
private readonly IApplicationContractContext _context;
public GetUserPayoutsQueryHandler(IApplicationContractContext context)
{
_context = context;
}
public async Task<GetUserPayoutsResponseDto> Handle(GetUserPayoutsQuery request, CancellationToken cancellationToken)
{
var response = await _context.Commissions.GetUserCommissionPayoutsAsync(
request.Adapt<GetUserCommissionPayoutsRequest>(),
cancellationToken: cancellationToken);
return response.Adapt<GetUserPayoutsResponseDto>();
}
}

View File

@@ -0,0 +1,77 @@
namespace BackOffice.BFF.Application.CommissionCQ.Queries.GetUserPayouts;
public class GetUserPayoutsResponseDto
{
/// <summary>
/// لیست Payout ها
/// </summary>
public List<UserPayoutDto> Payouts { get; set; } = new();
/// <summary>
/// تعداد کل رکوردها
/// </summary>
public int TotalCount { get; set; }
/// <summary>
/// شماره صفحه فعلی
/// </summary>
public int PageNumber { get; set; }
/// <summary>
/// تعداد در هر صفحه
/// </summary>
public int PageSize { get; set; }
}
public class UserPayoutDto
{
/// <summary>
/// شناسه Payout
/// </summary>
public long Id { get; set; }
/// <summary>
/// شناسه کاربر
/// </summary>
public long UserId { get; set; }
/// <summary>
/// شماره هفته
/// </summary>
public string WeekNumber { get; set; } = string.Empty;
/// <summary>
/// بالانس Leg چپ
/// </summary>
public decimal LeftLegBalance { get; set; }
/// <summary>
/// بالانس Leg راست
/// </summary>
public decimal RightLegBalance { get; set; }
/// <summary>
/// بالانس Leg ضعیف‌تر
/// </summary>
public decimal WeakerLegBalance { get; set; }
/// <summary>
/// مبلغ کمیسیون (تومان)
/// </summary>
public decimal CommissionAmount { get; set; }
/// <summary>
/// وضعیت پرداخت
/// </summary>
public string Status { get; set; } = string.Empty;
/// <summary>
/// تاریخ پرداخت
/// </summary>
public DateTime? PaidAt { get; set; }
/// <summary>
/// تاریخ ایجاد
/// </summary>
public DateTime CreatedAt { get; set; }
}

View File

@@ -0,0 +1,9 @@
namespace BackOffice.BFF.Application.CommissionCQ.Queries.GetWeeklyPool;
public record GetWeeklyPoolQuery : IRequest<GetWeeklyPoolResponseDto>
{
/// <summary>
/// شماره هفته (فرمت: YYYY-Www مثلاً 2025-W48)
/// </summary>
public string WeekNumber { get; init; } = string.Empty;
}

View File

@@ -0,0 +1,22 @@
using CMSMicroservice.Protobuf.Protos.Commission;
namespace BackOffice.BFF.Application.CommissionCQ.Queries.GetWeeklyPool;
public class GetWeeklyPoolQueryHandler : IRequestHandler<GetWeeklyPoolQuery, GetWeeklyPoolResponseDto>
{
private readonly IApplicationContractContext _context;
public GetWeeklyPoolQueryHandler(IApplicationContractContext context)
{
_context = context;
}
public async Task<GetWeeklyPoolResponseDto> Handle(GetWeeklyPoolQuery request, CancellationToken cancellationToken)
{
var response = await _context.Commissions.GetWeeklyCommissionPoolAsync(
request.Adapt<GetWeeklyCommissionPoolRequest>(),
cancellationToken: cancellationToken);
return response.Adapt<GetWeeklyPoolResponseDto>();
}
}

View File

@@ -0,0 +1,59 @@
namespace BackOffice.BFF.Application.CommissionCQ.Queries.GetWeeklyPool;
public class GetWeeklyPoolResponseDto
{
/// <summary>
/// شناسه Pool
/// </summary>
public long Id { get; set; }
/// <summary>
/// شماره هفته (فرمت: YYYY-Www)
/// </summary>
public string WeekNumber { get; set; } = string.Empty;
/// <summary>
/// مجموع کل Pool (تومان)
/// </summary>
public decimal TotalPoolValue { get; set; }
/// <summary>
/// مجموع مشارکت‌های اولیه (InitialContribution)
/// </summary>
public decimal TotalContributions { get; set; }
/// <summary>
/// مجموع Payout های پرداخت شده
/// </summary>
public decimal TotalPayouts { get; set; }
/// <summary>
/// باقیمانده Pool
/// </summary>
public decimal LeftBalance { get; set; }
/// <summary>
/// تعداد اعضای فعال در این هفته
/// </summary>
public int ActiveMembersCount { get; set; }
/// <summary>
/// آیا محاسبه شده است؟
/// </summary>
public bool IsCalculated { get; set; }
/// <summary>
/// تاریخ محاسبه
/// </summary>
public DateTime? CalculatedAt { get; set; }
/// <summary>
/// تاریخ ایجاد
/// </summary>
public DateTime CreatedAt { get; set; }
/// <summary>
/// تاریخ آخرین ویرایش
/// </summary>
public DateTime? ModifiedAt { get; set; }
}

View File

@@ -0,0 +1,24 @@
namespace BackOffice.BFF.Application.CommissionCQ.Queries.GetWithdrawalRequests;
public record GetWithdrawalRequestsQuery : IRequest<GetWithdrawalRequestsResponseDto>
{
/// <summary>
/// شماره صفحه (پیش‌فرض: 1)
/// </summary>
public int PageIndex { get; init; } = 1;
/// <summary>
/// تعداد در هر صفحه (پیش‌فرض: 10)
/// </summary>
public int PageSize { get; init; } = 10;
/// <summary>
/// فیلتر وضعیت (اختیاری): 0=Pending, 1=Approved, 2=Rejected, 3=Processed
/// </summary>
public int? Status { get; init; }
/// <summary>
/// فیلتر شناسه کاربر (اختیاری)
/// </summary>
public long? UserId { get; init; }
}

View File

@@ -0,0 +1,36 @@
using BackOffice.BFF.Commission.Protobuf;
namespace BackOffice.BFF.Application.CommissionCQ.Queries.GetWithdrawalRequests;
public class GetWithdrawalRequestsQueryHandler : IRequestHandler<GetWithdrawalRequestsQuery, GetWithdrawalRequestsResponseDto>
{
private readonly IApplicationContractContext _context;
public GetWithdrawalRequestsQueryHandler(IApplicationContractContext context)
{
_context = context;
}
public async Task<GetWithdrawalRequestsResponseDto> Handle(GetWithdrawalRequestsQuery request, CancellationToken cancellationToken)
{
var grpcRequest = new GetWithdrawalRequestsRequest
{
PageIndex = request.PageIndex,
PageSize = request.PageSize
};
if (request.Status.HasValue)
{
grpcRequest.Status = request.Status.Value;
}
if (request.UserId.HasValue)
{
grpcRequest.UserId = request.UserId.Value;
}
var response = await _context.Commissions.GetWithdrawalRequestsAsync(grpcRequest, cancellationToken: cancellationToken);
return response.Adapt<GetWithdrawalRequestsResponseDto>();
}
}

View File

@@ -0,0 +1,31 @@
namespace BackOffice.BFF.Application.CommissionCQ.Queries.GetWithdrawalRequests;
public record GetWithdrawalRequestsResponseDto
{
public List<WithdrawalRequestDto> Models { get; init; } = new();
public MetaDataDto MetaData { get; init; } = new();
}
public record WithdrawalRequestDto
{
public long Id { get; init; }
public long UserId { get; init; }
public string UserName { get; init; } = string.Empty;
public string PhoneNumber { get; init; } = string.Empty;
public long Amount { get; init; }
public int Status { get; init; }
public string Method { get; init; } = "Bank";
public string? BankAccount { get; init; }
public string? BankName { get; init; }
public DateTime RequestDate { get; init; }
public DateTime? ProcessedDate { get; init; }
public string? AdminNote { get; init; }
}
public record MetaDataDto
{
public int TotalCount { get; init; }
public int PageSize { get; init; }
public int CurrentPage { get; init; }
public int TotalPages { get; init; }
}

View File

@@ -9,6 +9,9 @@ using CMSMicroservice.Protobuf.Protos.ProductImages;
using CMSMicroservice.Protobuf.Protos.ProductGallerys; using CMSMicroservice.Protobuf.Protos.ProductGallerys;
using CMSMicroservice.Protobuf.Protos.Category; using CMSMicroservice.Protobuf.Protos.Category;
using CMSMicroservice.Protobuf.Protos.PruductCategory; using CMSMicroservice.Protobuf.Protos.PruductCategory;
using CMSMicroservice.Protobuf.Protos.Commission;
using CMSMicroservice.Protobuf.Protos.NetworkMembership;
using CMSMicroservice.Protobuf.Protos.ClubMembership;
using FMSMicroservice.Protobuf.Protos.FileInfo; using FMSMicroservice.Protobuf.Protos.FileInfo;
namespace BackOffice.BFF.Application.Common.Interfaces; namespace BackOffice.BFF.Application.Common.Interfaces;
@@ -30,6 +33,11 @@ public interface IApplicationContractContext
UserContract.UserContractClient Users { get; } UserContract.UserContractClient Users { get; }
UserOrderContract.UserOrderContractClient UserOrders { get; } UserOrderContract.UserOrderContractClient UserOrders { get; }
UserRoleContract.UserRoleContractClient UserRoles { get; } UserRoleContract.UserRoleContractClient UserRoles { get; }
// Network & Commission System
CommissionContract.CommissionContractClient Commissions { get; }
NetworkMembershipContract.NetworkMembershipContractClient NetworkMemberships { get; }
ClubMembershipContract.ClubMembershipContractClient ClubMemberships { get; }
#endregion #endregion
} }

View File

@@ -0,0 +1,24 @@
namespace BackOffice.BFF.Application.NetworkMembershipCQ.Queries.GetNetworkHistory;
public record GetNetworkHistoryQuery : IRequest<GetNetworkHistoryResponseDto>
{
/// <summary>
/// شناسه کاربر (اختیاری)
/// </summary>
public long? UserId { get; init; }
/// <summary>
/// شناسه والد (اختیاری)
/// </summary>
public long? ParentId { get; init; }
/// <summary>
/// شماره صفحه (پیش‌فرض: 1)
/// </summary>
public int PageNumber { get; init; } = 1;
/// <summary>
/// تعداد در هر صفحه (پیش‌فرض: 10)
/// </summary>
public int PageSize { get; init; } = 10;
}

View File

@@ -0,0 +1,22 @@
using CMSMicroservice.Protobuf.Protos.NetworkMembership;
namespace BackOffice.BFF.Application.NetworkMembershipCQ.Queries.GetNetworkHistory;
public class GetNetworkHistoryQueryHandler : IRequestHandler<GetNetworkHistoryQuery, GetNetworkHistoryResponseDto>
{
private readonly IApplicationContractContext _context;
public GetNetworkHistoryQueryHandler(IApplicationContractContext context)
{
_context = context;
}
public async Task<GetNetworkHistoryResponseDto> Handle(GetNetworkHistoryQuery request, CancellationToken cancellationToken)
{
var response = await _context.NetworkMemberships.GetNetworkMembershipHistoryAsync(
request.Adapt<GetNetworkMembershipHistoryRequest>(),
cancellationToken: cancellationToken);
return response.Adapt<GetNetworkHistoryResponseDto>();
}
}

View File

@@ -0,0 +1,87 @@
namespace BackOffice.BFF.Application.NetworkMembershipCQ.Queries.GetNetworkHistory;
public class GetNetworkHistoryResponseDto
{
/// <summary>
/// لیست تاریخچه تغییرات شبکه
/// </summary>
public List<NetworkHistoryDto> History { get; set; } = new();
/// <summary>
/// تعداد کل رکوردها
/// </summary>
public int TotalCount { get; set; }
/// <summary>
/// شماره صفحه فعلی
/// </summary>
public int PageNumber { get; set; }
/// <summary>
/// تعداد در هر صفحه
/// </summary>
public int PageSize { get; set; }
}
public class NetworkHistoryDto
{
/// <summary>
/// شناسه تاریخچه
/// </summary>
public long Id { get; set; }
/// <summary>
/// شناسه کاربر
/// </summary>
public long UserId { get; set; }
/// <summary>
/// شناسه والد قبلی
/// </summary>
public long? OldParentId { get; set; }
/// <summary>
/// شناسه والد جدید
/// </summary>
public long? NewParentId { get; set; }
/// <summary>
/// موقعیت قبلی (0=Left, 1=Right)
/// </summary>
public int? OldNetworkLeg { get; set; }
/// <summary>
/// موقعیت جدید
/// </summary>
public int? NewNetworkLeg { get; set; }
/// <summary>
/// سطح قبلی
/// </summary>
public int? OldNetworkLevel { get; set; }
/// <summary>
/// سطح جدید
/// </summary>
public int? NewNetworkLevel { get; set; }
/// <summary>
/// نوع عملیات
/// </summary>
public int Action { get; set; }
/// <summary>
/// انجام دهنده عملیات
/// </summary>
public string PerformedBy { get; set; } = string.Empty;
/// <summary>
/// دلیل تغییر
/// </summary>
public string Reason { get; set; } = string.Empty;
/// <summary>
/// تاریخ ایجاد
/// </summary>
public DateTime CreatedAt { get; set; }
}

View File

@@ -0,0 +1,19 @@
namespace BackOffice.BFF.Application.NetworkMembershipCQ.Queries.GetNetworkTree;
public record GetNetworkTreeQuery : IRequest<GetNetworkTreeResponseDto>
{
/// <summary>
/// شناسه کاربر ریشه (Root)
/// </summary>
public long RootUserId { get; init; }
/// <summary>
/// حداکثر عمق درخت (اختیاری، پیش‌فرض: 5)
/// </summary>
public int? MaxDepth { get; init; }
/// <summary>
/// فقط کاربران فعال (اختیاری)
/// </summary>
public bool? OnlyActive { get; init; }
}

View File

@@ -0,0 +1,22 @@
using CMSMicroservice.Protobuf.Protos.NetworkMembership;
namespace BackOffice.BFF.Application.NetworkMembershipCQ.Queries.GetNetworkTree;
public class GetNetworkTreeQueryHandler : IRequestHandler<GetNetworkTreeQuery, GetNetworkTreeResponseDto>
{
private readonly IApplicationContractContext _context;
public GetNetworkTreeQueryHandler(IApplicationContractContext context)
{
_context = context;
}
public async Task<GetNetworkTreeResponseDto> Handle(GetNetworkTreeQuery request, CancellationToken cancellationToken)
{
var response = await _context.NetworkMemberships.GetNetworkTreeAsync(
request.Adapt<GetNetworkTreeRequest>(),
cancellationToken: cancellationToken);
return response.Adapt<GetNetworkTreeResponseDto>();
}
}

View File

@@ -0,0 +1,47 @@
namespace BackOffice.BFF.Application.NetworkMembershipCQ.Queries.GetNetworkTree;
public class GetNetworkTreeResponseDto
{
/// <summary>
/// لیست گره‌های درخت شبکه
/// </summary>
public List<NetworkTreeNodeDto> Nodes { get; set; } = new();
}
public class NetworkTreeNodeDto
{
/// <summary>
/// شناسه کاربر
/// </summary>
public long UserId { get; set; }
/// <summary>
/// نام کاربر
/// </summary>
public string UserName { get; set; } = string.Empty;
/// <summary>
/// شناسه والد
/// </summary>
public long? ParentId { get; set; }
/// <summary>
/// موقعیت در شبکه (0=Left, 1=Right)
/// </summary>
public int NetworkLeg { get; set; }
/// <summary>
/// سطح در شبکه
/// </summary>
public int NetworkLevel { get; set; }
/// <summary>
/// وضعیت فعال/غیرفعال
/// </summary>
public bool IsActive { get; set; }
/// <summary>
/// تاریخ عضویت
/// </summary>
public DateTime JoinedAt { get; set; }
}

View File

@@ -0,0 +1,9 @@
namespace BackOffice.BFF.Application.NetworkMembershipCQ.Queries.GetUserNetworkInfo;
public record GetUserNetworkInfoQuery : IRequest<GetUserNetworkInfoResponseDto>
{
/// <summary>
/// شناسه کاربر
/// </summary>
public long UserId { get; init; }
}

View File

@@ -0,0 +1,22 @@
using CMSMicroservice.Protobuf.Protos.NetworkMembership;
namespace BackOffice.BFF.Application.NetworkMembershipCQ.Queries.GetUserNetworkInfo;
public class GetUserNetworkInfoQueryHandler : IRequestHandler<GetUserNetworkInfoQuery, GetUserNetworkInfoResponseDto>
{
private readonly IApplicationContractContext _context;
public GetUserNetworkInfoQueryHandler(IApplicationContractContext context)
{
_context = context;
}
public async Task<GetUserNetworkInfoResponseDto> Handle(GetUserNetworkInfoQuery request, CancellationToken cancellationToken)
{
var response = await _context.NetworkMemberships.GetUserNetworkAsync(
request.Adapt<GetUserNetworkRequest>(),
cancellationToken: cancellationToken);
return response.Adapt<GetUserNetworkInfoResponseDto>();
}
}

View File

@@ -0,0 +1,74 @@
namespace BackOffice.BFF.Application.NetworkMembershipCQ.Queries.GetUserNetworkInfo;
public class GetUserNetworkInfoResponseDto
{
/// <summary>
/// شناسه عضویت شبکه
/// </summary>
public long Id { get; set; }
/// <summary>
/// شناسه کاربر
/// </summary>
public long UserId { get; set; }
/// <summary>
/// نام کاربر
/// </summary>
public string UserName { get; set; } = string.Empty;
/// <summary>
/// شناسه والد در شبکه
/// </summary>
public long? ParentId { get; set; }
/// <summary>
/// نام والد
/// </summary>
public string ParentName { get; set; } = string.Empty;
/// <summary>
/// موقعیت در شبکه (0=Left, 1=Right)
/// </summary>
public int NetworkLeg { get; set; }
/// <summary>
/// شناسه فرزند چپ
/// </summary>
public long? LeftChildId { get; set; }
/// <summary>
/// نام فرزند چپ
/// </summary>
public string LeftChildName { get; set; } = string.Empty;
/// <summary>
/// شناسه فرزند راست
/// </summary>
public long? RightChildId { get; set; }
/// <summary>
/// نام فرزند راست
/// </summary>
public string RightChildName { get; set; } = string.Empty;
/// <summary>
/// سطح در شبکه
/// </summary>
public int NetworkLevel { get; set; }
/// <summary>
/// کد معرف
/// </summary>
public string ReferralCode { get; set; } = string.Empty;
/// <summary>
/// تاریخ عضویت در شبکه
/// </summary>
public DateTime JoinedAt { get; set; }
/// <summary>
/// تاریخ ایجاد
/// </summary>
public DateTime CreatedAt { get; set; }
}

View File

@@ -7,7 +7,7 @@
<ItemGroup> <ItemGroup>
<PackageReference Include="Afrino.FMSMicroservice.Protobuf" Version="0.0.122" /> <PackageReference Include="Afrino.FMSMicroservice.Protobuf" Version="0.0.122" />
<PackageReference Include="Foursat.CMSMicroservice.Protobuf" Version="0.0.137" /> <PackageReference Include="Foursat.CMSMicroservice.Protobuf" Version="0.0.141" />
<PackageReference Include="Google.Protobuf" Version="3.23.3" /> <PackageReference Include="Google.Protobuf" Version="3.23.3" />
<PackageReference Include="Grpc.Net.ClientFactory" Version="2.54.0" /> <PackageReference Include="Grpc.Net.ClientFactory" Version="2.54.0" />

View File

@@ -10,6 +10,9 @@ using CMSMicroservice.Protobuf.Protos.ProductImages;
using CMSMicroservice.Protobuf.Protos.ProductGallerys; using CMSMicroservice.Protobuf.Protos.ProductGallerys;
using CMSMicroservice.Protobuf.Protos.Category; using CMSMicroservice.Protobuf.Protos.Category;
using CMSMicroservice.Protobuf.Protos.PruductCategory; using CMSMicroservice.Protobuf.Protos.PruductCategory;
using CMSMicroservice.Protobuf.Protos.Commission;
using CMSMicroservice.Protobuf.Protos.NetworkMembership;
using CMSMicroservice.Protobuf.Protos.ClubMembership;
using FMSMicroservice.Protobuf.Protos.FileInfo; using FMSMicroservice.Protobuf.Protos.FileInfo;
using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.DependencyInjection;
@@ -54,5 +57,10 @@ public class ApplicationContractContext : IApplicationContractContext
public UserContract.UserContractClient Users => GetService<UserContract.UserContractClient>(); public UserContract.UserContractClient Users => GetService<UserContract.UserContractClient>();
public UserOrderContract.UserOrderContractClient UserOrders => GetService<UserOrderContract.UserOrderContractClient>(); public UserOrderContract.UserOrderContractClient UserOrders => GetService<UserOrderContract.UserOrderContractClient>();
public UserRoleContract.UserRoleContractClient UserRoles => GetService<UserRoleContract.UserRoleContractClient>(); public UserRoleContract.UserRoleContractClient UserRoles => GetService<UserRoleContract.UserRoleContractClient>();
// Network & Commission System
public CommissionContract.CommissionContractClient Commissions => GetService<CommissionContract.CommissionContractClient>();
public NetworkMembershipContract.NetworkMembershipContractClient NetworkMemberships => GetService<NetworkMembershipContract.NetworkMembershipContractClient>();
public ClubMembershipContract.ClubMembershipContractClient ClubMemberships => GetService<ClubMembershipContract.ClubMembershipContractClient>();
#endregion #endregion
} }

View File

@@ -1,3 +1,4 @@

Microsoft Visual Studio Solution File, Format Version 12.00 Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 17 # Visual Studio Version 17
VisualStudioVersion = 17.0.31903.59 VisualStudioVersion = 17.0.31903.59
@@ -30,64 +31,242 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "BackOffice.BFF.Products.Pro
EndProject EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "BackOffice.BFF.Category.Protobuf", "Protobufs\BackOffice.BFF.Category.Protobuf\BackOffice.BFF.Category.Protobuf.csproj", "{640BD51E-8298-4074-9713-BCE619318155}" Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "BackOffice.BFF.Category.Protobuf", "Protobufs\BackOffice.BFF.Category.Protobuf\BackOffice.BFF.Category.Protobuf.csproj", "{640BD51E-8298-4074-9713-BCE619318155}"
EndProject EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "BackOffice.BFF.Configuration.Protobuf", "Protobufs\BackOffice.BFF.Configuration.Protobuf\BackOffice.BFF.Configuration.Protobuf.csproj", "{5D7FCD40-BFB0-4D39-B662-05840154C6AF}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "BackOffice.BFF.ClubMembership.Protobuf", "Protobufs\BackOffice.BFF.ClubMembership.Protobuf\BackOffice.BFF.ClubMembership.Protobuf.csproj", "{3EC432DA-F351-43C5-A781-595062B999A5}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "BackOffice.BFF.NetworkMembership.Protobuf", "Protobufs\BackOffice.BFF.NetworkMembership.Protobuf\BackOffice.BFF.NetworkMembership.Protobuf.csproj", "{CA0F6C82-227A-41E4-A59F-B45EF68411A1}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "BackOffice.BFF.Commission.Protobuf", "Protobufs\BackOffice.BFF.Commission.Protobuf\BackOffice.BFF.Commission.Protobuf.csproj", "{3B7514DE-1C2F-4BB1-BBD5-C57BEEC6843E}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "BackOffice.BFF.Common.Protobuf", "Protobufs\BackOffice.BFF.Common.Protobuf\BackOffice.BFF.Common.Protobuf.csproj", "{9911D6BE-3022-44F6-B93B-B3D62A14FBCA}"
EndProject
Global Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU Debug|Any CPU = Debug|Any CPU
Debug|x64 = Debug|x64
Debug|x86 = Debug|x86
Release|Any CPU = Release|Any CPU Release|Any CPU = Release|Any CPU
Release|x64 = Release|x64
Release|x86 = Release|x86
EndGlobalSection EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution GlobalSection(ProjectConfigurationPlatforms) = postSolution
{9AC57CFF-BEE5-46D2-BFF7-6787E2BB8441}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {9AC57CFF-BEE5-46D2-BFF7-6787E2BB8441}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{9AC57CFF-BEE5-46D2-BFF7-6787E2BB8441}.Debug|Any CPU.Build.0 = Debug|Any CPU {9AC57CFF-BEE5-46D2-BFF7-6787E2BB8441}.Debug|Any CPU.Build.0 = Debug|Any CPU
{9AC57CFF-BEE5-46D2-BFF7-6787E2BB8441}.Debug|x64.ActiveCfg = Debug|Any CPU
{9AC57CFF-BEE5-46D2-BFF7-6787E2BB8441}.Debug|x64.Build.0 = Debug|Any CPU
{9AC57CFF-BEE5-46D2-BFF7-6787E2BB8441}.Debug|x86.ActiveCfg = Debug|Any CPU
{9AC57CFF-BEE5-46D2-BFF7-6787E2BB8441}.Debug|x86.Build.0 = Debug|Any CPU
{9AC57CFF-BEE5-46D2-BFF7-6787E2BB8441}.Release|Any CPU.ActiveCfg = Release|Any CPU {9AC57CFF-BEE5-46D2-BFF7-6787E2BB8441}.Release|Any CPU.ActiveCfg = Release|Any CPU
{9AC57CFF-BEE5-46D2-BFF7-6787E2BB8441}.Release|Any CPU.Build.0 = Release|Any CPU {9AC57CFF-BEE5-46D2-BFF7-6787E2BB8441}.Release|Any CPU.Build.0 = Release|Any CPU
{9AC57CFF-BEE5-46D2-BFF7-6787E2BB8441}.Release|x64.ActiveCfg = Release|Any CPU
{9AC57CFF-BEE5-46D2-BFF7-6787E2BB8441}.Release|x64.Build.0 = Release|Any CPU
{9AC57CFF-BEE5-46D2-BFF7-6787E2BB8441}.Release|x86.ActiveCfg = Release|Any CPU
{9AC57CFF-BEE5-46D2-BFF7-6787E2BB8441}.Release|x86.Build.0 = Release|Any CPU
{C857BF04-2856-46D0-90EF-1C8A6E9420CA}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {C857BF04-2856-46D0-90EF-1C8A6E9420CA}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{C857BF04-2856-46D0-90EF-1C8A6E9420CA}.Debug|Any CPU.Build.0 = Debug|Any CPU {C857BF04-2856-46D0-90EF-1C8A6E9420CA}.Debug|Any CPU.Build.0 = Debug|Any CPU
{C857BF04-2856-46D0-90EF-1C8A6E9420CA}.Debug|x64.ActiveCfg = Debug|Any CPU
{C857BF04-2856-46D0-90EF-1C8A6E9420CA}.Debug|x64.Build.0 = Debug|Any CPU
{C857BF04-2856-46D0-90EF-1C8A6E9420CA}.Debug|x86.ActiveCfg = Debug|Any CPU
{C857BF04-2856-46D0-90EF-1C8A6E9420CA}.Debug|x86.Build.0 = Debug|Any CPU
{C857BF04-2856-46D0-90EF-1C8A6E9420CA}.Release|Any CPU.ActiveCfg = Release|Any CPU {C857BF04-2856-46D0-90EF-1C8A6E9420CA}.Release|Any CPU.ActiveCfg = Release|Any CPU
{C857BF04-2856-46D0-90EF-1C8A6E9420CA}.Release|Any CPU.Build.0 = Release|Any CPU {C857BF04-2856-46D0-90EF-1C8A6E9420CA}.Release|Any CPU.Build.0 = Release|Any CPU
{C857BF04-2856-46D0-90EF-1C8A6E9420CA}.Release|x64.ActiveCfg = Release|Any CPU
{C857BF04-2856-46D0-90EF-1C8A6E9420CA}.Release|x64.Build.0 = Release|Any CPU
{C857BF04-2856-46D0-90EF-1C8A6E9420CA}.Release|x86.ActiveCfg = Release|Any CPU
{C857BF04-2856-46D0-90EF-1C8A6E9420CA}.Release|x86.Build.0 = Release|Any CPU
{B3BCF789-C32E-49EC-8A35-FFF8C9A05D1C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {B3BCF789-C32E-49EC-8A35-FFF8C9A05D1C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{B3BCF789-C32E-49EC-8A35-FFF8C9A05D1C}.Debug|Any CPU.Build.0 = Debug|Any CPU {B3BCF789-C32E-49EC-8A35-FFF8C9A05D1C}.Debug|Any CPU.Build.0 = Debug|Any CPU
{B3BCF789-C32E-49EC-8A35-FFF8C9A05D1C}.Debug|x64.ActiveCfg = Debug|Any CPU
{B3BCF789-C32E-49EC-8A35-FFF8C9A05D1C}.Debug|x64.Build.0 = Debug|Any CPU
{B3BCF789-C32E-49EC-8A35-FFF8C9A05D1C}.Debug|x86.ActiveCfg = Debug|Any CPU
{B3BCF789-C32E-49EC-8A35-FFF8C9A05D1C}.Debug|x86.Build.0 = Debug|Any CPU
{B3BCF789-C32E-49EC-8A35-FFF8C9A05D1C}.Release|Any CPU.ActiveCfg = Release|Any CPU {B3BCF789-C32E-49EC-8A35-FFF8C9A05D1C}.Release|Any CPU.ActiveCfg = Release|Any CPU
{B3BCF789-C32E-49EC-8A35-FFF8C9A05D1C}.Release|Any CPU.Build.0 = Release|Any CPU {B3BCF789-C32E-49EC-8A35-FFF8C9A05D1C}.Release|Any CPU.Build.0 = Release|Any CPU
{B3BCF789-C32E-49EC-8A35-FFF8C9A05D1C}.Release|x64.ActiveCfg = Release|Any CPU
{B3BCF789-C32E-49EC-8A35-FFF8C9A05D1C}.Release|x64.Build.0 = Release|Any CPU
{B3BCF789-C32E-49EC-8A35-FFF8C9A05D1C}.Release|x86.ActiveCfg = Release|Any CPU
{B3BCF789-C32E-49EC-8A35-FFF8C9A05D1C}.Release|x86.Build.0 = Release|Any CPU
{39ED8B99-36D2-43D4-8491-F8302446385E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {39ED8B99-36D2-43D4-8491-F8302446385E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{39ED8B99-36D2-43D4-8491-F8302446385E}.Debug|Any CPU.Build.0 = Debug|Any CPU {39ED8B99-36D2-43D4-8491-F8302446385E}.Debug|Any CPU.Build.0 = Debug|Any CPU
{39ED8B99-36D2-43D4-8491-F8302446385E}.Debug|x64.ActiveCfg = Debug|Any CPU
{39ED8B99-36D2-43D4-8491-F8302446385E}.Debug|x64.Build.0 = Debug|Any CPU
{39ED8B99-36D2-43D4-8491-F8302446385E}.Debug|x86.ActiveCfg = Debug|Any CPU
{39ED8B99-36D2-43D4-8491-F8302446385E}.Debug|x86.Build.0 = Debug|Any CPU
{39ED8B99-36D2-43D4-8491-F8302446385E}.Release|Any CPU.ActiveCfg = Release|Any CPU {39ED8B99-36D2-43D4-8491-F8302446385E}.Release|Any CPU.ActiveCfg = Release|Any CPU
{39ED8B99-36D2-43D4-8491-F8302446385E}.Release|Any CPU.Build.0 = Release|Any CPU {39ED8B99-36D2-43D4-8491-F8302446385E}.Release|Any CPU.Build.0 = Release|Any CPU
{39ED8B99-36D2-43D4-8491-F8302446385E}.Release|x64.ActiveCfg = Release|Any CPU
{39ED8B99-36D2-43D4-8491-F8302446385E}.Release|x64.Build.0 = Release|Any CPU
{39ED8B99-36D2-43D4-8491-F8302446385E}.Release|x86.ActiveCfg = Release|Any CPU
{39ED8B99-36D2-43D4-8491-F8302446385E}.Release|x86.Build.0 = Release|Any CPU
{794F666D-6D5D-73EC-C654-104EAFA4E58A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {794F666D-6D5D-73EC-C654-104EAFA4E58A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{794F666D-6D5D-73EC-C654-104EAFA4E58A}.Debug|Any CPU.Build.0 = Debug|Any CPU {794F666D-6D5D-73EC-C654-104EAFA4E58A}.Debug|Any CPU.Build.0 = Debug|Any CPU
{794F666D-6D5D-73EC-C654-104EAFA4E58A}.Debug|x64.ActiveCfg = Debug|Any CPU
{794F666D-6D5D-73EC-C654-104EAFA4E58A}.Debug|x64.Build.0 = Debug|Any CPU
{794F666D-6D5D-73EC-C654-104EAFA4E58A}.Debug|x86.ActiveCfg = Debug|Any CPU
{794F666D-6D5D-73EC-C654-104EAFA4E58A}.Debug|x86.Build.0 = Debug|Any CPU
{794F666D-6D5D-73EC-C654-104EAFA4E58A}.Release|Any CPU.ActiveCfg = Release|Any CPU {794F666D-6D5D-73EC-C654-104EAFA4E58A}.Release|Any CPU.ActiveCfg = Release|Any CPU
{794F666D-6D5D-73EC-C654-104EAFA4E58A}.Release|Any CPU.Build.0 = Release|Any CPU {794F666D-6D5D-73EC-C654-104EAFA4E58A}.Release|Any CPU.Build.0 = Release|Any CPU
{794F666D-6D5D-73EC-C654-104EAFA4E58A}.Release|x64.ActiveCfg = Release|Any CPU
{794F666D-6D5D-73EC-C654-104EAFA4E58A}.Release|x64.Build.0 = Release|Any CPU
{794F666D-6D5D-73EC-C654-104EAFA4E58A}.Release|x86.ActiveCfg = Release|Any CPU
{794F666D-6D5D-73EC-C654-104EAFA4E58A}.Release|x86.Build.0 = Release|Any CPU
{BD79FF62-CD7B-7873-7200-FA8EBAEFA9E1}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {BD79FF62-CD7B-7873-7200-FA8EBAEFA9E1}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{BD79FF62-CD7B-7873-7200-FA8EBAEFA9E1}.Debug|Any CPU.Build.0 = Debug|Any CPU {BD79FF62-CD7B-7873-7200-FA8EBAEFA9E1}.Debug|Any CPU.Build.0 = Debug|Any CPU
{BD79FF62-CD7B-7873-7200-FA8EBAEFA9E1}.Debug|x64.ActiveCfg = Debug|Any CPU
{BD79FF62-CD7B-7873-7200-FA8EBAEFA9E1}.Debug|x64.Build.0 = Debug|Any CPU
{BD79FF62-CD7B-7873-7200-FA8EBAEFA9E1}.Debug|x86.ActiveCfg = Debug|Any CPU
{BD79FF62-CD7B-7873-7200-FA8EBAEFA9E1}.Debug|x86.Build.0 = Debug|Any CPU
{BD79FF62-CD7B-7873-7200-FA8EBAEFA9E1}.Release|Any CPU.ActiveCfg = Release|Any CPU {BD79FF62-CD7B-7873-7200-FA8EBAEFA9E1}.Release|Any CPU.ActiveCfg = Release|Any CPU
{BD79FF62-CD7B-7873-7200-FA8EBAEFA9E1}.Release|Any CPU.Build.0 = Release|Any CPU {BD79FF62-CD7B-7873-7200-FA8EBAEFA9E1}.Release|Any CPU.Build.0 = Release|Any CPU
{BD79FF62-CD7B-7873-7200-FA8EBAEFA9E1}.Release|x64.ActiveCfg = Release|Any CPU
{BD79FF62-CD7B-7873-7200-FA8EBAEFA9E1}.Release|x64.Build.0 = Release|Any CPU
{BD79FF62-CD7B-7873-7200-FA8EBAEFA9E1}.Release|x86.ActiveCfg = Release|Any CPU
{BD79FF62-CD7B-7873-7200-FA8EBAEFA9E1}.Release|x86.Build.0 = Release|Any CPU
{5FC682A7-F5D3-63A2-0A48-0D42DABF954B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {5FC682A7-F5D3-63A2-0A48-0D42DABF954B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{5FC682A7-F5D3-63A2-0A48-0D42DABF954B}.Debug|Any CPU.Build.0 = Debug|Any CPU {5FC682A7-F5D3-63A2-0A48-0D42DABF954B}.Debug|Any CPU.Build.0 = Debug|Any CPU
{5FC682A7-F5D3-63A2-0A48-0D42DABF954B}.Debug|x64.ActiveCfg = Debug|Any CPU
{5FC682A7-F5D3-63A2-0A48-0D42DABF954B}.Debug|x64.Build.0 = Debug|Any CPU
{5FC682A7-F5D3-63A2-0A48-0D42DABF954B}.Debug|x86.ActiveCfg = Debug|Any CPU
{5FC682A7-F5D3-63A2-0A48-0D42DABF954B}.Debug|x86.Build.0 = Debug|Any CPU
{5FC682A7-F5D3-63A2-0A48-0D42DABF954B}.Release|Any CPU.ActiveCfg = Release|Any CPU {5FC682A7-F5D3-63A2-0A48-0D42DABF954B}.Release|Any CPU.ActiveCfg = Release|Any CPU
{5FC682A7-F5D3-63A2-0A48-0D42DABF954B}.Release|Any CPU.Build.0 = Release|Any CPU {5FC682A7-F5D3-63A2-0A48-0D42DABF954B}.Release|Any CPU.Build.0 = Release|Any CPU
{5FC682A7-F5D3-63A2-0A48-0D42DABF954B}.Release|x64.ActiveCfg = Release|Any CPU
{5FC682A7-F5D3-63A2-0A48-0D42DABF954B}.Release|x64.Build.0 = Release|Any CPU
{5FC682A7-F5D3-63A2-0A48-0D42DABF954B}.Release|x86.ActiveCfg = Release|Any CPU
{5FC682A7-F5D3-63A2-0A48-0D42DABF954B}.Release|x86.Build.0 = Release|Any CPU
{B688459B-67B0-3170-79C6-AB05DB7E911D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {B688459B-67B0-3170-79C6-AB05DB7E911D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{B688459B-67B0-3170-79C6-AB05DB7E911D}.Debug|Any CPU.Build.0 = Debug|Any CPU {B688459B-67B0-3170-79C6-AB05DB7E911D}.Debug|Any CPU.Build.0 = Debug|Any CPU
{B688459B-67B0-3170-79C6-AB05DB7E911D}.Debug|x64.ActiveCfg = Debug|Any CPU
{B688459B-67B0-3170-79C6-AB05DB7E911D}.Debug|x64.Build.0 = Debug|Any CPU
{B688459B-67B0-3170-79C6-AB05DB7E911D}.Debug|x86.ActiveCfg = Debug|Any CPU
{B688459B-67B0-3170-79C6-AB05DB7E911D}.Debug|x86.Build.0 = Debug|Any CPU
{B688459B-67B0-3170-79C6-AB05DB7E911D}.Release|Any CPU.ActiveCfg = Release|Any CPU {B688459B-67B0-3170-79C6-AB05DB7E911D}.Release|Any CPU.ActiveCfg = Release|Any CPU
{B688459B-67B0-3170-79C6-AB05DB7E911D}.Release|Any CPU.Build.0 = Release|Any CPU {B688459B-67B0-3170-79C6-AB05DB7E911D}.Release|Any CPU.Build.0 = Release|Any CPU
{B688459B-67B0-3170-79C6-AB05DB7E911D}.Release|x64.ActiveCfg = Release|Any CPU
{B688459B-67B0-3170-79C6-AB05DB7E911D}.Release|x64.Build.0 = Release|Any CPU
{B688459B-67B0-3170-79C6-AB05DB7E911D}.Release|x86.ActiveCfg = Release|Any CPU
{B688459B-67B0-3170-79C6-AB05DB7E911D}.Release|x86.Build.0 = Release|Any CPU
{75481681-ABB4-2A4C-8901-FE7242DE5B20}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {75481681-ABB4-2A4C-8901-FE7242DE5B20}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{75481681-ABB4-2A4C-8901-FE7242DE5B20}.Debug|Any CPU.Build.0 = Debug|Any CPU {75481681-ABB4-2A4C-8901-FE7242DE5B20}.Debug|Any CPU.Build.0 = Debug|Any CPU
{75481681-ABB4-2A4C-8901-FE7242DE5B20}.Debug|x64.ActiveCfg = Debug|Any CPU
{75481681-ABB4-2A4C-8901-FE7242DE5B20}.Debug|x64.Build.0 = Debug|Any CPU
{75481681-ABB4-2A4C-8901-FE7242DE5B20}.Debug|x86.ActiveCfg = Debug|Any CPU
{75481681-ABB4-2A4C-8901-FE7242DE5B20}.Debug|x86.Build.0 = Debug|Any CPU
{75481681-ABB4-2A4C-8901-FE7242DE5B20}.Release|Any CPU.ActiveCfg = Release|Any CPU {75481681-ABB4-2A4C-8901-FE7242DE5B20}.Release|Any CPU.ActiveCfg = Release|Any CPU
{75481681-ABB4-2A4C-8901-FE7242DE5B20}.Release|Any CPU.Build.0 = Release|Any CPU {75481681-ABB4-2A4C-8901-FE7242DE5B20}.Release|Any CPU.Build.0 = Release|Any CPU
{75481681-ABB4-2A4C-8901-FE7242DE5B20}.Release|x64.ActiveCfg = Release|Any CPU
{75481681-ABB4-2A4C-8901-FE7242DE5B20}.Release|x64.Build.0 = Release|Any CPU
{75481681-ABB4-2A4C-8901-FE7242DE5B20}.Release|x86.ActiveCfg = Release|Any CPU
{75481681-ABB4-2A4C-8901-FE7242DE5B20}.Release|x86.Build.0 = Release|Any CPU
{CB811954-E42E-75BB-A02D-689180B72E28}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {CB811954-E42E-75BB-A02D-689180B72E28}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{CB811954-E42E-75BB-A02D-689180B72E28}.Debug|Any CPU.Build.0 = Debug|Any CPU {CB811954-E42E-75BB-A02D-689180B72E28}.Debug|Any CPU.Build.0 = Debug|Any CPU
{CB811954-E42E-75BB-A02D-689180B72E28}.Debug|x64.ActiveCfg = Debug|Any CPU
{CB811954-E42E-75BB-A02D-689180B72E28}.Debug|x64.Build.0 = Debug|Any CPU
{CB811954-E42E-75BB-A02D-689180B72E28}.Debug|x86.ActiveCfg = Debug|Any CPU
{CB811954-E42E-75BB-A02D-689180B72E28}.Debug|x86.Build.0 = Debug|Any CPU
{CB811954-E42E-75BB-A02D-689180B72E28}.Release|Any CPU.ActiveCfg = Release|Any CPU {CB811954-E42E-75BB-A02D-689180B72E28}.Release|Any CPU.ActiveCfg = Release|Any CPU
{CB811954-E42E-75BB-A02D-689180B72E28}.Release|Any CPU.Build.0 = Release|Any CPU {CB811954-E42E-75BB-A02D-689180B72E28}.Release|Any CPU.Build.0 = Release|Any CPU
{CB811954-E42E-75BB-A02D-689180B72E28}.Release|x64.ActiveCfg = Release|Any CPU
{CB811954-E42E-75BB-A02D-689180B72E28}.Release|x64.Build.0 = Release|Any CPU
{CB811954-E42E-75BB-A02D-689180B72E28}.Release|x86.ActiveCfg = Release|Any CPU
{CB811954-E42E-75BB-A02D-689180B72E28}.Release|x86.Build.0 = Release|Any CPU
{E1833EDA-39E9-C241-2772-E4C7E960AC41}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {E1833EDA-39E9-C241-2772-E4C7E960AC41}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{E1833EDA-39E9-C241-2772-E4C7E960AC41}.Debug|Any CPU.Build.0 = Debug|Any CPU {E1833EDA-39E9-C241-2772-E4C7E960AC41}.Debug|Any CPU.Build.0 = Debug|Any CPU
{E1833EDA-39E9-C241-2772-E4C7E960AC41}.Debug|x64.ActiveCfg = Debug|Any CPU
{E1833EDA-39E9-C241-2772-E4C7E960AC41}.Debug|x64.Build.0 = Debug|Any CPU
{E1833EDA-39E9-C241-2772-E4C7E960AC41}.Debug|x86.ActiveCfg = Debug|Any CPU
{E1833EDA-39E9-C241-2772-E4C7E960AC41}.Debug|x86.Build.0 = Debug|Any CPU
{E1833EDA-39E9-C241-2772-E4C7E960AC41}.Release|Any CPU.ActiveCfg = Release|Any CPU {E1833EDA-39E9-C241-2772-E4C7E960AC41}.Release|Any CPU.ActiveCfg = Release|Any CPU
{E1833EDA-39E9-C241-2772-E4C7E960AC41}.Release|Any CPU.Build.0 = Release|Any CPU {E1833EDA-39E9-C241-2772-E4C7E960AC41}.Release|Any CPU.Build.0 = Release|Any CPU
{E1833EDA-39E9-C241-2772-E4C7E960AC41}.Release|x64.ActiveCfg = Release|Any CPU
{E1833EDA-39E9-C241-2772-E4C7E960AC41}.Release|x64.Build.0 = Release|Any CPU
{E1833EDA-39E9-C241-2772-E4C7E960AC41}.Release|x86.ActiveCfg = Release|Any CPU
{E1833EDA-39E9-C241-2772-E4C7E960AC41}.Release|x86.Build.0 = Release|Any CPU
{DFDECBE8-D071-4CDB-A1B4-D5C556EF72A6}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {DFDECBE8-D071-4CDB-A1B4-D5C556EF72A6}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{DFDECBE8-D071-4CDB-A1B4-D5C556EF72A6}.Debug|Any CPU.Build.0 = Debug|Any CPU {DFDECBE8-D071-4CDB-A1B4-D5C556EF72A6}.Debug|Any CPU.Build.0 = Debug|Any CPU
{DFDECBE8-D071-4CDB-A1B4-D5C556EF72A6}.Debug|x64.ActiveCfg = Debug|Any CPU
{DFDECBE8-D071-4CDB-A1B4-D5C556EF72A6}.Debug|x64.Build.0 = Debug|Any CPU
{DFDECBE8-D071-4CDB-A1B4-D5C556EF72A6}.Debug|x86.ActiveCfg = Debug|Any CPU
{DFDECBE8-D071-4CDB-A1B4-D5C556EF72A6}.Debug|x86.Build.0 = Debug|Any CPU
{DFDECBE8-D071-4CDB-A1B4-D5C556EF72A6}.Release|Any CPU.ActiveCfg = Release|Any CPU {DFDECBE8-D071-4CDB-A1B4-D5C556EF72A6}.Release|Any CPU.ActiveCfg = Release|Any CPU
{DFDECBE8-D071-4CDB-A1B4-D5C556EF72A6}.Release|Any CPU.Build.0 = Release|Any CPU {DFDECBE8-D071-4CDB-A1B4-D5C556EF72A6}.Release|Any CPU.Build.0 = Release|Any CPU
{DFDECBE8-D071-4CDB-A1B4-D5C556EF72A6}.Release|x64.ActiveCfg = Release|Any CPU
{DFDECBE8-D071-4CDB-A1B4-D5C556EF72A6}.Release|x64.Build.0 = Release|Any CPU
{DFDECBE8-D071-4CDB-A1B4-D5C556EF72A6}.Release|x86.ActiveCfg = Release|Any CPU
{DFDECBE8-D071-4CDB-A1B4-D5C556EF72A6}.Release|x86.Build.0 = Release|Any CPU
{640BD51E-8298-4074-9713-BCE619318155}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {640BD51E-8298-4074-9713-BCE619318155}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{640BD51E-8298-4074-9713-BCE619318155}.Debug|Any CPU.Build.0 = Debug|Any CPU {640BD51E-8298-4074-9713-BCE619318155}.Debug|Any CPU.Build.0 = Debug|Any CPU
{640BD51E-8298-4074-9713-BCE619318155}.Debug|x64.ActiveCfg = Debug|Any CPU
{640BD51E-8298-4074-9713-BCE619318155}.Debug|x64.Build.0 = Debug|Any CPU
{640BD51E-8298-4074-9713-BCE619318155}.Debug|x86.ActiveCfg = Debug|Any CPU
{640BD51E-8298-4074-9713-BCE619318155}.Debug|x86.Build.0 = Debug|Any CPU
{640BD51E-8298-4074-9713-BCE619318155}.Release|Any CPU.ActiveCfg = Release|Any CPU {640BD51E-8298-4074-9713-BCE619318155}.Release|Any CPU.ActiveCfg = Release|Any CPU
{640BD51E-8298-4074-9713-BCE619318155}.Release|Any CPU.Build.0 = Release|Any CPU {640BD51E-8298-4074-9713-BCE619318155}.Release|Any CPU.Build.0 = Release|Any CPU
{640BD51E-8298-4074-9713-BCE619318155}.Release|x64.ActiveCfg = Release|Any CPU
{640BD51E-8298-4074-9713-BCE619318155}.Release|x64.Build.0 = Release|Any CPU
{640BD51E-8298-4074-9713-BCE619318155}.Release|x86.ActiveCfg = Release|Any CPU
{640BD51E-8298-4074-9713-BCE619318155}.Release|x86.Build.0 = Release|Any CPU
{5D7FCD40-BFB0-4D39-B662-05840154C6AF}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{5D7FCD40-BFB0-4D39-B662-05840154C6AF}.Debug|Any CPU.Build.0 = Debug|Any CPU
{5D7FCD40-BFB0-4D39-B662-05840154C6AF}.Debug|x64.ActiveCfg = Debug|Any CPU
{5D7FCD40-BFB0-4D39-B662-05840154C6AF}.Debug|x64.Build.0 = Debug|Any CPU
{5D7FCD40-BFB0-4D39-B662-05840154C6AF}.Debug|x86.ActiveCfg = Debug|Any CPU
{5D7FCD40-BFB0-4D39-B662-05840154C6AF}.Debug|x86.Build.0 = Debug|Any CPU
{5D7FCD40-BFB0-4D39-B662-05840154C6AF}.Release|Any CPU.ActiveCfg = Release|Any CPU
{5D7FCD40-BFB0-4D39-B662-05840154C6AF}.Release|Any CPU.Build.0 = Release|Any CPU
{5D7FCD40-BFB0-4D39-B662-05840154C6AF}.Release|x64.ActiveCfg = Release|Any CPU
{5D7FCD40-BFB0-4D39-B662-05840154C6AF}.Release|x64.Build.0 = Release|Any CPU
{5D7FCD40-BFB0-4D39-B662-05840154C6AF}.Release|x86.ActiveCfg = Release|Any CPU
{5D7FCD40-BFB0-4D39-B662-05840154C6AF}.Release|x86.Build.0 = Release|Any CPU
{3EC432DA-F351-43C5-A781-595062B999A5}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{3EC432DA-F351-43C5-A781-595062B999A5}.Debug|Any CPU.Build.0 = Debug|Any CPU
{3EC432DA-F351-43C5-A781-595062B999A5}.Debug|x64.ActiveCfg = Debug|Any CPU
{3EC432DA-F351-43C5-A781-595062B999A5}.Debug|x64.Build.0 = Debug|Any CPU
{3EC432DA-F351-43C5-A781-595062B999A5}.Debug|x86.ActiveCfg = Debug|Any CPU
{3EC432DA-F351-43C5-A781-595062B999A5}.Debug|x86.Build.0 = Debug|Any CPU
{3EC432DA-F351-43C5-A781-595062B999A5}.Release|Any CPU.ActiveCfg = Release|Any CPU
{3EC432DA-F351-43C5-A781-595062B999A5}.Release|Any CPU.Build.0 = Release|Any CPU
{3EC432DA-F351-43C5-A781-595062B999A5}.Release|x64.ActiveCfg = Release|Any CPU
{3EC432DA-F351-43C5-A781-595062B999A5}.Release|x64.Build.0 = Release|Any CPU
{3EC432DA-F351-43C5-A781-595062B999A5}.Release|x86.ActiveCfg = Release|Any CPU
{3EC432DA-F351-43C5-A781-595062B999A5}.Release|x86.Build.0 = Release|Any CPU
{CA0F6C82-227A-41E4-A59F-B45EF68411A1}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{CA0F6C82-227A-41E4-A59F-B45EF68411A1}.Debug|Any CPU.Build.0 = Debug|Any CPU
{CA0F6C82-227A-41E4-A59F-B45EF68411A1}.Debug|x64.ActiveCfg = Debug|Any CPU
{CA0F6C82-227A-41E4-A59F-B45EF68411A1}.Debug|x64.Build.0 = Debug|Any CPU
{CA0F6C82-227A-41E4-A59F-B45EF68411A1}.Debug|x86.ActiveCfg = Debug|Any CPU
{CA0F6C82-227A-41E4-A59F-B45EF68411A1}.Debug|x86.Build.0 = Debug|Any CPU
{CA0F6C82-227A-41E4-A59F-B45EF68411A1}.Release|Any CPU.ActiveCfg = Release|Any CPU
{CA0F6C82-227A-41E4-A59F-B45EF68411A1}.Release|Any CPU.Build.0 = Release|Any CPU
{CA0F6C82-227A-41E4-A59F-B45EF68411A1}.Release|x64.ActiveCfg = Release|Any CPU
{CA0F6C82-227A-41E4-A59F-B45EF68411A1}.Release|x64.Build.0 = Release|Any CPU
{CA0F6C82-227A-41E4-A59F-B45EF68411A1}.Release|x86.ActiveCfg = Release|Any CPU
{CA0F6C82-227A-41E4-A59F-B45EF68411A1}.Release|x86.Build.0 = Release|Any CPU
{3B7514DE-1C2F-4BB1-BBD5-C57BEEC6843E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{3B7514DE-1C2F-4BB1-BBD5-C57BEEC6843E}.Debug|Any CPU.Build.0 = Debug|Any CPU
{3B7514DE-1C2F-4BB1-BBD5-C57BEEC6843E}.Debug|x64.ActiveCfg = Debug|Any CPU
{3B7514DE-1C2F-4BB1-BBD5-C57BEEC6843E}.Debug|x64.Build.0 = Debug|Any CPU
{3B7514DE-1C2F-4BB1-BBD5-C57BEEC6843E}.Debug|x86.ActiveCfg = Debug|Any CPU
{3B7514DE-1C2F-4BB1-BBD5-C57BEEC6843E}.Debug|x86.Build.0 = Debug|Any CPU
{3B7514DE-1C2F-4BB1-BBD5-C57BEEC6843E}.Release|Any CPU.ActiveCfg = Release|Any CPU
{3B7514DE-1C2F-4BB1-BBD5-C57BEEC6843E}.Release|Any CPU.Build.0 = Release|Any CPU
{3B7514DE-1C2F-4BB1-BBD5-C57BEEC6843E}.Release|x64.ActiveCfg = Release|Any CPU
{3B7514DE-1C2F-4BB1-BBD5-C57BEEC6843E}.Release|x64.Build.0 = Release|Any CPU
{3B7514DE-1C2F-4BB1-BBD5-C57BEEC6843E}.Release|x86.ActiveCfg = Release|Any CPU
{3B7514DE-1C2F-4BB1-BBD5-C57BEEC6843E}.Release|x86.Build.0 = Release|Any CPU
{9911D6BE-3022-44F6-B93B-B3D62A14FBCA}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{9911D6BE-3022-44F6-B93B-B3D62A14FBCA}.Debug|Any CPU.Build.0 = Debug|Any CPU
{9911D6BE-3022-44F6-B93B-B3D62A14FBCA}.Debug|x64.ActiveCfg = Debug|Any CPU
{9911D6BE-3022-44F6-B93B-B3D62A14FBCA}.Debug|x64.Build.0 = Debug|Any CPU
{9911D6BE-3022-44F6-B93B-B3D62A14FBCA}.Debug|x86.ActiveCfg = Debug|Any CPU
{9911D6BE-3022-44F6-B93B-B3D62A14FBCA}.Debug|x86.Build.0 = Debug|Any CPU
{9911D6BE-3022-44F6-B93B-B3D62A14FBCA}.Release|Any CPU.ActiveCfg = Release|Any CPU
{9911D6BE-3022-44F6-B93B-B3D62A14FBCA}.Release|Any CPU.Build.0 = Release|Any CPU
{9911D6BE-3022-44F6-B93B-B3D62A14FBCA}.Release|x64.ActiveCfg = Release|Any CPU
{9911D6BE-3022-44F6-B93B-B3D62A14FBCA}.Release|x64.Build.0 = Release|Any CPU
{9911D6BE-3022-44F6-B93B-B3D62A14FBCA}.Release|x86.ActiveCfg = Release|Any CPU
{9911D6BE-3022-44F6-B93B-B3D62A14FBCA}.Release|x86.Build.0 = Release|Any CPU
EndGlobalSection EndGlobalSection
GlobalSection(SolutionProperties) = preSolution GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE HideSolutionNode = FALSE
@@ -102,6 +281,11 @@ Global
{E1833EDA-39E9-C241-2772-E4C7E960AC41} = {02EA681E-C7D8-13C7-8484-4AC65E1B71E8} {E1833EDA-39E9-C241-2772-E4C7E960AC41} = {02EA681E-C7D8-13C7-8484-4AC65E1B71E8}
{DFDECBE8-D071-4CDB-A1B4-D5C556EF72A6} = {02EA681E-C7D8-13C7-8484-4AC65E1B71E8} {DFDECBE8-D071-4CDB-A1B4-D5C556EF72A6} = {02EA681E-C7D8-13C7-8484-4AC65E1B71E8}
{640BD51E-8298-4074-9713-BCE619318155} = {02EA681E-C7D8-13C7-8484-4AC65E1B71E8} {640BD51E-8298-4074-9713-BCE619318155} = {02EA681E-C7D8-13C7-8484-4AC65E1B71E8}
{5D7FCD40-BFB0-4D39-B662-05840154C6AF} = {02EA681E-C7D8-13C7-8484-4AC65E1B71E8}
{3EC432DA-F351-43C5-A781-595062B999A5} = {02EA681E-C7D8-13C7-8484-4AC65E1B71E8}
{CA0F6C82-227A-41E4-A59F-B45EF68411A1} = {02EA681E-C7D8-13C7-8484-4AC65E1B71E8}
{3B7514DE-1C2F-4BB1-BBD5-C57BEEC6843E} = {02EA681E-C7D8-13C7-8484-4AC65E1B71E8}
{9911D6BE-3022-44F6-B93B-B3D62A14FBCA} = {02EA681E-C7D8-13C7-8484-4AC65E1B71E8}
EndGlobalSection EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {0AE1AB4A-3C91-4853-93C2-C2476E79F845} SolutionGuid = {0AE1AB4A-3C91-4853-93C2-C2476E79F845}

View File

@@ -0,0 +1,33 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net9.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<IsPackable>true</IsPackable>
<PackageId>Foursat.BackOffice.BFF.ClubMembership.Protobuf</PackageId>
<Version>0.0.1</Version>
<Authors>FourSat</Authors>
<Company>FourSat</Company>
<Product>Foursat.BackOffice.BFF.ClubMembership.Protobuf</Product>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Google.Protobuf" Version="3.23.3" />
<PackageReference Include="Grpc.Core.Api" Version="2.54.0" />
<PackageReference Include="Grpc.Tools" Version="2.72.0">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="FluentValidation.DependencyInjectionExtensions" Version="11.2.2" />
</ItemGroup>
<ItemGroup>
<Protobuf Include="Protos\clubmembership.proto" GrpcServices="Client" AdditionalImportDirs="..\BackOffice.BFF.Common.Protobuf\Protos"/>
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\BackOffice.BFF.Common.Protobuf\BackOffice.BFF.Common.Protobuf.csproj" />
</ItemGroup>
</Project>

View File

@@ -0,0 +1,138 @@
syntax = "proto3";
package clubmembership;
import "public_messages.proto";
import "google/protobuf/empty.proto";
import "google/protobuf/wrappers.proto";
import "google/protobuf/timestamp.proto";
option csharp_namespace = "BackOffice.BFF.ClubMembership.Protobuf";
service ClubMembershipContract
{
rpc ActivateClubMembership(ActivateClubMembershipRequest) returns (google.protobuf.Empty);
rpc DeactivateClubMembership(DeactivateClubMembershipRequest) returns (google.protobuf.Empty);
rpc AssignFeatureToMembership(AssignFeatureToMembershipRequest) returns (google.protobuf.Empty);
rpc GetClubMembership(GetClubMembershipRequest) returns (GetClubMembershipResponse);
rpc GetAllClubMemberships(GetAllClubMembershipsRequest) returns (GetAllClubMembershipsResponse);
rpc GetClubMembershipHistory(GetClubMembershipHistoryRequest) returns (GetClubMembershipHistoryResponse);
}
// Activate Command
message ActivateClubMembershipRequest
{
int64 user_id = 1;
int64 package_id = 2;
google.protobuf.StringValue activation_code = 3;
int32 duration_months = 4;
}
// Deactivate Command
message DeactivateClubMembershipRequest
{
int64 user_id = 1;
string reason = 2;
}
// AssignFeature Command
message AssignFeatureToMembershipRequest
{
int64 user_id = 1;
int64 product_id = 2;
google.protobuf.Int32Value quantity = 3;
google.protobuf.Int32Value duration_days = 4;
}
// Get Query
message GetClubMembershipRequest
{
int64 user_id = 1;
}
message GetClubMembershipResponse
{
int64 id = 1;
int64 user_id = 2;
int64 package_id = 3;
string package_name = 4;
string activation_code = 5;
google.protobuf.Timestamp activated_at = 6;
google.protobuf.Timestamp expires_at = 7;
bool is_active = 8;
google.protobuf.Timestamp created = 9;
repeated MembershipFeatureModel features = 10;
}
message MembershipFeatureModel
{
int64 product_id = 1;
string product_name = 2;
int32 quantity = 3;
google.protobuf.Timestamp expires_at = 4;
bool is_active = 5;
}
// GetAll Query
message GetAllClubMembershipsRequest
{
google.protobuf.Int64Value user_id = 1;
google.protobuf.Int64Value package_id = 2;
google.protobuf.BoolValue is_active = 3;
google.protobuf.BoolValue is_expired = 4;
int32 page_index = 5;
int32 page_size = 6;
}
message GetAllClubMembershipsResponse
{
messages.MetaData meta_data = 1;
repeated ClubMembershipModel models = 2;
}
message ClubMembershipModel
{
int64 id = 1;
int64 user_id = 2;
string user_name = 3;
int64 package_id = 4;
string package_name = 5;
string activation_code = 6;
google.protobuf.Timestamp activated_at = 7;
google.protobuf.Timestamp expires_at = 8;
bool is_active = 9;
bool is_expired = 10;
google.protobuf.Timestamp created = 11;
}
// GetHistory Query
message GetClubMembershipHistoryRequest
{
google.protobuf.Int64Value user_id = 1;
google.protobuf.Int64Value package_id = 2;
int32 page_index = 3;
int32 page_size = 4;
}
message GetClubMembershipHistoryResponse
{
messages.MetaData meta_data = 1;
repeated ClubMembershipHistoryModel models = 2;
}
message ClubMembershipHistoryModel
{
int64 id = 1;
int64 club_membership_id = 2;
int64 user_id = 3;
google.protobuf.Int64Value old_package_id = 4;
google.protobuf.Int64Value new_package_id = 5;
google.protobuf.Timestamp old_activated_at = 6;
google.protobuf.Timestamp new_activated_at = 7;
google.protobuf.Timestamp old_expires_at = 8;
google.protobuf.Timestamp new_expires_at = 9;
int32 action = 10; // ClubMembershipAction enum
string performed_by = 11;
string reason = 12;
google.protobuf.Timestamp created = 13;
}

View File

@@ -0,0 +1,70 @@
syntax = "proto3";
package messages;
option csharp_namespace = "BackOffice.BFF.Protobuf.Common";
service PublicMessageContract{}
message PaginationState
{
int32 page_number = 1;
int32 page_size = 2;
}
message MetaData
{
int64 current_page = 1;
int64 total_page = 2;
int64 page_size = 3;
int64 total_count = 4;
bool has_previous = 5;
bool has_next = 6;
}
message DecimalValue
{
int64 units = 1;
sfixed32 nanos = 2;
}
enum PaymentStatus
{
Success = 0;
Reject = 1;
Pending = 2;
}
// وضعیت ارسال سفارش
enum DeliveryStatus
{
// نامشخص / نیاز به ارسال ندارد (مثلا سفارش پکیج)
DeliveryStatus_None = 0;
// ثبت شده و در انتظار آماده‌سازی/ارسال
DeliveryStatus_Pending = 1;
// تحویل پست/حمل‌ونقل شده است
DeliveryStatus_InTransit = 2;
// توسط مشتری دریافت شده است
DeliveryStatus_Delivered = 3;
// مرجوع شده
DeliveryStatus_Returned = 4;
}
enum TransactionType
{
Buy = 0;
DepositIpg = 1;
DepositExternal1 = 2;
Withdraw = 3;
}
enum ContractType
{
Main = 0;
CMS = 1;
}
enum PaymentMethod
{
IPG = 0;
Wallet = 1;
}

View File

@@ -0,0 +1,41 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net9.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<IsPackable>true</IsPackable>
<PackageId>Foursat.BackOffice.BFF.Commission.Protobuf</PackageId>
<Version>0.0.2</Version>
<Authors>FourSat</Authors>
<Company>FourSat</Company>
<Product>BackOffice.BFF.Commission.Protobuf</Product>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Google.Protobuf" Version="3.23.3" />
<PackageReference Include="Grpc.Core.Api" Version="2.54.0" />
<PackageReference Include="Grpc.Tools" Version="2.72.0">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="FluentValidation.DependencyInjectionExtensions" Version="11.2.2" />
</ItemGroup>
<ItemGroup>
<Protobuf Include="Protos\commission.proto" GrpcServices="Client" AdditionalImportDirs="..\BackOffice.BFF.Common.Protobuf\Protos"/>
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\BackOffice.BFF.Common.Protobuf\BackOffice.BFF.Common.Protobuf.csproj" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="Foursat.BackOffice.BFF.Common.Protobuf" Version="0.0.1" />
</ItemGroup>
<Target Name="PushPackage" AfterTargets="Pack">
<Exec Command="dotnet nuget push $(OutputPath)..\$(PackageId).$(Version).nupkg --source https://git.afrino.co/api/packages/FourSat/nuget/index.json --api-key 061a5cb15517c6da39c16cfce8556c55ae104d0d --skip-duplicate" />
</Target>
</Project>

View File

@@ -0,0 +1,273 @@
syntax = "proto3";
package commission;
import "public_messages.proto";
import "google/protobuf/empty.proto";
import "google/protobuf/wrappers.proto";
import "google/protobuf/timestamp.proto";
option csharp_namespace = "BackOffice.BFF.Commission.Protobuf";
service CommissionContract
{
// Commands
rpc CalculateWeeklyBalances(CalculateWeeklyBalancesRequest) returns (google.protobuf.Empty);
rpc CalculateWeeklyCommissionPool(CalculateWeeklyCommissionPoolRequest) returns (google.protobuf.Empty);
rpc ProcessUserPayouts(ProcessUserPayoutsRequest) returns (google.protobuf.Empty);
rpc RequestWithdrawal(RequestWithdrawalRequest) returns (google.protobuf.Empty);
rpc ProcessWithdrawal(ProcessWithdrawalRequest) returns (ProcessWithdrawalResponse);
rpc ApproveWithdrawal(ApproveWithdrawalRequest) returns (ApproveWithdrawalResponse);
rpc RejectWithdrawal(RejectWithdrawalRequest) returns (RejectWithdrawalResponse);
// Queries
rpc GetWeeklyCommissionPool(GetWeeklyCommissionPoolRequest) returns (GetWeeklyCommissionPoolResponse);
rpc GetUserCommissionPayouts(GetUserCommissionPayoutsRequest) returns (GetUserCommissionPayoutsResponse);
rpc GetCommissionPayoutHistory(GetCommissionPayoutHistoryRequest) returns (GetCommissionPayoutHistoryResponse);
rpc GetUserWeeklyBalances(GetUserWeeklyBalancesRequest) returns (GetUserWeeklyBalancesResponse);
rpc GetAllWeeklyPools(GetAllWeeklyPoolsRequest) returns (GetAllWeeklyPoolsResponse);
rpc GetWithdrawalRequests(GetWithdrawalRequestsRequest) returns (GetWithdrawalRequestsResponse);
}
// ============ Commands ============
// CalculateWeeklyBalances Command
message CalculateWeeklyBalancesRequest
{
string week_number = 1; // Format: "YYYY-Www" (e.g., "2025-W01")
bool force_recalculate = 2;
}
// CalculateWeeklyCommissionPool Command
message CalculateWeeklyCommissionPoolRequest
{
string week_number = 1;
}
// ProcessUserPayouts Command
message ProcessUserPayoutsRequest
{
string week_number = 1;
bool force_reprocess = 2;
}
// RequestWithdrawal Command
message RequestWithdrawalRequest
{
int64 payout_id = 1;
int32 withdrawal_method = 2; // WithdrawalMethod enum: Cash=0, Diamond=1
google.protobuf.StringValue iban_number = 3; // Required for Cash method
}
// ProcessWithdrawal Command
message ProcessWithdrawalRequest
{
int64 withdrawal_id = 1;
string transaction_id = 2;
string admin_note = 3;
}
message ProcessWithdrawalResponse
{
bool success = 1;
string message = 2;
}
// ApproveWithdrawal Command
message ApproveWithdrawalRequest
{
int64 withdrawal_id = 1;
string admin_note = 2;
}
message ApproveWithdrawalResponse
{
bool success = 1;
string message = 2;
}
// RejectWithdrawal Command
message RejectWithdrawalRequest
{
int64 withdrawal_id = 1;
string reject_reason = 2;
}
message RejectWithdrawalResponse
{
bool success = 1;
string message = 2;
}
// ============ Queries ============
// GetWeeklyCommissionPool Query
message GetWeeklyCommissionPoolRequest
{
string week_number = 1;
}
message GetWeeklyCommissionPoolResponse
{
int64 id = 1;
string week_number = 2;
int64 total_pool_amount = 3; // Rials
int32 total_balances = 4;
int64 value_per_balance = 5; // Rials per balance
bool is_calculated = 6;
google.protobuf.Timestamp calculated_at = 7;
google.protobuf.Timestamp created = 8;
}
// GetUserCommissionPayouts Query
message GetUserCommissionPayoutsRequest
{
google.protobuf.Int64Value user_id = 1;
google.protobuf.Int32Value status = 2; // CommissionPayoutStatus enum
google.protobuf.StringValue week_number = 3;
int32 page_index = 4;
int32 page_size = 5;
}
message GetUserCommissionPayoutsResponse
{
messages.MetaData meta_data = 1;
repeated UserCommissionPayoutModel models = 2;
}
message UserCommissionPayoutModel
{
int64 id = 1;
int64 user_id = 2;
string user_name = 3;
string week_number = 4;
int32 balances_earned = 5;
int64 value_per_balance = 6;
int64 total_amount = 7;
int32 status = 8; // CommissionPayoutStatus enum
google.protobuf.Int32Value withdrawal_method = 9;
string iban_number = 10;
google.protobuf.Timestamp created = 11;
google.protobuf.Timestamp last_modified = 12;
}
// GetCommissionPayoutHistory Query
message GetCommissionPayoutHistoryRequest
{
google.protobuf.Int64Value payout_id = 1;
google.protobuf.Int64Value user_id = 2;
google.protobuf.StringValue week_number = 3;
int32 page_index = 4;
int32 page_size = 5;
}
message GetCommissionPayoutHistoryResponse
{
messages.MetaData meta_data = 1;
repeated CommissionPayoutHistoryModel models = 2;
}
message CommissionPayoutHistoryModel
{
int64 id = 1;
int64 payout_id = 2;
int64 user_id = 3;
string week_number = 4;
int64 amount_before = 5;
int64 amount_after = 6;
int32 old_status = 7; // CommissionPayoutStatus enum
int32 new_status = 8;
int32 action = 9; // CommissionPayoutAction enum
string performed_by = 10;
string reason = 11;
google.protobuf.Timestamp created = 12;
}
// GetUserWeeklyBalances Query
message GetUserWeeklyBalancesRequest
{
google.protobuf.Int64Value user_id = 1;
google.protobuf.StringValue week_number = 2;
bool only_active = 3; // Only non-expired balances
int32 page_index = 4;
int32 page_size = 5;
}
message GetUserWeeklyBalancesResponse
{
messages.MetaData meta_data = 1;
repeated UserWeeklyBalanceModel models = 2;
}
message UserWeeklyBalanceModel
{
int64 id = 1;
int64 user_id = 2;
string week_number = 3;
int32 left_leg_balances = 4;
int32 right_leg_balances = 5;
int32 total_balances = 6;
int64 weekly_pool_contribution = 7;
google.protobuf.Timestamp calculated_at = 8;
bool is_expired = 9;
google.protobuf.Timestamp created = 10;
}
// GetWithdrawalRequests Query
message GetWithdrawalRequestsRequest
{
int32 page_index = 1;
int32 page_size = 2;
google.protobuf.Int32Value status = 3; // 0=Pending, 1=Approved, 2=Rejected, 3=Processed
google.protobuf.Int64Value user_id = 4;
}
message GetWithdrawalRequestsResponse
{
messages.MetaData meta_data = 1;
repeated WithdrawalRequestModel models = 2;
}
message WithdrawalRequestModel
{
int64 id = 1;
int64 user_id = 2;
string user_name = 3;
string phone_number = 4;
int64 amount = 5;
int32 status = 6; // 0=Pending, 1=Approved, 2=Rejected, 3=Processed
string method = 7; // Bank, Crypto, Cash
string bank_account = 8;
string bank_name = 9;
google.protobuf.Timestamp requested_at = 10;
google.protobuf.Timestamp processed_at = 11;
string admin_note = 12;
}
// GetAllWeeklyPools Query
message GetAllWeeklyPoolsRequest
{
google.protobuf.StringValue from_week = 1;
google.protobuf.StringValue to_week = 2;
google.protobuf.BoolValue only_calculated = 3;
int32 page_index = 4;
int32 page_size = 5;
}
message GetAllWeeklyPoolsResponse
{
messages.MetaData meta_data = 1;
repeated WeeklyCommissionPoolModel models = 2;
}
message WeeklyCommissionPoolModel
{
int64 id = 1;
string week_number = 2;
int64 total_pool_amount = 3;
int32 total_balances = 4;
int64 value_per_balance = 5;
bool is_calculated = 6;
google.protobuf.Timestamp calculated_at = 7;
google.protobuf.Timestamp created = 8;
}

View File

@@ -0,0 +1,70 @@
syntax = "proto3";
package messages;
option csharp_namespace = "BackOffice.BFF.Protobuf.Common";
service PublicMessageContract{}
message PaginationState
{
int32 page_number = 1;
int32 page_size = 2;
}
message MetaData
{
int64 current_page = 1;
int64 total_page = 2;
int64 page_size = 3;
int64 total_count = 4;
bool has_previous = 5;
bool has_next = 6;
}
message DecimalValue
{
int64 units = 1;
sfixed32 nanos = 2;
}
enum PaymentStatus
{
Success = 0;
Reject = 1;
Pending = 2;
}
// وضعیت ارسال سفارش
enum DeliveryStatus
{
// نامشخص / نیاز به ارسال ندارد (مثلا سفارش پکیج)
DeliveryStatus_None = 0;
// ثبت شده و در انتظار آماده‌سازی/ارسال
DeliveryStatus_Pending = 1;
// تحویل پست/حمل‌ونقل شده است
DeliveryStatus_InTransit = 2;
// توسط مشتری دریافت شده است
DeliveryStatus_Delivered = 3;
// مرجوع شده
DeliveryStatus_Returned = 4;
}
enum TransactionType
{
Buy = 0;
DepositIpg = 1;
DepositExternal1 = 2;
Withdraw = 3;
}
enum ContractType
{
Main = 0;
CMS = 1;
}
enum PaymentMethod
{
IPG = 0;
Wallet = 1;
}

View File

@@ -0,0 +1,32 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net9.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<IsPackable>true</IsPackable>
<PackageId>Foursat.BackOffice.BFF.Common.Protobuf</PackageId>
<Version>0.0.1</Version>
<Authors>FourSat</Authors>
<Company>FourSat</Company>
<Product>BackOffice.BFF.Common.Protobuf</Product>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Google.Protobuf" Version="3.23.3"/>
<PackageReference Include="Grpc.Core.Api" Version="2.54.0"/>
<PackageReference Include="Grpc.Tools" Version="2.72.0">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
</ItemGroup>
<ItemGroup>
<Protobuf Include="Protos\public_messages.proto" GrpcServices="None"/>
</ItemGroup>
<Target Name="PushPackage" AfterTargets="Pack">
<Exec Command="dotnet nuget push $(OutputPath)..\$(PackageId).$(Version).nupkg --source https://git.afrino.co/api/packages/FourSat/nuget/index.json --api-key 061a5cb15517c6da39c16cfce8556c55ae104d0d --skip-duplicate"/>
</Target>
</Project>

View File

@@ -0,0 +1,70 @@
syntax = "proto3";
package messages;
option csharp_namespace = "BackOffice.BFF.Protobuf.Common";
service PublicMessageContract{}
message PaginationState
{
int32 page_number = 1;
int32 page_size = 2;
}
message MetaData
{
int64 current_page = 1;
int64 total_page = 2;
int64 page_size = 3;
int64 total_count = 4;
bool has_previous = 5;
bool has_next = 6;
}
message DecimalValue
{
int64 units = 1;
sfixed32 nanos = 2;
}
enum PaymentStatus
{
Success = 0;
Reject = 1;
Pending = 2;
}
// وضعیت ارسال سفارش
enum DeliveryStatus
{
// نامشخص / نیاز به ارسال ندارد (مثلا سفارش پکیج)
DeliveryStatus_None = 0;
// ثبت شده و در انتظار آماده‌سازی/ارسال
DeliveryStatus_Pending = 1;
// تحویل پست/حمل‌ونقل شده است
DeliveryStatus_InTransit = 2;
// توسط مشتری دریافت شده است
DeliveryStatus_Delivered = 3;
// مرجوع شده
DeliveryStatus_Returned = 4;
}
enum TransactionType
{
Buy = 0;
DepositIpg = 1;
DepositExternal1 = 2;
Withdraw = 3;
}
enum ContractType
{
Main = 0;
CMS = 1;
}
enum PaymentMethod
{
IPG = 0;
Wallet = 1;
}

View File

@@ -0,0 +1,44 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net9.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<IsPackable>true</IsPackable>
<PackageId>BackOffice.BFF.Configuration.Protobuf</PackageId>
<Version>1.0.0</Version>
<Authors>FourSat</Authors>
<Company>FourSat</Company>
<Product>BackOffice.BFF.Configuration.Protobuf</Product>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Google.Protobuf" Version="3.23.3" />
<PackageReference Include="Grpc.Core.Api" Version="2.54.0" />
<PackageReference Include="Grpc.Tools" Version="2.72.0">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="FluentValidation.DependencyInjectionExtensions" Version="11.2.2" />
</ItemGroup>
<ItemGroup>
<Protobuf Include="Protos\configuration.proto" GrpcServices="Client" AdditionalImportDirs="..\BackOffice.BFF.Common.Protobuf\Protos"/>
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\BackOffice.BFF.Common.Protobuf\BackOffice.BFF.Common.Protobuf.csproj" />
</ItemGroup>
<Target Name="PushToFourSat" AfterTargets="Pack">
<PropertyGroup>
<NugetPackagePath>$(PackageOutputPath)$(PackageId).$(Version).nupkg</NugetPackagePath>
<PushCommand>
dotnet nuget push **/*.nupkg --source https://git.afrino.co/api/packages/FourSat/nuget/index.json --api-key 061a5cb15517c6da39c16cfce8556c55ae104d0d --skip-duplicate
</PushCommand>
</PropertyGroup>
<Exec Command="$(PushCommand)" />
</Target>
</Project>

View File

@@ -0,0 +1,110 @@
syntax = "proto3";
package configuration;
import "public_messages.proto";
import "google/protobuf/empty.proto";
import "google/protobuf/wrappers.proto";
import "google/protobuf/timestamp.proto";
option csharp_namespace = "BackOffice.BFF.Configuration.Protobuf";
service ConfigurationContract
{
rpc CreateOrUpdateConfiguration(CreateOrUpdateConfigurationRequest) returns (google.protobuf.Empty);
rpc DeactivateConfiguration(DeactivateConfigurationRequest) returns (google.protobuf.Empty);
rpc GetConfigurationByKey(GetConfigurationByKeyRequest) returns (GetConfigurationByKeyResponse);
rpc GetAllConfigurations(GetAllConfigurationsRequest) returns (GetAllConfigurationsResponse);
rpc GetConfigurationHistory(GetConfigurationHistoryRequest) returns (GetConfigurationHistoryResponse);
}
// CreateOrUpdate Command
message CreateOrUpdateConfigurationRequest
{
string key = 1;
string value = 2;
google.protobuf.StringValue description = 3;
int32 scope = 4; // ConfigurationScope enum: System=0, Network=1, Club=2, Commission=3
}
// Deactivate Command
message DeactivateConfigurationRequest
{
string key = 1;
google.protobuf.StringValue reason = 2;
}
// GetByKey Query
message GetConfigurationByKeyRequest
{
string key = 1;
}
message GetConfigurationByKeyResponse
{
int64 id = 1;
string key = 2;
string value = 3;
string description = 4;
int32 scope = 5;
bool is_active = 6;
google.protobuf.Timestamp created = 7;
google.protobuf.Timestamp last_modified = 8;
}
// GetAll Query
message GetAllConfigurationsRequest
{
google.protobuf.Int32Value scope = 1;
google.protobuf.BoolValue is_active = 2;
int32 page_index = 3;
int32 page_size = 4;
}
message GetAllConfigurationsResponse
{
messages.MetaData meta_data = 1;
repeated ConfigurationModel models = 2;
}
message ConfigurationModel
{
int64 id = 1;
string key = 2;
string value = 3;
string description = 4;
int32 scope = 5;
bool is_active = 6;
google.protobuf.Timestamp created = 7;
}
// GetHistory Query
message GetConfigurationHistoryRequest
{
google.protobuf.Int64Value configuration_id = 1;
google.protobuf.StringValue key = 2;
int32 page_index = 3;
int32 page_size = 4;
}
message GetConfigurationHistoryResponse
{
messages.MetaData meta_data = 1;
repeated ConfigurationHistoryModel models = 2;
}
message ConfigurationHistoryModel
{
int64 id = 1;
int64 configuration_id = 2;
string key = 3;
string old_value = 4;
string new_value = 5;
string old_description = 6;
string new_description = 7;
int32 old_scope = 8;
int32 new_scope = 9;
string performed_by = 10;
string reason = 11;
google.protobuf.Timestamp created = 12;
}

View File

@@ -0,0 +1,70 @@
syntax = "proto3";
package messages;
option csharp_namespace = "BackOffice.BFF.Protobuf.Common";
service PublicMessageContract{}
message PaginationState
{
int32 page_number = 1;
int32 page_size = 2;
}
message MetaData
{
int64 current_page = 1;
int64 total_page = 2;
int64 page_size = 3;
int64 total_count = 4;
bool has_previous = 5;
bool has_next = 6;
}
message DecimalValue
{
int64 units = 1;
sfixed32 nanos = 2;
}
enum PaymentStatus
{
Success = 0;
Reject = 1;
Pending = 2;
}
// وضعیت ارسال سفارش
enum DeliveryStatus
{
// نامشخص / نیاز به ارسال ندارد (مثلا سفارش پکیج)
DeliveryStatus_None = 0;
// ثبت شده و در انتظار آماده‌سازی/ارسال
DeliveryStatus_Pending = 1;
// تحویل پست/حمل‌ونقل شده است
DeliveryStatus_InTransit = 2;
// توسط مشتری دریافت شده است
DeliveryStatus_Delivered = 3;
// مرجوع شده
DeliveryStatus_Returned = 4;
}
enum TransactionType
{
Buy = 0;
DepositIpg = 1;
DepositExternal1 = 2;
Withdraw = 3;
}
enum ContractType
{
Main = 0;
CMS = 1;
}
enum PaymentMethod
{
IPG = 0;
Wallet = 1;
}

View File

@@ -0,0 +1,33 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net9.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<IsPackable>true</IsPackable>
<PackageId>Foursat.BackOffice.BFF.NetworkMembership.Protobuf</PackageId>
<Version>0.0.1</Version>
<Authors>FourSat</Authors>
<Company>FourSat</Company>
<Product>Foursat.BackOffice.BFF.NetworkMembership.Protobuf</Product>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Google.Protobuf" Version="3.23.3" />
<PackageReference Include="Grpc.Core.Api" Version="2.54.0" />
<PackageReference Include="Grpc.Tools" Version="2.72.0">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="FluentValidation.DependencyInjectionExtensions" Version="11.2.2" />
</ItemGroup>
<ItemGroup>
<Protobuf Include="Protos\networkmembership.proto" GrpcServices="Client" AdditionalImportDirs="..\BackOffice.BFF.Common.Protobuf\Protos"/>
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\BackOffice.BFF.Common.Protobuf\BackOffice.BFF.Common.Protobuf.csproj" />
</ItemGroup>
</Project>

View File

@@ -0,0 +1,124 @@
syntax = "proto3";
package networkmembership;
import "public_messages.proto";
import "google/protobuf/empty.proto";
import "google/protobuf/wrappers.proto";
import "google/protobuf/timestamp.proto";
option csharp_namespace = "BackOffice.BFF.NetworkMembership.Protobuf";
service NetworkMembershipContract
{
rpc JoinNetwork(JoinNetworkRequest) returns (google.protobuf.Empty);
rpc ChangeNetworkParent(ChangeNetworkParentRequest) returns (google.protobuf.Empty);
rpc RemoveFromNetwork(RemoveFromNetworkRequest) returns (google.protobuf.Empty);
rpc GetUserNetwork(GetUserNetworkRequest) returns (GetUserNetworkResponse);
rpc GetNetworkTree(GetNetworkTreeRequest) returns (GetNetworkTreeResponse);
rpc GetNetworkMembershipHistory(GetNetworkMembershipHistoryRequest) returns (GetNetworkMembershipHistoryResponse);
}
// JoinNetwork Command
message JoinNetworkRequest
{
int64 user_id = 1;
int64 parent_id = 2;
int32 leg = 3; // NetworkLeg enum: Left=0, Right=1
google.protobuf.StringValue referral_code = 4;
}
// ChangeParent Command
message ChangeNetworkParentRequest
{
int64 user_id = 1;
int64 new_parent_id = 2;
int32 new_leg = 3; // NetworkLeg enum
string reason = 4;
}
// Remove Command
message RemoveFromNetworkRequest
{
int64 user_id = 1;
string reason = 2;
}
// GetUserNetwork Query
message GetUserNetworkRequest
{
int64 user_id = 1;
}
message GetUserNetworkResponse
{
int64 id = 1;
int64 user_id = 2;
string user_name = 3;
google.protobuf.Int64Value parent_id = 4;
string parent_name = 5;
int32 network_leg = 6; // NetworkLeg enum
google.protobuf.Int64Value left_child_id = 7;
string left_child_name = 8;
google.protobuf.Int64Value right_child_id = 9;
string right_child_name = 10;
int32 network_level = 11;
string referral_code = 12;
google.protobuf.Timestamp joined_at = 13;
google.protobuf.Timestamp created = 14;
}
// GetNetworkTree Query
message GetNetworkTreeRequest
{
int64 root_user_id = 1;
google.protobuf.Int32Value max_depth = 2;
google.protobuf.BoolValue only_active = 3;
}
message GetNetworkTreeResponse
{
repeated NetworkTreeNodeModel nodes = 1;
}
message NetworkTreeNodeModel
{
int64 user_id = 1;
string user_name = 2;
google.protobuf.Int64Value parent_id = 3;
int32 network_leg = 4;
int32 network_level = 5;
bool is_active = 6;
google.protobuf.Timestamp joined_at = 7;
}
// GetHistory Query
message GetNetworkMembershipHistoryRequest
{
google.protobuf.Int64Value user_id = 1;
google.protobuf.Int64Value parent_id = 2;
int32 page_index = 3;
int32 page_size = 4;
}
message GetNetworkMembershipHistoryResponse
{
messages.MetaData meta_data = 1;
repeated NetworkMembershipHistoryModel models = 2;
}
message NetworkMembershipHistoryModel
{
int64 id = 1;
int64 user_id = 2;
google.protobuf.Int64Value old_parent_id = 3;
google.protobuf.Int64Value new_parent_id = 4;
google.protobuf.Int32Value old_network_leg = 5;
google.protobuf.Int32Value new_network_leg = 6;
google.protobuf.Int32Value old_network_level = 7;
google.protobuf.Int32Value new_network_level = 8;
int32 action = 9; // NetworkMembershipAction enum
string performed_by = 10;
string reason = 11;
google.protobuf.Timestamp created = 12;
}

View File

@@ -0,0 +1,70 @@
syntax = "proto3";
package messages;
option csharp_namespace = "BackOffice.BFF.Protobuf.Common";
service PublicMessageContract{}
message PaginationState
{
int32 page_number = 1;
int32 page_size = 2;
}
message MetaData
{
int64 current_page = 1;
int64 total_page = 2;
int64 page_size = 3;
int64 total_count = 4;
bool has_previous = 5;
bool has_next = 6;
}
message DecimalValue
{
int64 units = 1;
sfixed32 nanos = 2;
}
enum PaymentStatus
{
Success = 0;
Reject = 1;
Pending = 2;
}
// وضعیت ارسال سفارش
enum DeliveryStatus
{
// نامشخص / نیاز به ارسال ندارد (مثلا سفارش پکیج)
DeliveryStatus_None = 0;
// ثبت شده و در انتظار آماده‌سازی/ارسال
DeliveryStatus_Pending = 1;
// تحویل پست/حمل‌ونقل شده است
DeliveryStatus_InTransit = 2;
// توسط مشتری دریافت شده است
DeliveryStatus_Delivered = 3;
// مرجوع شده
DeliveryStatus_Returned = 4;
}
enum TransactionType
{
Buy = 0;
DepositIpg = 1;
DepositExternal1 = 2;
Withdraw = 3;
}
enum ContractType
{
Main = 0;
CMS = 1;
}
enum PaymentMethod
{
IPG = 0;
Wallet = 1;
}