Refactor
This commit is contained in:
@@ -4,18 +4,12 @@ using Microsoft.Extensions.Logging;
|
||||
|
||||
namespace ColaFlow.Modules.Identity.Application.EventHandlers;
|
||||
|
||||
public sealed class TenantCreatedEventHandler : INotificationHandler<TenantCreatedEvent>
|
||||
public sealed class TenantCreatedEventHandler(ILogger<TenantCreatedEventHandler> logger)
|
||||
: INotificationHandler<TenantCreatedEvent>
|
||||
{
|
||||
private readonly ILogger<TenantCreatedEventHandler> _logger;
|
||||
|
||||
public TenantCreatedEventHandler(ILogger<TenantCreatedEventHandler> logger)
|
||||
{
|
||||
_logger = logger;
|
||||
}
|
||||
|
||||
public Task Handle(TenantCreatedEvent notification, CancellationToken cancellationToken)
|
||||
{
|
||||
_logger.LogInformation(
|
||||
logger.LogInformation(
|
||||
"Tenant {TenantId} created with slug '{Slug}'",
|
||||
notification.TenantId,
|
||||
notification.Slug);
|
||||
|
||||
@@ -4,18 +4,12 @@ using Microsoft.Extensions.Logging;
|
||||
|
||||
namespace ColaFlow.Modules.Identity.Application.EventHandlers;
|
||||
|
||||
public sealed class UserLoggedInEventHandler : INotificationHandler<UserLoggedInEvent>
|
||||
public sealed class UserLoggedInEventHandler(ILogger<UserLoggedInEventHandler> logger)
|
||||
: INotificationHandler<UserLoggedInEvent>
|
||||
{
|
||||
private readonly ILogger<UserLoggedInEventHandler> _logger;
|
||||
|
||||
public UserLoggedInEventHandler(ILogger<UserLoggedInEventHandler> logger)
|
||||
{
|
||||
_logger = logger;
|
||||
}
|
||||
|
||||
public Task Handle(UserLoggedInEvent notification, CancellationToken cancellationToken)
|
||||
{
|
||||
_logger.LogInformation(
|
||||
logger.LogInformation(
|
||||
"User {UserId} logged in to tenant {TenantId} from IP {IpAddress}",
|
||||
notification.UserId,
|
||||
notification.TenantId.Value,
|
||||
|
||||
@@ -4,18 +4,12 @@ using Microsoft.Extensions.Logging;
|
||||
|
||||
namespace ColaFlow.Modules.Identity.Application.EventHandlers;
|
||||
|
||||
public sealed class UserRemovedFromTenantEventHandler : INotificationHandler<UserRemovedFromTenantEvent>
|
||||
public sealed class UserRemovedFromTenantEventHandler(ILogger<UserRemovedFromTenantEventHandler> logger)
|
||||
: INotificationHandler<UserRemovedFromTenantEvent>
|
||||
{
|
||||
private readonly ILogger<UserRemovedFromTenantEventHandler> _logger;
|
||||
|
||||
public UserRemovedFromTenantEventHandler(ILogger<UserRemovedFromTenantEventHandler> logger)
|
||||
{
|
||||
_logger = logger;
|
||||
}
|
||||
|
||||
public Task Handle(UserRemovedFromTenantEvent notification, CancellationToken cancellationToken)
|
||||
{
|
||||
_logger.LogInformation(
|
||||
logger.LogInformation(
|
||||
"User {UserId} removed from tenant {TenantId}. Removed by: {RemovedBy}. Reason: {Reason}",
|
||||
notification.UserId,
|
||||
notification.TenantId.Value,
|
||||
|
||||
@@ -4,18 +4,12 @@ using Microsoft.Extensions.Logging;
|
||||
|
||||
namespace ColaFlow.Modules.Identity.Application.EventHandlers;
|
||||
|
||||
public sealed class UserRoleAssignedEventHandler : INotificationHandler<UserRoleAssignedEvent>
|
||||
public sealed class UserRoleAssignedEventHandler(ILogger<UserRoleAssignedEventHandler> logger)
|
||||
: INotificationHandler<UserRoleAssignedEvent>
|
||||
{
|
||||
private readonly ILogger<UserRoleAssignedEventHandler> _logger;
|
||||
|
||||
public UserRoleAssignedEventHandler(ILogger<UserRoleAssignedEventHandler> logger)
|
||||
{
|
||||
_logger = logger;
|
||||
}
|
||||
|
||||
public Task Handle(UserRoleAssignedEvent notification, CancellationToken cancellationToken)
|
||||
{
|
||||
_logger.LogInformation(
|
||||
logger.LogInformation(
|
||||
"User {UserId} assigned role {Role} in tenant {TenantId}. Previous role: {PreviousRole}. Assigned by: {AssignedBy}",
|
||||
notification.UserId,
|
||||
notification.Role,
|
||||
|
||||
Reference in New Issue
Block a user