Getting mailbox table

This commit is contained in:
Chris Troutner
2019-01-22 15:26:50 -08:00
parent ef993b2763
commit 02fde0e300
4 changed files with 14 additions and 7 deletions
+3 -1
View File
@@ -10,6 +10,7 @@ const config = require('../config')
// Models
const UsedQuota = require('../postgres/models/used-quota')
const Mailbox = require('../postgres/models/mailbox')
class IRedMail {
constructor () {
@@ -18,7 +19,8 @@ class IRedMail {
// Load the models
this.models = {
usedQuota: new UsedQuota(this.sequelize)
usedQuota: new UsedQuota(this.sequelize),
mailbox: new Mailbox(this.sequelize)
}
}
+9 -4
View File
@@ -61,13 +61,18 @@ class Mailbox {
created: Sequelize.DATE,
modified: Sequelize.DATE,
expired: Sequelize.DATE,
active: Sequelize.INTEGER,
bytes: Sequelize.BIGINT,
messages: Sequelize.BIGINT
active: Sequelize.INTEGER
},
{
timestamps: false
timestamps: false,
// disable the modification of tablenames; By default, sequelize will automatically
// transform all passed model names (first parameter of define) into plural.
// if you don't want that, set the following
freezeTableName: true,
// define the table's name
tableName: 'mailbox'
}
)
}
}
+2 -1
View File
@@ -15,7 +15,8 @@ async function getUsers (ctx) {
// console.log(`ctx.iRedMail: ${util.inspect(ctx.iRedMail)}`)
// Sync the model.
const model = await ctx.iRedMail.models.usedQuota.sync()
// const model = await ctx.iRedMail.models.usedQuota.sync()
const model = await ctx.iRedMail.models.mailbox.sync()
const data = await model.findAll()
-1
View File
@@ -15,7 +15,6 @@ const LOCALHOST = 'http://localhost:5000'
describe('#iRedMail', () => {
let testType = 'unit'
let iRedMail
before(async () => {
// Detect integration test flag.