mirror of
https://github.com/Permissionless-Software-Foundation/bch-email-api.git
synced 2026-09-21 16:52:04 -07:00
got forwardings table
This commit is contained in:
+3
-1
@@ -11,6 +11,7 @@ const config = require('../config')
|
||||
// Models
|
||||
const UsedQuota = require('../postgres/models/used-quota')
|
||||
const Mailbox = require('../postgres/models/mailbox')
|
||||
const Forwardings = require('../postgres/models/forwardings')
|
||||
|
||||
class IRedMail {
|
||||
constructor () {
|
||||
@@ -20,7 +21,8 @@ class IRedMail {
|
||||
// Load the models
|
||||
this.models = {
|
||||
usedQuota: new UsedQuota(this.sequelize),
|
||||
mailbox: new Mailbox(this.sequelize)
|
||||
mailbox: new Mailbox(this.sequelize),
|
||||
forwardings: new Forwardings(this.sequelize)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,42 @@
|
||||
/*
|
||||
Forwardings table in the iRedMail postgres database.
|
||||
|
||||
The constructor cxpects an instantiation of the sequalize class. Returns a
|
||||
Sequelize model.
|
||||
*/
|
||||
|
||||
'use strict'
|
||||
|
||||
const Sequelize = require('sequelize')
|
||||
|
||||
class Forwardings {
|
||||
// Expects an instantiation of the sequalize class. Returns a Sequelize model.
|
||||
constructor (sequelize) {
|
||||
return sequelize.define(
|
||||
'forwardings',
|
||||
{
|
||||
id: { type: Sequelize.INTEGER, primaryKey: true },
|
||||
address: Sequelize.STRING,
|
||||
forwarding: Sequelize.STRING,
|
||||
domain: Sequelize.STRING,
|
||||
dest_domain: Sequelize.STRING,
|
||||
is_maillist: Sequelize.INTEGER,
|
||||
is_list: Sequelize.INTEGER,
|
||||
is_forwarding: Sequelize.INTEGER,
|
||||
is_alias: Sequelize.INTEGER,
|
||||
active: Sequelize.INTEGER
|
||||
},
|
||||
{
|
||||
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: 'forwardings'
|
||||
}
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = Forwardings
|
||||
@@ -16,7 +16,8 @@ async function getUsers (ctx) {
|
||||
|
||||
// Sync the model.
|
||||
// const model = await ctx.iRedMail.models.usedQuota.sync()
|
||||
const model = await ctx.iRedMail.models.mailbox.sync()
|
||||
// const model = await ctx.iRedMail.models.mailbox.sync()
|
||||
const model = await ctx.iRedMail.models.forwardings.sync()
|
||||
|
||||
const data = await model.findAll()
|
||||
|
||||
|
||||
Reference in New Issue
Block a user