фикс
This commit is contained in:
parent
19a041266d
commit
e46b9f268e
@ -486,7 +486,13 @@ const getUserStats = async (req, res, next) => {
|
||||
readBy: { $ne: currentUserId } // Которые текущий пользователь не читал
|
||||
});
|
||||
|
||||
// 4. Получаем количество просмотров профиля
|
||||
// 4. Получаем общее количество сообщений пользователя
|
||||
const totalMessagesCount = await Message.countDocuments({
|
||||
conversationId: { $in: conversationIds },
|
||||
sender: currentUserId // Только сообщения, отправленные текущим пользователем
|
||||
});
|
||||
|
||||
// 5. Получаем количество просмотров профиля
|
||||
const profileViewsCount = await ProfileView.countDocuments({
|
||||
profileOwner: currentUserId
|
||||
});
|
||||
@ -495,7 +501,8 @@ const getUserStats = async (req, res, next) => {
|
||||
profileViews: profileViewsCount,
|
||||
likes: likesCount,
|
||||
matches: matchesCount,
|
||||
unreadMessages: unreadMessagesCount
|
||||
unreadMessages: unreadMessagesCount,
|
||||
totalMessages: totalMessagesCount // Добавляем новое значение в ответ
|
||||
};
|
||||
|
||||
console.log(`[USER_CTRL] Статистика пользователя ${currentUserId}:`, stats);
|
||||
|
Loading…
x
Reference in New Issue
Block a user