Skip to content

Commit

Permalink
replace hardDelete with softDelete
Browse files Browse the repository at this point in the history
  • Loading branch information
wtmaxim committed Jun 7, 2024
1 parent 32f6088 commit 2397dd0
Showing 1 changed file with 4 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -177,15 +177,16 @@ public async Task UpdateAsync(UpdateUserCommand request, string userId)

public async Task DeleteAsync(string userId)
{
var user = await userManager.FindByIdAsync(userId);
FshUser? user = await userManager.FindByIdAsync(userId);

_ = user ?? throw new NotFoundException("User Not Found.");

var result = await userManager.DeleteAsync(user);
user.IsActive = false;
IdentityResult? result = await userManager.UpdateAsync(user);

if (!result.Succeeded)
{
var errors = result.Errors.Select(error => error.Description).ToList();
List<string> errors = result.Errors.Select(error => error.Description).ToList();
throw new FshException("Delete profile failed", errors);
}
}
Expand Down

0 comments on commit 2397dd0

Please sign in to comment.