Built motion from commit d127c62.|0.0.151
[motion.git] / server / models / mail_server_in.js
1 'use strict';
2
3 module.exports = function(sequelize, DataTypes) {
4
5         var MailServerIn = sequelize.define('MailServerIn', {
6                 description: DataTypes.STRING,
7                 host: DataTypes.STRING,
8                 username: {
9                         type: DataTypes.STRING,
10                         unique: true
11                 },
12                 password: DataTypes.STRING,
13                 port: DataTypes.INTEGER,
14                 mailbox: DataTypes.STRING,
15                 ssl: {
16                         type: DataTypes.BOOLEAN,
17                         defaultValue: false
18                 },
19                 delete: {
20                         type: DataTypes.BOOLEAN,
21                         defaultValue: false
22                 },
23                 filter: {
24                         type: DataTypes.ENUM('UNSEEN'),
25                         defaultValue: 'UNSEEN'
26                 },
27                 protocol: {
28                         type: DataTypes.ENUM('IMAP', 'POP3'),
29                         defaultValue: 'IMAP'
30                 },
31                 state: {
32                         type: DataTypes.ENUM('CONNECTING', 'CONNECTED', 'DISCONNECTED', 'ERROR', 'UNKNOWN'),
33                         defaultValue: 'UNKNOWN'
34                 },
35                 source: {
36                         type: DataTypes.STRING
37                 },
38                 connTimeout: {
39                         type: DataTypes.INTEGER,
40                         defaultValue: 10000,
41                         get: function() {
42                                 return this.getDataValue('connTimeout') ? this.getDataValue('connTimeout') / 1000 : null;
43                         },
44                         set: function(val) {
45                                 this.setDataValue('connTimeout', val * 1000);
46                         }
47                 },
48                 authTimeout: {
49                         type: DataTypes.INTEGER,
50                         defaultValue: 5000,
51                         get: function() {
52                                 return this.getDataValue('authTimeout') ? this.getDataValue('authTimeout') / 1000 : null;
53                         },
54                         set: function(val) {
55                                 this.setDataValue('authTimeout', val * 1000);
56                         }
57                 },
58                 pollingTimeout: {
59                         type: DataTypes.INTEGER,
60                         defaultValue: 60000,
61                         get: function() {
62                                 return this.getDataValue('pollingTimeout') ? this.getDataValue('pollingTimeout') / 1000 : null;
63                         },
64                         set: function(val) {
65                                 this.setDataValue('pollingTimeout', val * 1000);
66                         }
67                 },
68                 polling: {
69                         type: DataTypes.BOOLEAN,
70                         defaultValue: false
71                 },
72                 keepalive: {
73                         type: DataTypes.BOOLEAN,
74                         defaultValue: true
75                 }
76         }, {
77                 tableName: 'mail_servers_in'
78         });
79
80         return MailServerIn;
81 };