mirror of
https://github.com/Permissionless-Software-Foundation/bch-email-api.git
synced 2026-09-21 16:52:04 -07:00
Getting mailbox table
This commit is contained in:
+3
-1
@@ -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)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -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'
|
||||
}
|
||||
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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()
|
||||
|
||||
|
||||
@@ -15,7 +15,6 @@ const LOCALHOST = 'http://localhost:5000'
|
||||
|
||||
describe('#iRedMail', () => {
|
||||
let testType = 'unit'
|
||||
let iRedMail
|
||||
|
||||
before(async () => {
|
||||
// Detect integration test flag.
|
||||
|
||||
Reference in New Issue
Block a user