Fix critical bugs: SQL query, navigation, and Surface overflow warnings

This commit is contained in:
Bivekich
2025-08-06 05:36:22 +03:00
parent b3166b1dfe
commit 07eda45235
4 changed files with 97 additions and 12 deletions

View File

@ -63,12 +63,12 @@ export class ConversationsService {
const subQuery = qb.subQuery()
.select('c.id')
.from('conversations', 'c')
.leftJoin('conversation_participants', 'cp1', 'cp1.conversationId = c.id')
.leftJoin('conversation_participants', 'cp2', 'cp2.conversationId = c.id')
.leftJoin('conversation_participants', 'cp1', 'cp1."conversationId" = c.id')
.leftJoin('conversation_participants', 'cp2', 'cp2."conversationId" = c.id')
.where('c.isGroup = false')
.andWhere('cp1.userId = :user1Id', { user1Id })
.andWhere('cp2.userId = :user2Id', { user2Id })
.andWhere('(SELECT COUNT(*) FROM conversation_participants WHERE conversationId = c.id) = 2')
.andWhere('cp1."userId" = :user1Id', { user1Id })
.andWhere('cp2."userId" = :user2Id', { user2Id })
.andWhere('(SELECT COUNT(*) FROM conversation_participants WHERE "conversationId" = c.id) = 2')
.getQuery();
return 'conversation.id IN ' + subQuery;
})