Merge pull request 'main' (#40) from main into feature-nxdev
Reviewed-on: #40
This commit is contained in:
@@ -26,7 +26,9 @@ namespace IM_API.Configs
|
||||
.ForMember(dest => dest.IsDeleted,opt => opt.MapFrom(src => 0))
|
||||
;
|
||||
//好友信息模型转换
|
||||
CreateMap<Friend, FriendInfoDto>();
|
||||
CreateMap<Friend, FriendInfoDto>()
|
||||
.ForMember(dest => dest.UserInfo, opt => opt.MapFrom(src => src.FriendNavigation))
|
||||
;
|
||||
//好友请求通过后新增好友关系
|
||||
CreateMap<FriendRequest, Friend>()
|
||||
.ForMember(dest => dest.UserId , opt => opt.MapFrom(src => src.RequestUser))
|
||||
|
||||
@@ -18,6 +18,7 @@ namespace IM_API.Dtos
|
||||
public string RemarkName { get; init; } = string.Empty;
|
||||
|
||||
public string? Avatar { get; init; }
|
||||
public UserInfoDto UserInfo { get; init; }
|
||||
}
|
||||
|
||||
public record FriendRequestHandleDto
|
||||
|
||||
@@ -63,7 +63,7 @@ namespace IM_API.Services
|
||||
|
||||
public async Task<List<FriendInfoDto>> GetFriendListAsync(int userId, int page, int limit, bool desc)
|
||||
{
|
||||
var query = _context.Friends.Where(x => x.UserId == userId && x.Status == (sbyte)FriendStatus.Added);
|
||||
var query = _context.Friends.Include(u => u.FriendNavigation).Where(x => x.UserId == userId && x.Status == (sbyte)FriendStatus.Added);
|
||||
if (desc)
|
||||
{
|
||||
query = query.OrderByDescending(x => x.UserId);
|
||||
|
||||
Reference in New Issue
Block a user