fix(users): Handle null values for email and status in UserDto
- Updated the UsersController to ensure that the Email field defaults to an empty string if null, and the Status field defaults to "Unknown" if not set. This improves the robustness of the user data returned in API responses.
This commit is contained in:
@@ -118,11 +118,11 @@ public class UsersController : ControllerBase
|
||||
return Ok(ApiResponse<UserDto>.Ok(new UserDto
|
||||
{
|
||||
Id = result.Id,
|
||||
Email = result.Email,
|
||||
Email = result.Email ?? string.Empty,
|
||||
FirstName = result.FirstName,
|
||||
LastName = result.LastName,
|
||||
FullName = result.FullName,
|
||||
Status = result.Status.Name,
|
||||
Status = result.Status?.Name ?? "Unknown",
|
||||
CreatedAt = result.CreatedAt,
|
||||
LastLoginAt = result.LastLoginAt
|
||||
}));
|
||||
|
||||
Reference in New Issue
Block a user