diff --git a/postgres/models/mailbox.js b/postgres/models/mailbox.js index a5f4e9d..2cc82eb 100644 --- a/postgres/models/mailbox.js +++ b/postgres/models/mailbox.js @@ -1,7 +1,7 @@ /* mailbox table in the iRedMail postgres database. - The constructor cxpects an instantiation of the sequalize class. Returns a + The constructor expects an instantiation of the sequalize class. Returns a Sequelize model. */ diff --git a/src/modules/iredmail/controller.js b/src/modules/iredmail/controller.js index a39aef0..a765b1c 100644 --- a/src/modules/iredmail/controller.js +++ b/src/modules/iredmail/controller.js @@ -4,7 +4,18 @@ const util = require('util') util.inspect.defaultOptions = { depth: 1 } async function createUser (ctx) { - ctx.body = {} + try { + const modelMailbox = await ctx.iRedMail.models.mailbox.sync() + const modelForwardings = await ctx.iRedMail.models.forwardings.sync() + + // http://docs.sequelizejs.com/ + // await modelMailbox.create({}) + + ctx.body = {} + } catch (err) { + console.log(`Error in iredmail.createUser(): `, err) + ctx.throw(500, err.message) + } } /* @@ -25,10 +36,10 @@ async function getUsers (ctx) { ctx.body = users } catch (err) { - console.log(`Error in iredmail.createUser(): `, err) + console.log(`Error in iredmail.getUsers(): `, err) ctx.throw(500, err.message) } -/* + /* const user = new User(ctx.request.body.user) try { await user.save()