const { db, execQueryAsync, execQueryAsyncWithId } = require("./db.js"); const DEBUG = require("../utils/debug").DEBUG; async function registerMailbox(userId, pwd, xoauth, xoauth2, host, port, tls) { const query = ` INSERT INTO app_account (user_id, account_pwd, xoauth, xoauth2, host, port, tls) VALUES (?, ?, ?, ?, ?, ?, ?) `; const values = [userId, pwd, xoauth, xoauth2, host, port, tls]; return await execQueryAsyncWithId(query, values); } async function getMailboxes() { const query = ` SELECT app_account.account_id AS id, address.email FROM app_account INNER JOIN address WHERE address.address_id = app_account.user_id `; const values = []; return await execQueryAsync(query, values); } module.exports = { registerMailbox, getMailboxes };