feat: Enhance network membership and withdrawal processing with user tracking and logging

This commit is contained in:
masoodafar-web
2025-12-01 20:52:18 +03:30
parent 4aaf2247ff
commit 25fc73ae28
47 changed files with 9545 additions and 284 deletions

View File

@@ -3,10 +3,14 @@ namespace CMSMicroservice.Application.ConfigurationCQ.Commands.DeactivateConfigu
public class DeactivateConfigurationCommandHandler : IRequestHandler<DeactivateConfigurationCommand, Unit>
{
private readonly IApplicationDbContext _context;
private readonly ICurrentUserService _currentUser;
public DeactivateConfigurationCommandHandler(IApplicationDbContext context)
public DeactivateConfigurationCommandHandler(
IApplicationDbContext context,
ICurrentUserService currentUser)
{
_context = context;
_currentUser = currentUser;
}
public async Task<Unit> Handle(DeactivateConfigurationCommand request, CancellationToken cancellationToken)
@@ -36,7 +40,7 @@ public class DeactivateConfigurationCommandHandler : IRequestHandler<DeactivateC
OldValue = oldValue,
NewValue = entity.Value,
Reason = request.Reason ?? "Configuration deactivated",
PerformedBy = "System" // TODO: باید از Current User گرفته شود
PerformedBy = _currentUser.GetPerformedBy()
};
await _context.SystemConfigurationHistories.AddAsync(history, cancellationToken);

View File

@@ -3,10 +3,14 @@ namespace CMSMicroservice.Application.ConfigurationCQ.Commands.SetConfigurationV
public class SetConfigurationValueCommandHandler : IRequestHandler<SetConfigurationValueCommand, long>
{
private readonly IApplicationDbContext _context;
private readonly ICurrentUserService _currentUser;
public SetConfigurationValueCommandHandler(IApplicationDbContext context)
public SetConfigurationValueCommandHandler(
IApplicationDbContext context,
ICurrentUserService currentUser)
{
_context = context;
_currentUser = currentUser;
}
public async Task<long> Handle(SetConfigurationValueCommand request, CancellationToken cancellationToken)