fix: скрыл инфу о активности ака и перестал выдавать рефреши если ак не активен
This commit is contained in:
@@ -15,6 +15,18 @@ public record UserDto(
|
||||
DateTime CreatedAt
|
||||
);
|
||||
|
||||
public record CurrentUserDto(
|
||||
int Id,
|
||||
string Email,
|
||||
string? DisplayName,
|
||||
string? AvatarUrl,
|
||||
IReadOnlyList<UserRole> Roles,
|
||||
int Xp,
|
||||
int Coins,
|
||||
int Level,
|
||||
DateTime CreatedAt
|
||||
);
|
||||
|
||||
public record UserStatsDto(
|
||||
int TotalLectures,
|
||||
int AttendedLectures,
|
||||
|
||||
@@ -9,5 +9,5 @@ public interface IAuthService
|
||||
Task<AuthResult> DevLoginAsync(string email, string? displayName, IReadOnlyCollection<Domain.Enums.UserRole> roles, string? ipAddress = null);
|
||||
Task<AuthResult> RefreshTokenAsync(string refreshToken);
|
||||
Task RevokeRefreshTokenAsync(string refreshToken);
|
||||
Task<UserDto> GetCurrentUserAsync(int userId);
|
||||
Task<CurrentUserDto> GetCurrentUserAsync(int userId);
|
||||
}
|
||||
|
||||
@@ -19,6 +19,11 @@ public static class MappingExtensions
|
||||
user.Roles.Select(r => r.Role).OrderBy(r => r).ToList(), user.IsActive, user.Xp, user.Coins, level, user.CreatedAt
|
||||
);
|
||||
|
||||
public static CurrentUserDto ToCurrentUserDto(this User user, int level) => new(
|
||||
user.Id, user.Email, user.DisplayName, user.AvatarUrl,
|
||||
user.Roles.Select(r => r.Role).OrderBy(r => r).ToList(), user.Xp, user.Coins, level, user.CreatedAt
|
||||
);
|
||||
|
||||
public static UserAuthDto ToAuthDto(this User user) => new(
|
||||
user.Id, user.Email, user.DisplayName, user.Roles.Select(r => r.Role).OrderBy(r => r).ToList()
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user