Add validators and services for Product Galleries and Product Tags

- Implemented Create, Delete, Get, and Update validators for Product Galleries.
- Added Create, Delete, Get, and Update validators for Product Tags.
- Created service classes for handling Discount Categories, Discount Orders, Discount Products, Discount Shopping Cart, Product Categories, Product Galleries, and Product Tags.
- Each service class integrates with CQRS for command and query handling.
- Established mapping profiles for Product Galleries.
This commit is contained in:
masoodafar-web
2025-12-04 02:40:49 +03:30
parent 40d54d08fc
commit f0f48118e7
436 changed files with 33159 additions and 2005 deletions
@@ -130,6 +130,30 @@ public class ActivateClubMembershipCommandHandler : IRequestHandler<ActivateClub
var existingMembership = await _context.ClubMemberships
.FirstOrDefaultAsync(c => c.UserId == user.Id, cancellationToken);
// 6.1. دریافت مبلغ هدیه از تنظیمات
var giftValueConfig = await _context.SystemConfigurations
.FirstOrDefaultAsync(
c => c.Key == "Club.MembershipGiftValue" && c.IsActive,
cancellationToken
);
long giftValue = 25_200_000; // مقدار پیش‌فرض
if (giftValueConfig != null && long.TryParse(giftValueConfig.Value, out var configValue))
{
giftValue = configValue;
_logger.LogInformation(
"Using Club.MembershipGiftValue from configuration: {GiftValue}",
giftValue
);
}
else
{
_logger.LogWarning(
"Club.MembershipGiftValue not found in configuration, using default: {GiftValue}",
giftValue
);
}
ClubMembership entity;
bool isNewMembership = existingMembership == null;
var activationDate = DateTime.UtcNow;
@@ -143,6 +167,7 @@ public class ActivateClubMembershipCommandHandler : IRequestHandler<ActivateClub
IsActive = true,
ActivatedAt = activationDate,
InitialContribution = 56_000_000,
GiftValue = giftValue, // مقدار از تنظیمات
TotalEarned = 0,
PurchaseMethod = user.PackagePurchaseMethod
};
@@ -150,9 +175,10 @@ public class ActivateClubMembershipCommandHandler : IRequestHandler<ActivateClub
_context.ClubMemberships.Add(entity);
_logger.LogInformation(
"Created new club membership for UserId {UserId} via {Method}",
"Created new club membership for UserId {UserId} via {Method}, GiftValue: {GiftValue}",
user.Id,
user.PackagePurchaseMethod
user.PackagePurchaseMethod,
giftValue
);
}
else