link imap sync to server and show email on front

This commit is contained in:
grimhilt
2023-03-26 14:20:16 +02:00
parent b156c5954d
commit d0d666f4cb
17 changed files with 266 additions and 64 deletions

View File

@@ -1,11 +1,11 @@
const statusCode = require("../utils/statusCodes").statusCodes;
const { registerMailbox } = require("../db/api");
const { registerAccount } = require("../db/api");
const { getAddresseId } = require("../db/mail");
async function addMailbox(body, res) {
async function addAccount(body, res) {
const { email, pwd, xoauth, xoauth2, host, port, tls } = body;
getAddresseId(email).then((addressId) => {
registerMailbox(addressId, pwd, xoauth, xoauth2, host, port, tls)
registerAccount(addressId, pwd, xoauth, xoauth2, host, port, tls)
.then((mailboxId) => {
res.status(statusCode.OK).json({ id: mailboxId });
})
@@ -16,5 +16,7 @@ async function addMailbox(body, res) {
}
module.exports = {
addMailbox,
addAccount,
};
// todo change mailbox to account