count number of message read
This commit is contained in:
parent
4b21168547
commit
3357009d6a
@ -34,7 +34,7 @@ export async function getRooms(mailboxId) {
|
|||||||
room.room_name AS roomName,
|
room.room_name AS roomName,
|
||||||
address.email AS user,
|
address.email AS user,
|
||||||
room.owner_id AS userId,
|
room.owner_id AS userId,
|
||||||
room.notSeen,
|
COUNT(notSeen.message_id) AS notSeen,
|
||||||
room.room_type AS roomType,
|
room.room_type AS roomType,
|
||||||
mailbox_message.mailbox_id AS mailboxId,
|
mailbox_message.mailbox_id AS mailboxId,
|
||||||
app_thread.parent_id
|
app_thread.parent_id
|
||||||
@ -43,11 +43,35 @@ export async function getRooms(mailboxId) {
|
|||||||
INNER JOIN mailbox_message ON mailbox_message.message_id = message.message_id
|
INNER JOIN mailbox_message ON mailbox_message.message_id = message.message_id
|
||||||
INNER JOIN address ON address.address_id = room.owner_id
|
INNER JOIN address ON address.address_id = room.owner_id
|
||||||
LEFT JOIN app_thread ON room.room_id = app_thread.room_id
|
LEFT JOIN app_thread ON room.room_id = app_thread.room_id
|
||||||
|
LEFT JOIN (
|
||||||
|
SELECT app_room_message.room_id, app_room_message.message_id
|
||||||
|
FROM app_room_message
|
||||||
|
INNER JOIN flag ON flag.message_id = app_room_message.message_id
|
||||||
|
INNER JOIN flag_name ON flag.flag_id = flag_name.flag_id
|
||||||
|
WHERE flag_name.flag_name = "\\\\Seen"
|
||||||
|
) notSeen ON notSeen.room_id = room.room_id
|
||||||
WHERE
|
WHERE
|
||||||
mailbox_message.mailbox_id = ?
|
mailbox_message.mailbox_id = ?
|
||||||
|
GROUP BY room.room_id
|
||||||
ORDER BY room.lastUpdate DESC
|
ORDER BY room.lastUpdate DESC
|
||||||
`;
|
`;
|
||||||
|
const query2 = `
|
||||||
|
SELECT
|
||||||
|
room.room_id AS id,
|
||||||
|
COUNT(t.message_id) AS notSeen
|
||||||
|
FROM app_room room
|
||||||
|
INNER JOIN message ON message.message_id = room.message_id
|
||||||
|
INNER JOIN mailbox_message ON mailbox_message.message_id = message.message_id
|
||||||
|
INNER JOIN address ON address.address_id = room.owner_id
|
||||||
|
LEFT JOIN (
|
||||||
|
SELECT app_room_message.room_id, app_room_message.message_id
|
||||||
|
FROM app_room_message
|
||||||
|
INNER JOIN flag ON flag.message_id = app_room_message.message_id
|
||||||
|
INNER JOIN flag_name ON flag.flag_id = flag_name.flag_id
|
||||||
|
WHERE flag_name.flag_name = "\\\\Seen"
|
||||||
|
) t ON t.room_id = room.room_id
|
||||||
|
GROUP BY room.room_id
|
||||||
|
`;
|
||||||
const values = [mailboxId];
|
const values = [mailboxId];
|
||||||
return await execQueryAsync(query, values);
|
return await execQueryAsync(query, values);
|
||||||
}
|
}
|
||||||
@ -117,4 +141,4 @@ export async function getMembers(roomId) {
|
|||||||
`;
|
`;
|
||||||
const values = [roomId];
|
const values = [roomId];
|
||||||
return await execQueryAsync(query, values);
|
return await execQueryAsync(query, values);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user