feat: add current user’s username as added_who in CreateAsync method

This commit is contained in:
Developer 02 2024-08-14 20:53:38 +02:00
parent 1375015275
commit 102c01b746

View File

@ -51,6 +51,10 @@ namespace DigitalData.UserManager.Application.Services
if (await HasEntity(user.Id))
return Result.Fail<int>().Message(_localizer[Key.UserAlreadyExists]);
//set the user
var current_user = await GetUserAsync();
user.AddedWho = current_user?.Username ?? "UNAUTHORIZED";
var createdUser = await _repository.CreateAsync(user);
if (createdUser is null)
return Result.Fail<int>();