Merge pull request 'feature-nxdev' (#41) from feature-nxdev into main

Reviewed-on: #41
This commit is contained in:
西街长安 2026-01-13 20:15:59 +08:00
commit 448cf25538
4 changed files with 10 additions and 2 deletions

View File

@ -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))

View File

@ -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

View File

@ -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);

View File

@ -87,6 +87,7 @@
import { ref, computed, onMounted } from 'vue'
import { friendService } from '@/services/friend'
const searchQuery = ref('')
const activeContactId = ref(null)
@ -123,8 +124,12 @@ const loadContactList = async (page = 1,limit = 100) => {
contacts1.value = res.data;
}
onMounted(async () => {
await loadContactList();
const contacts = await friendService.getFriendList();
console.log(contacts)
})
</script>