Built motion from commit d127c62.|0.0.151
[motion.git] / server / models / mail_account.js
index 21948a8..d9c86ef 100644 (file)
@@ -1,11 +1,8 @@
-/**
- * Chat Website Model
- */
+'use strict';
 
-var _ = require('lodash');
+const _ = require('lodash');
 
 module.exports = function(sequelize, DataTypes) {
-
        var MailAccount = sequelize.define('MailAccount', {
                description: DataTypes.STRING,
                name: {
@@ -53,6 +50,12 @@ module.exports = function(sequelize, DataTypes) {
                                return this.setDataValue('actions', JSON.stringify(val));
                        }
                },
+               closeUrl: {
+                       type: DataTypes.STRING
+               },
+               closeMethod: {
+                       type: DataTypes.ENUM('GET', 'POST')
+               },
                signature: {
                        type: DataTypes.BLOB,
                        get: function() {
@@ -60,6 +63,14 @@ module.exports = function(sequelize, DataTypes) {
                                        return _.toString(this.getDataValue('signature'));
                                }
                        }
+               },
+               custom: {
+                       type: DataTypes.BOOLEAN,
+                       defaultValue: false
+               },
+               service: {
+                       type: DataTypes.BOOLEAN,
+                       defaultValue: false
                }
        }, {
                tableName: 'mail_accounts',
@@ -81,12 +92,15 @@ module.exports = function(sequelize, DataTypes) {
 
                        // SCOPES
                        MailAccount.addScope('default', {
+                               where: {
+                                       custom: false,
+                               },
                                include: [{
                                        model: models.MailServerIn,
-                                       attributes: ['id', 'host', 'port', 'username', 'password', 'ssl', 'delete', 'filter', 'state', 'mailbox', 'connTimeout', 'authTimeout', 'keepalive', 'source']
+                                       attributes: ['id', 'host', 'port', 'username', 'password', 'ssl', 'delete', 'filter', 'state', 'mailbox', 'connTimeout', 'authTimeout', 'keepalive', 'source', 'polling', 'pollingTimeout']
                                }, {
                                        model: models.MailServerOut,
-                                       attributes: ['id', 'host', 'port', 'username', 'password', 'ssl', 'service', 'state', 'source']
+                                       attributes: ['id', 'host', 'port', 'username', 'password', 'ssl', 'state', 'source', 'description']
                                }, {
                                        model: models.MailApplication,
                                        include: [{