Fix unread counts query

This commit is contained in:
Hakan Shehu
2024-11-11 13:57:21 +01:00
parent 64d9703efc
commit 7d214b54a7
2 changed files with 2 additions and 2 deletions

View File

@@ -163,7 +163,7 @@ export class SidebarChatListQueryHandler
.where('n.type', '=', NodeTypes.Message)
.where('n.parent_id', 'in', chatIds)
.where('un.last_seen_version_id', 'is', null)
.select(['un.node_id'])
.select(['n.parent_id as node_id'])
.select((eb) => [
eb.fn.count<number>('un.node_id').as('unread_count'),
eb.fn.sum<number>('un.mentions_count').as('mentions_count'),

View File

@@ -125,7 +125,7 @@ export class SidebarSpaceListQueryHandler
.where('n.type', '=', NodeTypes.Message)
.where('n.parent_id', 'in', channelIds)
.where('un.last_seen_version_id', 'is', null)
.select(['un.node_id'])
.select(['n.parent_id as node_id'])
.select((eb) => [
eb.fn.count<number>('un.node_id').as('unread_count'),
eb.fn.sum<number>('un.mentions_count').as('mentions_count'),