refactor: rename UserWalletChangeLog→UserWalletHistory, add History interceptor & migration
Build and Deploy to Kubernetes / build-and-deploy (push) Successful in 9m11s

- Rename UserWalletChangeLog to UserWalletHistory across 54+ files (entities, configs, DTOs, commands, queries, protos, services)
- Rename 34 files and 11 directories accordingly
- Rename proto file userwalletchangelog.proto → userwallethistory.proto
- Add IHasHistory<T> generic interface for history auto-tracking
- Implement IHasHistory<PackageHistory> on Package entity
- Add HistoryTrackingSaveChangesInterceptor (reflection-based, auto-fills Old* values from OriginalValues)
- Wire interceptor in DI and ApplicationDbContext
- Add EF migration Q27_HistoryTables_And_RenameWalletHistory:
  * RenameTable UserWalletChangeLogs → UserWalletHistories (preserves data)
  * Rename PK, FK constraints and indexes via sp_rename
  * CreateTable ClubMembershipCycleHistories + PackageHistories
This commit is contained in:
masoodafar-web
2026-02-27 06:22:15 +03:30
parent fdbb91d2e1
commit 10d2ca20d1
86 changed files with 6255 additions and 472 deletions
@@ -1,6 +1,6 @@
namespace CMSMicroservice.Application.UserWalletCQ.Queries.GetCustomerWalletChangeLog;
namespace CMSMicroservice.Application.UserWalletCQ.Queries.GetCustomerWalletHistory;
public class GetCustomerWalletChangeLogQuery : IRequest<List<GetCustomerWalletChangeLogResponseDto>>
public class GetCustomerWalletHistoryQuery : IRequest<List<GetCustomerWalletHistoryResponseDto>>
{
/// <summary>
/// فیلتر بر اساس شناسه ارجاع (اختیاری)
@@ -1,11 +1,11 @@
namespace CMSMicroservice.Application.UserWalletCQ.Queries.GetCustomerWalletChangeLog;
namespace CMSMicroservice.Application.UserWalletCQ.Queries.GetCustomerWalletHistory;
public class GetCustomerWalletChangeLogQueryHandler : IRequestHandler<GetCustomerWalletChangeLogQuery, List<GetCustomerWalletChangeLogResponseDto>>
public class GetCustomerWalletHistoryQueryHandler : IRequestHandler<GetCustomerWalletHistoryQuery, List<GetCustomerWalletHistoryResponseDto>>
{
private readonly IApplicationDbContext _context;
private readonly ICurrentUserService _currentUser;
public GetCustomerWalletChangeLogQueryHandler(
public GetCustomerWalletHistoryQueryHandler(
IApplicationDbContext context,
ICurrentUserService currentUser)
{
@@ -13,8 +13,8 @@ public class GetCustomerWalletChangeLogQueryHandler : IRequestHandler<GetCustome
_currentUser = currentUser;
}
public async Task<List<GetCustomerWalletChangeLogResponseDto>> Handle(
GetCustomerWalletChangeLogQuery request,
public async Task<List<GetCustomerWalletHistoryResponseDto>> Handle(
GetCustomerWalletHistoryQuery request,
CancellationToken cancellationToken)
{
// Get current user's ID from JWT
@@ -35,7 +35,7 @@ public class GetCustomerWalletChangeLogQueryHandler : IRequestHandler<GetCustome
}
// Build query for wallet change logs
var query = _context.UserWalletChangeLogs
var query = _context.UserWalletHistories
.AsNoTracking()
.Where(x => x.WalletId == userWallet.Id);
@@ -53,7 +53,7 @@ public class GetCustomerWalletChangeLogQueryHandler : IRequestHandler<GetCustome
// Order by newest first
var result = await query
.OrderByDescending(x => x.Created)
.ProjectToType<GetCustomerWalletChangeLogResponseDto>()
.ProjectToType<GetCustomerWalletHistoryResponseDto>()
.ToListAsync(cancellationToken);
return result;
@@ -1,6 +1,6 @@
namespace CMSMicroservice.Application.UserWalletCQ.Queries.GetCustomerWalletChangeLog;
namespace CMSMicroservice.Application.UserWalletCQ.Queries.GetCustomerWalletHistory;
public class GetCustomerWalletChangeLogResponseDto
public class GetCustomerWalletHistoryResponseDto
{
/// <summary>
/// موجودی جاری