feat: Enhance network membership and withdrawal processing with user tracking and logging
This commit is contained in:
@@ -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);
|
||||
|
||||
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user