Started to flesh in the createUser() function

This commit is contained in:
Chris Troutner
2019-02-06 20:58:49 -08:00
parent 87cb1fc815
commit 77d25ef782
2 changed files with 15 additions and 4 deletions
+1 -1
View File
@@ -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.
*/
+13 -2
View File
@@ -4,7 +4,18 @@ const util = require('util')
util.inspect.defaultOptions = { depth: 1 }
async function createUser (ctx) {
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()