feat(club-membership): enhance club membership history queries and responses
Build and Deploy to Kubernetes / build-and-deploy (push) Failing after 17m54s

- Added filtering capabilities to GetClubMembershipHistoryQuery, allowing optional filters for UserId, ClubMembershipId, Action, and date range.
- Updated GetClubMembershipHistoryQueryHandler to utilize the new filter structure.
- Enhanced GetAllClubMembershipsQueryHandler to include LastPackage details in the response.
- Introduced new properties in GetAllClubMembershipsResponseModel for PackageId and PackageName.
- Updated Protobuf definitions to reflect changes in club membership history queries and responses.
- Refactored mapping configurations to accommodate new DTOs and filters.
This commit is contained in:
masoodafar-web
2026-06-22 22:19:44 +03:30
parent 6395f63ab5
commit f8794bbb63
41 changed files with 1590 additions and 74 deletions
@@ -0,0 +1,54 @@
using CMSMicroservice.Domain.Entities.Club;
using CMSMicroservice.Domain.Entities.History;
using CMSMicroservice.Domain.Enums;
namespace CMSMicroservice.Application.Common.Helpers;
public static class ClubMembershipCycleHistoryWriter
{
public static void WriteCycleStarted(
IApplicationDbContext context,
ClubMembershipCycle cycle,
string? performedBy = "System",
string? reason = null)
{
context.ClubMembershipCycleHistories.Add(new ClubMembershipCycleHistory
{
ClubMembershipCycleId = cycle.Id,
UserId = cycle.UserId,
CycleNumber = cycle.CycleNumber,
OldIsCurrentCycle = false,
NewIsCurrentCycle = cycle.IsCurrentCycle,
OldMagicStartedAt = null,
NewMagicStartedAt = cycle.MagicStartedAt,
OldMagicCompletedAt = null,
NewMagicCompletedAt = cycle.MagicCompletedAt,
Action = ClubMembershipCycleAction.Started,
PerformedBy = performedBy,
Reason = reason
});
}
public static void WriteCycleClosed(
IApplicationDbContext context,
ClubMembershipCycle cycle,
string? performedBy = "System",
string? reason = null)
{
context.ClubMembershipCycleHistories.Add(new ClubMembershipCycleHistory
{
ClubMembershipCycleId = cycle.Id,
UserId = cycle.UserId,
CycleNumber = cycle.CycleNumber,
OldIsCurrentCycle = true,
NewIsCurrentCycle = false,
OldMagicStartedAt = cycle.MagicStartedAt,
NewMagicStartedAt = cycle.MagicStartedAt,
OldMagicCompletedAt = cycle.MagicCompletedAt,
NewMagicCompletedAt = cycle.MagicCompletedAt,
Action = ClubMembershipCycleAction.Completed,
PerformedBy = performedBy,
Reason = reason ?? "دوره جدید جایگزین شد"
});
}
}