feat: add Logs
This commit is contained in:
@@ -1,12 +1,18 @@
|
||||
using MediatR;
|
||||
using mws.backend.dotnet.application.Audit;
|
||||
using mws.backend.dotnet.application.Common;
|
||||
using mws.backend.dotnet.application.Permissions;
|
||||
|
||||
namespace mws.backend.dotnet.application.Users;
|
||||
|
||||
public record DeleteUserCommand(Guid ActorUserId, Guid Id) : IRequest;
|
||||
public record DeleteUserCommand(Guid ActorUserId, Guid Id) : IRequest, IAuditableRequest
|
||||
{
|
||||
public string Action => "User.Delete";
|
||||
public string EntityType => "User";
|
||||
public Guid? EntityId => Id;
|
||||
}
|
||||
|
||||
public class DeleteUserHandler(IUnitOfWork uow, IPermissionService permissions) : IRequestHandler<DeleteUserCommand>
|
||||
public class DeleteUserHandler(IUnitOfWork uow, IPermissionService permissions, IAuditContext auditContext) : IRequestHandler<DeleteUserCommand>
|
||||
{
|
||||
private const string Screen = "users";
|
||||
|
||||
@@ -30,5 +36,7 @@ public class DeleteUserHandler(IUnitOfWork uow, IPermissionService permissions)
|
||||
|
||||
uow.Users.Remove(user);
|
||||
await uow.SaveChangesAsync(ct);
|
||||
|
||||
auditContext.EntityName = user.Username;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user