Built motion from commit 1038d87.|0.0.141
[motion.git] / server / models / chat_website.js
index a9a5172..310ec96 100644 (file)
@@ -2,8 +2,6 @@
  * Chat Website Model
  */
 
-var crypto = require('crypto');
-
 module.exports = function(sequelize, DataTypes) {
 
        var ChatWebsite = sequelize.define('ChatWebsite', {
@@ -107,16 +105,83 @@ module.exports = function(sequelize, DataTypes) {
                },
                service_name: {
                        type: DataTypes.STRING
+               },
+               fidelity: {
+                       type: DataTypes.BOOLEAN,
+                       defaultValue: false
+               },
+               timeout: {
+                       type: DataTypes.INTEGER,
+                       defaultValue: 0
+               },
+               agents_busy: {
+                       type: DataTypes.STRING,
+                       defaultValue: 'In this moment all agents are busy. Try again!'
+               },
+               name_title: {
+                       type: DataTypes.STRING,
+                       defaultValue: 'Name'
+               },
+               email_title: {
+                       type: DataTypes.STRING,
+                       defaultValue: 'Email Address'
+               },
+               message_title: {
+                       type: DataTypes.STRING,
+                       defaultValue: 'Message'
+               },
+               logo: {
+                       type: DataTypes.STRING
+               },
+               defaultLogo: {
+                       type: DataTypes.BOOLEAN,
+                       defaultValue: true
+               },
+               whiteLabel: {
+                       type: DataTypes.STRING,
+                       defaultValue: 'Powered by xCALLY'
+               },
+               defaultWhiteLabel: {
+                       type: DataTypes.BOOLEAN,
+                       defaultValue: true
+               },
+               acceptUrl: {
+                       type: DataTypes.STRING
+               },
+               rejectUrl: {
+                       type: DataTypes.STRING
+               },
+               closeUrl: {
+                       type: DataTypes.STRING
+               },
+               closeMethod: {
+                       type: DataTypes.ENUM('GET', 'POST')
+               },
+               acceptMethod: {
+                       type: DataTypes.ENUM('GET', 'POST')
+               },
+               rejectMethod: {
+                       type: DataTypes.ENUM('GET', 'POST')
+               },
+               actions: {
+                       type: DataTypes.STRING,
+                       get: function() {
+                               return this.getDataValue('actions') ? JSON.parse(this.getDataValue('actions')) : [];
+                       },
+                       set: function(val) {
+                               return this.setDataValue('actions', JSON.stringify(val));
+                       }
                }
        }, {
                tableName: 'chat_websites',
                associate: function(models) {
                        // hasMany relations
-                       ChatWebsite.belongsTo(models.MailTemplate, {
+                       ChatWebsite.belongsTo(models.Template, {
                                as: 'OfflineTemplate'
                        });
                        ChatWebsite.hasMany(models.ChatRoom);
                        ChatWebsite.hasMany(models.ChatApplication);
+                       ChatWebsite.belongsTo(models.List);
                        ChatWebsite.hasMany(models.ChatWebsitesField, {
                                as: 'Online',
                                foreignKey: 'OnlineId'
@@ -126,6 +191,7 @@ module.exports = function(sequelize, DataTypes) {
                                foreignKey: 'OfflineId'
                        });
                        ChatWebsite.hasMany(models.ChatProactiveAction);
+                       ChatWebsite.hasMany(models.ChatDisposition);
                }
        });