fetch rooms

This commit is contained in:
grimhilt
2023-03-20 14:43:07 +01:00
parent ace2063309
commit 47b8c54122
12 changed files with 160 additions and 91 deletions

View File

@@ -20,7 +20,32 @@ async function getMailboxes() {
return await execQueryAsync(query, values);
}
async function getRooms(mailboxId) {
const query = `
SELECT
app_room.room_id AS id,
app_room.room_name AS roomName,
address.email AS user,
app_room.owner_id AS userId,
app_room.notSeen,
mailbox_message.mailbox_id AS mailboxId
FROM app_room
INNER JOIN message
INNER JOIN mailbox_message
INNER JOIN address
WHERE
message.message_id = app_room.message_id AND
mailbox_message.mailbox_id = 1 AND
mailbox_message.message_id = message.message_id AND
address.address_id = app_room.owner_id
`;
// todo mailboxId
const values = [];
return await execQueryAsync(query, values);
}
module.exports = {
registerMailbox,
getMailboxes
getMailboxes,
getRooms
};