<!-- END DYMANICLY LOADED CSS FILES -->
</head>
- <body class="login page-header-fixed page-sidebar-closed-hide-logo page-quick-sidebar-over-content" data-ng-class="{'page-container-bg-solid': settings.layout.pageBodySolid, 'page-sidebar-closed': settings.layout.pageSidebarClosed, 'page-quick-sidebar-open': settings.layout.pageQuickSidebarOpened}">
+ <body class="login page-header-fixed page-sidebar-closed-hide-logo page-quick-sidebar-over-content" ng-class="{'page-container-bg-solid': settings.layout.pageBodySolid, 'page-sidebar-closed': settings.layout.pageSidebarClosed, 'page-quick-sidebar-open': settings.layout.pageQuickSidebarOpened}">
<!--[if lt IE 7]>
<p class="browsehappy">You are using an <strong>outdated</strong> browser. Please <a href="http://browsehappy.com/">upgrade your browser</a> to improve your experience.</p>
<![endif]-->
Loading…
</div>
</div>
-
- <span us-spinner="{radius:30, width:8, length: 16, scale: 0.25}" spinner-key="spinner-grid"></span>
<!-- END PAGE SPINNER -->
<!-- BEGIN PAGE SPINNER -->
# xCALLY MOTION Changelog
+- * 190d31b - 2016-03-15: Changed history move service and added missing history tables.
- * 4253e76 - 2016-03-15: migration add migration test file
- * c122b65 - 2016-03-15: migration test remove
- * 6c220c9 - 2016-03-15: scripts post-mgerge.sh
.sync();
})
.then(function() {
- require('./config/history')(cronjob);
+ require('./config/history/history')(cronjob);
})
.catch(function(err) {
console.error(err);
+++ /dev/null
-'use strict';
-
-var _ = require('lodash');
-var moment = require('moment');
-
-var sequelize = require('../models').sequelize;
-
-var ReportAgent = require('../models').ReportAgent;
-var ReportCall = require('../models').ReportCall;
-var ReportDial = require('../models').ReportDial;
-var ReportMember = require('../models').ReportMember;
-var ReportQueue = require('../models').ReportQueue;
-var ReportIntegration = require('../models').ReportIntegration;
-var ReportMailSession = require('../models').ReportMailSession;
-
-var ReportAgentHistory = require('../models').history.ReportAgentHistory;
-var ReportCallHistory = require('../models').history.ReportCallHistory;
-var ReportDialHistory = require('../models').history.ReportDialHistory;
-var ReportMemberHistory = require('../models').history.ReportMemberHistory;
-var ReportQueueHistory = require('../models').history.ReportQueueHistory;
-var ReportIntegrationHistory = require('../models').history.ReportIntegrationHistory;
-var ReportMailSessionHistory = require('../models').history.ReportMailSessionHistory;
-
-function ReportAgentInReportAgentHistory() {
- ReportAgent
- .findAll({
- where: {
- createdAt: {
- $lte: moment().format("YYYY-MM-DD HH:mm:ss")
- },
- reason: {
- $ne: null
- }
- },
- raw: true
- })
- .then(function(rows) {
- console.log('[report_agent] found: ' + rows.length);
- rows.forEach(function(row, key) {
- ReportAgentHistory
- .create(row)
- .then(function() {
- console.log('[report_agent] ' + row.id + ' row copied');
- ReportAgent.destroy({
- where: {
- id: row.id
- },
- individualHooks: true
- }).then(function(res) {
- console.log('[report_agent] ' + row.id + ' row deleted');
- }).catch(function(err) {
- console.log('[report_agent] error: ' + err)
- });
- })
- .catch(function(err) {
- console.log('[report_agent] error: ' + err);
- });
- });
- })
- .catch(function(err) {
- console.error('[report_agent] error: ' + err);
- });
-}
-
-function ReportCallInReportCallHistory() {
- ReportCall
- .findAll({
- where: {
- createdAt: {
- $lte: moment().format("YYYY-MM-DD HH:mm:ss")
- }
- },
- raw: true
- })
- .then(function(rows) {
- rows.forEach(function(row, key) {
- console.log('[report_call] found: ' + rows.length);
- ReportCallHistory
- .create(row)
- .then(function() {
- console.log('[c] ' + row.id + ' row copied');
- ReportCall.destroy({
- where: {
- id: row.id
- },
- individualHooks: true
- }).then(function(res) {
- console.log('[report_call] ' + row.id + ' row deleted');
- }).catch(function(err) {
- console.log('[report_call] error: ' + err)
- });
- })
- .catch(function(err) {
- console.log('[report_call] error: ' + err);
- });
- });
- })
- .catch(function(err) {
- console.error('[report_call] error: ' + err);
- });
-}
-
-function ReportDialInReportDialHistory() {
- ReportDial
- .findAll({
- where: {
- createdAt: {
- $lte: moment().format("YYYY-MM-DD HH:mm:ss")
- },
- dialstatus: {
- $ne: null
- }
- },
- raw: true
- })
- .then(function(rows) {
- console.log('[report_dial] found: ' + rows.length);
- rows.forEach(function(row, key) {
- ReportDialHistory
- .create(row)
- .then(function() {
- console.log('[report_dial] ' + row.id + ' row copied');
- ReportDial.destroy({
- where: {
- id: row.id
- },
- individualHooks: true
- }).then(function(res) {
- console.log('[report_dial] ' + row.id + ' row deleted');
- }).catch(function(err) {
- console.log('[report_dial] error: ' + err)
- });
- })
- .catch(function(err) {
- console.log('[report_dial] error: ' + err);
- });
- });
- })
- .catch(function(err) {
- console.error('[report_dial] error: ' + err);
- });
-}
-
-function ReportMemberInReportMemberHistory() {
- ReportMember
- .findAll({
- where: {
- createdAt: {
- $lte: moment().format("YYYY-MM-DD HH:mm:ss")
- },
- exitdate: {
- $ne: null
- }
- },
- raw: true
- })
- .then(function(rows) {
- console.log('[report_member] found: ' + rows.length);
- rows.forEach(function(row, key) {
- ReportMemberHistory
- .create(row)
- .then(function() {
- console.log('[report_member] ' + row.id + ' row copied');
- ReportMember.destroy({
- where: {
- id: row.id
- },
- individualHooks: true
- }).then(function(res) {
- console.log('[report_member] ' + row.id + ' row deleted');
- }).catch(function(err) {
- console.log('[report_member] error: ' + err)
- });
- })
- .catch(function(err) {
- console.log('[report_member] error: ' + err);
- });
- });
- })
- .catch(function(err) {
- console.error('[report_member] error: ' + err);
- });
-}
-
-function ReportQueueInReportQueueHistory() {
- ReportQueue
- .findAll({
- where: {
- createdAt: {
- $lte: moment().format("YYYY-MM-DD HH:mm:ss")
- },
- queuecallerleaveAt: {
- $ne: null
- }
- },
- raw: true
- })
- .then(function(rows) {
- console.log('[report_queue] found: ' + rows.length);
- rows.forEach(function(row, key) {
- ReportQueueHistory
- .create(row)
- .then(function() {
- console.log('[report_queue] ' + row.id + ' row copied');
- ReportQueue.destroy({
- where: {
- id: row.id
- },
- individualHooks: true
- }).then(function(res) {
- console.log('[report_queue] ' + row.id + ' row deleted');
- }).catch(function(err) {
- console.log('[report_queue] error: ' + err)
- });
- })
- .catch(function(err) {
- console.log('[report_queue] error: ' + err);
- });
- });
- })
- .catch(function(err) {
- console.error('[report_queue] error: ' + err);
- });
-}
-
-function ReportIntegrationInReportIntegrationHistory() {
- ReportIntegration
- .findAll({
- where: {
- createdAt: {
- $lte: moment().format("YYYY-MM-DD HH:mm:ss")
- }
- },
- raw: true
- })
- .then(function(rows) {
- rows.forEach(function(row, key) {
- console.log('[report_integration] found: ' + rows.length);
- ReportIntegrationHistory
- .create(row)
- .then(function() {
- console.log('[c] ' + row.id + ' row copied');
- ReportIntegration.destroy({
- where: {
- id: row.id
- },
- individualHooks: true
- }).then(function(res) {
- console.log('[report_integration] ' + row.id + ' row deleted');
- }).catch(function(err) {
- console.log('[report_integration] error: ' + err)
- });
- })
- .catch(function(err) {
- console.log('[report_integration] error: ' + err);
- });
- });
- })
- .catch(function(err) {
- console.error('[report_integration] error: ' + err);
- });
-}
-
-function ReportMailSessionInReportMailSessionHistory() {
- return sequelize.transaction(function(t) {
- var _reportMailSessions;
- return ReportMailSession
- .findAll({
- where: {
- createdAt: {
- $lte: moment().format("YYYY-MM-DD HH:mm:ss")
- },
- leaveAt: {
- $ne: null
- }
- },
- raw: true
- })
- .then(function(reportMailSessions) {
- console.log('[report_mail_session] found: ' + reportMailSessions.length);
- _reportMailSessions = reportMailSessions;
- console.log('_reportMailSessions', _reportMailSessions);
- return ReportMailSessionHistory
- .bulkCreate(_reportMailSessions, {
- individualHooks: true,
- transaction: t
- });
- })
- .then(function() {
- return ReportMailSession
- .destroy({
- where: {
- id: _.map(_reportMailSessions, 'id')
- },
- individualHooks: true,
- transaction: t
- });
- })
-
- }).then(function(result) {
- // Transaction has been committed
- // result is whatever the result of the promise chain returned to the transaction callback
- }).catch(function(err) {
- // Transaction has been rolled back
- // err is whatever rejected the promise chain returned to the transaction callback
- });
-}
-
-module.exports = function(CronJob) {
-
- // Every 1 Minute
- var job = new CronJob({
- cronTime: '00 59 23 * * *',
- // cronTime: '* * * * *',
- onTick: function() {
- console.log('cronTime onTick');
- new ReportAgentInReportAgentHistory();
- new ReportCallInReportCallHistory();
- new ReportDialInReportDialHistory();
- new ReportMemberInReportMemberHistory();
- new ReportQueueInReportQueueHistory();
- new ReportIntegrationInReportIntegrationHistory();
- new ReportMailSessionInReportMailSessionHistory();
- }
- });
-
- job.start();
-}
--- /dev/null
+'use strict';
+
+var Promise = require('bluebird');
+var sequelize = require('../../models').sequelize;
+
+var ReportCall = require('./reportCall');
+var ReportAgent = require('./reportAgent');
+var ReportMember = require('./reportMember');
+var ReportQueue = require('./reportQueue');
+var ReportIntegration = require('./reportIntegration');
+var ReportMailSession = require('./reportMailSession');
+var ReportChat = require('./reportChat');
+var ReportChatSession = require('./reportChatSession');
+var ReportMail = require('./reportMail');
+var ReportSquare = require('./reportSquare');
+var ReportSquareDetail = require('./reportSquareDetail');
+var ReportTransfer = require('./reportTransfer');
+
+module.exports = function(CronJob) {
+
+ // Every 1 Minute
+ var job = new CronJob({
+ // cronTime: '10 * * * * *',
+ cronTime: '0 59 23 * * *',
+ // cronTime: '* * * * *',
+ onTick: function() {
+ console.log('updating history...');
+ var bulkHistory = [ReportCall];
+ return sequelize.transaction(function(t) {
+ return Promise
+ .all([])
+ .then(ReportCall.move(t))
+ .then(ReportAgent.move(t))
+ .then(ReportMember.move(t))
+ .then(ReportQueue.move(t))
+ .then(ReportIntegration.move(t))
+ .then(ReportMailSession.move(t))
+ .then(ReportChat.move(t))
+ .then(ReportChatSession.move(t))
+ .then(ReportMail.move(t))
+ .then(ReportSquare.move(t))
+ .then(ReportSquareDetail.move(t))
+ .then(ReportTransfer.move(t))
+ .then(function() {
+ console.log('history updated');
+ })
+ })
+ .catch(function(err) {
+ console.error(err);
+ });
+ }
+ });
+
+ job.start();
+}
--- /dev/null
+'use strict';
+
+var _ = require('lodash');
+var moment = require('moment');
+var ReportAgent = require('../../models').ReportAgent;
+var ReportAgentHistory = require('../../models').history.ReportAgentHistory;
+
+exports.move = function(t) {
+ return function() {
+ var _items;
+ return ReportAgent
+ .findAll({
+ where: {
+ createdAt: {
+ $lte: moment().format("YYYY-MM-DD HH:mm:ss")
+ }
+ },
+ raw: true
+ })
+ .then(function(items) {
+ _items = items;
+ return ReportAgentHistory
+ .bulkCreate(items, {
+ individualHooks: true,
+ transaction: t
+ });
+ })
+ .then(function() {
+ return ReportAgent
+ .destroy({
+ where: {
+ id: _.map(_items, 'id')
+ }
+ }, {
+ individualHooks: true,
+ transaction: t
+ });
+ })
+ .then(function() {
+ console.log('updated ReportAgents history');
+ })
+ .catch(function(err) {
+ console.error(err);
+ });
+ }
+}
--- /dev/null
+'use strict';
+
+var _ = require('lodash');
+var moment = require('moment');
+var ReportCall = require('../../models').ReportCall;
+var ReportCallHistory = require('../../models').history.ReportCallHistory;
+
+exports.move = function(t) {
+ return function() {
+ var _items;
+ return ReportCall
+ .findAll({
+ where: {
+ createdAt: {
+ $lte: moment().format("YYYY-MM-DD HH:mm:ss")
+ }
+ },
+ raw: true
+ })
+ .then(function(items) {
+ _items = items;
+ return ReportCallHistory
+ .bulkCreate(items, {
+ individualHooks: true,
+ transaction: t
+ });
+ })
+ .then(function() {
+ return ReportCall
+ .destroy({
+ where: {
+ id: _.map(_items, 'id')
+ }
+ }, {
+ individualHooks: true,
+ transaction: t
+ });
+ })
+ .then(function() {
+ console.log('updated ReportCalls history');
+ })
+ .catch(function(err) {
+ console.error(err);
+ });
+ }
+}
--- /dev/null
+'use strict';
+
+var _ = require('lodash');
+var moment = require('moment');
+var ReportChat = require('../../models').ReportChat;
+var ReportChatHistory = require('../../models').history.ReportChatHistory;
+
+exports.move = function(t) {
+ return function() {
+ var _items;
+ return ReportChat
+ .findAll({
+ where: {
+ createdAt: {
+ $lte: moment().format("YYYY-MM-DD HH:mm:ss")
+ }
+ },
+ raw: true
+ })
+ .then(function(items) {
+ _items = items;
+ return ReportChatHistory
+ .bulkCreate(items, {
+ individualHooks: true,
+ transaction: t
+ });
+ })
+ .then(function() {
+ return ReportChat
+ .destroy({
+ where: {
+ id: _.map(_items, 'id')
+ }
+ }, {
+ individualHooks: true,
+ transaction: t
+ });
+ })
+ .then(function() {
+ console.log('updated ReportChats history');
+ })
+ .catch(function(err) {
+ console.error(err);
+ });
+ }
+}
--- /dev/null
+'use strict';
+
+var _ = require('lodash');
+var moment = require('moment');
+var ReportChatSession = require('../../models').ReportChatSession;
+var ReportChatSessionHistory = require('../../models').history.ReportChatSessionHistory;
+
+exports.move = function(t) {
+ return function() {
+ var _items;
+ return ReportChatSession
+ .findAll({
+ where: {
+ createdAt: {
+ $lte: moment().format("YYYY-MM-DD HH:mm:ss")
+ }
+ },
+ raw: true
+ })
+ .then(function(items) {
+ _items = items;
+ return ReportChatSessionHistory
+ .bulkCreate(items, {
+ individualHooks: true,
+ transaction: t
+ });
+ })
+ .then(function() {
+ return ReportChatSession
+ .destroy({
+ where: {
+ id: _.map(_items, 'id')
+ }
+ }, {
+ individualHooks: true,
+ transaction: t
+ });
+ })
+ .then(function() {
+ console.log('updated ReportChatSessions history');
+ })
+ .catch(function(err) {
+ console.error(err);
+ });
+ }
+}
--- /dev/null
+'use strict';
+
+var _ = require('lodash');
+var moment = require('moment');
+var ReportIntegration = require('../../models').ReportIntegration;
+var ReportIntegrationHistory = require('../../models').history.ReportIntegrationHistory;
+
+exports.move = function(t) {
+ return function() {
+ var _items;
+ return ReportIntegration
+ .findAll({
+ where: {
+ createdAt: {
+ $lte: moment().format("YYYY-MM-DD HH:mm:ss")
+ }
+ },
+ raw: true
+ })
+ .then(function(items) {
+ _items = items;
+ return ReportIntegrationHistory
+ .bulkCreate(items, {
+ individualHooks: true,
+ transaction: t
+ });
+ })
+ .then(function() {
+ return ReportIntegration
+ .destroy({
+ where: {
+ id: _.map(_items, 'id')
+ }
+ }, {
+ individualHooks: true,
+ transaction: t
+ });
+ })
+ .then(function() {
+ console.log('updated ReportIntegrations history');
+ })
+ .catch(function(err) {
+ console.error(err);
+ });
+ }
+}
--- /dev/null
+'use strict';
+
+var _ = require('lodash');
+var moment = require('moment');
+var ReportMail = require('../../models').ReportMail;
+var ReportMailHistory = require('../../models').history.ReportMailHistory;
+
+exports.move = function(t) {
+ return function() {
+ var _items;
+ return ReportMail
+ .findAll({
+ where: {
+ createdAt: {
+ $lte: moment().format("YYYY-MM-DD HH:mm:ss")
+ }
+ },
+ raw: true
+ })
+ .then(function(items) {
+ _items = items;
+ return ReportMailHistory
+ .bulkCreate(items, {
+ individualHooks: true,
+ transaction: t
+ });
+ })
+ .then(function() {
+ return ReportMail
+ .destroy({
+ where: {
+ id: _.map(_items, 'id')
+ }
+ }, {
+ individualHooks: true,
+ transaction: t
+ });
+ })
+ .then(function() {
+ console.log('updated ReportMails history');
+ })
+ .catch(function(err) {
+ console.error(err);
+ });
+ }
+}
--- /dev/null
+'use strict';
+
+var _ = require('lodash');
+var moment = require('moment');
+var ReportMailSession = require('../../models').ReportMailSession;
+var ReportMailSessionHistory = require('../../models').history.ReportMailSessionHistory;
+
+exports.move = function(t) {
+ return function() {
+ var _items;
+ return ReportMailSession
+ .findAll({
+ where: {
+ createdAt: {
+ $lte: moment().format("YYYY-MM-DD HH:mm:ss")
+ }
+ },
+ raw: true
+ })
+ .then(function(items) {
+ _items = items;
+ return ReportMailSessionHistory
+ .bulkCreate(items, {
+ individualHooks: true,
+ transaction: t
+ });
+ })
+ .then(function() {
+ return ReportMailSession
+ .destroy({
+ where: {
+ id: _.map(_items, 'id')
+ }
+ }, {
+ individualHooks: true,
+ transaction: t
+ });
+ })
+ .then(function() {
+ console.log('updated ReportMailSessions history');
+ })
+ .catch(function(err) {
+ console.error(err);
+ });
+ }
+}
--- /dev/null
+'use strict';
+
+var _ = require('lodash');
+var moment = require('moment');
+var ReportMember = require('../../models').ReportMember;
+var ReportMemberHistory = require('../../models').history.ReportMemberHistory;
+
+exports.move = function(t) {
+ return function() {
+ var _items;
+ return ReportMember
+ .findAll({
+ where: {
+ createdAt: {
+ $lte: moment().format("YYYY-MM-DD HH:mm:ss")
+ }
+ },
+ raw: true
+ })
+ .then(function(items) {
+ _items = items;
+ return ReportMemberHistory
+ .bulkCreate(items, {
+ individualHooks: true,
+ transaction: t
+ });
+ })
+ .then(function() {
+ return ReportMember
+ .destroy({
+ where: {
+ id: _.map(_items, 'id')
+ }
+ }, {
+ individualHooks: true,
+ transaction: t
+ });
+ })
+ .then(function() {
+ console.log('updated ReportMembers history');
+ })
+ .catch(function(err) {
+ console.error(err);
+ });
+ }
+}
--- /dev/null
+'use strict';
+
+var _ = require('lodash');
+var moment = require('moment');
+var ReportQueue = require('../../models').ReportQueue;
+var ReportQueueHistory = require('../../models').history.ReportQueueHistory;
+
+exports.move = function(t) {
+ return function() {
+ var _items;
+ return ReportQueue
+ .findAll({
+ where: {
+ createdAt: {
+ $lte: moment().format("YYYY-MM-DD HH:mm:ss")
+ }
+ },
+ raw: true
+ })
+ .then(function(items) {
+ _items = items;
+ return ReportQueueHistory
+ .bulkCreate(items, {
+ individualHooks: true,
+ transaction: t
+ });
+ })
+ .then(function() {
+ return ReportQueue
+ .destroy({
+ where: {
+ id: _.map(_items, 'id')
+ }
+ }, {
+ individualHooks: true,
+ transaction: t
+ });
+ })
+ .then(function() {
+ console.log('updated ReportQueues history');
+ })
+ .catch(function(err) {
+ console.error(err);
+ });
+ }
+}
--- /dev/null
+'use strict';
+
+var _ = require('lodash');
+var moment = require('moment');
+var ReportSquare = require('../../models').ReportSquare;
+var ReportSquareHistory = require('../../models').history.ReportSquareHistory;
+
+exports.move = function(t) {
+ return function() {
+ var _items;
+ return ReportSquare
+ .findAll({
+ where: {
+ createdAt: {
+ $lte: moment().format("YYYY-MM-DD HH:mm:ss")
+ }
+ },
+ raw: true
+ })
+ .then(function(items) {
+ _items = items;
+ return ReportSquareHistory
+ .bulkCreate(items, {
+ individualHooks: true,
+ transaction: t
+ });
+ })
+ .then(function() {
+ return ReportSquare
+ .destroy({
+ where: {
+ id: _.map(_items, 'id')
+ }
+ }, {
+ individualHooks: true,
+ transaction: t
+ });
+ })
+ .then(function() {
+ console.log('updated ReportSquares history');
+ })
+ .catch(function(err) {
+ console.error(err);
+ });
+ }
+}
--- /dev/null
+'use strict';
+
+var _ = require('lodash');
+var moment = require('moment');
+var ReportSquareDetail = require('../../models').ReportSquareDetail;
+var ReportSquareDetailHistory = require('../../models').history.ReportSquareDetailHistory;
+
+exports.move = function(t) {
+ return function() {
+ var _items;
+ return ReportSquareDetail
+ .findAll({
+ where: {
+ createdAt: {
+ $lte: moment().format("YYYY-MM-DD HH:mm:ss")
+ }
+ },
+ raw: true
+ })
+ .then(function(items) {
+ _items = items;
+ return ReportSquareDetailHistory
+ .bulkCreate(items, {
+ individualHooks: true,
+ transaction: t
+ });
+ })
+ .then(function() {
+ return ReportSquareDetail
+ .destroy({
+ where: {
+ id: _.map(_items, 'id')
+ }
+ }, {
+ individualHooks: true,
+ transaction: t
+ });
+ })
+ .then(function() {
+ console.log('updated ReportSquareDetailss history');
+ })
+ .catch(function(err) {
+ console.error(err);
+ });
+ }
+}
--- /dev/null
+'use strict';
+
+var _ = require('lodash');
+var moment = require('moment');
+var ReportTransfer = require('../../models').ReportTransfer;
+var ReportTransferHistory = require('../../models').history.ReportTransferHistory;
+
+exports.move = function(t) {
+ return function() {
+ var _items;
+ return ReportTransfer
+ .findAll({
+ where: {
+ createdAt: {
+ $lte: moment().format("YYYY-MM-DD HH:mm:ss")
+ }
+ },
+ raw: true
+ })
+ .then(function(items) {
+ _items = items;
+ return ReportTransferHistory
+ .bulkCreate(items, {
+ individualHooks: true,
+ transaction: t
+ });
+ })
+ .then(function() {
+ return ReportTransfer
+ .destroy({
+ where: {
+ id: _.map(_items, 'id')
+ }
+ }, {
+ individualHooks: true,
+ transaction: t
+ });
+ })
+ .then(function() {
+ console.log('updated ReportTransfers history');
+ })
+ .catch(function(err) {
+ console.error(err);
+ });
+ }
+}
--- /dev/null
+/**
+ * Agent Log Model
+ */
+
+var moment = require('moment');
+
+module.exports = function(sequelize, DataTypes) {
+
+ var ReportChatHistory = sequelize.define('ReportChatHistory', {
+
+ uniqueid: DataTypes.STRING,
+ timeslot: DataTypes.INTEGER,
+ websitename: DataTypes.STRING,
+ websiteaddress: DataTypes.STRING,
+ websiteid: DataTypes.INTEGER,
+ application: DataTypes.STRING,
+ agentid: DataTypes.INTEGER,
+ agentname: DataTypes.STRING,
+ visitorid: DataTypes.STRING,
+ visitorname: DataTypes.STRING,
+ visitoremail: DataTypes.STRING,
+ queueid: DataTypes.INTEGER,
+ queuename: DataTypes.STRING,
+ roomid: DataTypes.INTEGER,
+ reason: {
+ type: DataTypes.STRING,
+ defaultValue: 'called'
+ },
+ connectid: {
+ type: DataTypes.STRING,
+ unique: true,
+ set: function(agentconnectedAt) {
+ this.setDataValue('connectid', this.uniqueid);
+ this.setDataValue('reason', 'connect');
+ this.setDataValue('connectedAt', moment().format("YYYY-MM-DD HH:mm:ss"));
+ }
+ },
+ calledAt: DataTypes.DATE,
+ connectedAt: DataTypes.DATE
+ }, {
+ tableName: 'report_chat_history'
+ });
+
+ return ReportChatHistory;
+};
--- /dev/null
+/**
+ * Agent Log Model
+ */
+
+var moment = require('moment');
+
+module.exports = function(sequelize, DataTypes) {
+
+ var ReportChatSessionHistory = sequelize.define('ReportChatSessionHistory', {
+ uniqueid: {
+ type: DataTypes.STRING,
+ unique: true
+ },
+ websitename: DataTypes.STRING,
+ websiteaddress: DataTypes.STRING,
+ websiteid: DataTypes.INTEGER,
+ application: DataTypes.STRING,
+ visitorid: DataTypes.STRING,
+ visitorname: DataTypes.STRING,
+ visitoremail: DataTypes.STRING,
+ agentid: DataTypes.STRING,
+ agentname: DataTypes.STRING,
+ queueid: DataTypes.INTEGER,
+ queuename: DataTypes.STRING,
+ roomid: DataTypes.INTEGER,
+ joinAt: DataTypes.DATE,
+ leaveAt: DataTypes.DATE,
+ unmanagedAt: DataTypes.DATE,
+ abandonAt: DataTypes.DATE
+ }, {
+ tableName: 'report_chat_session_history'
+ });
+
+ return ReportChatSessionHistory;
+};
--- /dev/null
+/**
+ * Agent Log Model
+ */
+
+var moment = require('moment');
+
+module.exports = function(sequelize, DataTypes) {
+
+ var ReportMailHistory = sequelize.define('ReportMailHistory', {
+ uniqueid: DataTypes.STRING,
+ timeslot: DataTypes.INTEGER,
+ subject: DataTypes.STRING,
+ accountid: DataTypes.STRING,
+ accountname: DataTypes.STRING,
+ accountaddress: DataTypes.STRING,
+ application: DataTypes.STRING,
+ memberid: DataTypes.INTEGER,
+ membername: DataTypes.STRING,
+ queue: DataTypes.INTEGER,
+ queuename: DataTypes.STRING,
+ roomid: DataTypes.INTEGER,
+ messageid: DataTypes.INTEGER,
+ reason: {
+ type: DataTypes.STRING,
+ defaultValue: 'called'
+ },
+ connectid: {
+ type: DataTypes.STRING,
+ unique: true,
+ set: function(agentconnectedAt) {
+ this.setDataValue('connectid', this.uniqueid);
+ this.setDataValue('reason', 'connect');
+ this.setDataValue('connectedAt', moment().format("YYYY-MM-DD HH:mm:ss"));
+ }
+ },
+ calledAt: DataTypes.DATE,
+ connectedAt: DataTypes.DATE
+ }, {
+ tableName: 'report_mail_history'
+ });
+
+ return ReportMailHistory;
+};
--- /dev/null
+/**
+ * Context Model
+ */
+
+module.exports = function(sequelize, DataTypes) {
+
+ var ReportSquareDetailHistory = sequelize.define('ReportSquareDetailHistory', {
+ uniqueid: {
+ type: DataTypes.STRING,
+ },
+ node: {
+ type: DataTypes.STRING,
+ },
+ application: {
+ type: DataTypes.STRING,
+ },
+ data: {
+ type: DataTypes.STRING,
+ }
+ }, {
+ tableName: 'report_square_details_history'
+ });
+
+ return ReportSquareDetailHistory;
+};
--- /dev/null
+/**
+ * Context Model
+ */
+
+module.exports = function(sequelize, DataTypes) {
+
+ var ReportSquareHistory = sequelize.define('ReportSquareHistory', {
+ network: {
+ type: DataTypes.STRING,
+ },
+ network_script: {
+ type: DataTypes.STRING,
+ },
+ request: {
+ type: DataTypes.STRING,
+ },
+ channel: {
+ type: DataTypes.STRING,
+ },
+ language: {
+ type: DataTypes.STRING,
+ },
+ type: {
+ type: DataTypes.STRING,
+ },
+ uniqueid: {
+ type: DataTypes.STRING,
+ },
+ version: {
+ type: DataTypes.STRING,
+ },
+ callerid: {
+ type: DataTypes.STRING,
+ },
+ calleridname: {
+ type: DataTypes.STRING,
+ },
+ callingpres: {
+ type: DataTypes.STRING,
+ },
+ callingani2: {
+ type: DataTypes.STRING,
+ },
+ callington: {
+ type: DataTypes.STRING,
+ },
+ callingtns: {
+ type: DataTypes.STRING,
+ },
+ dnid: {
+ type: DataTypes.STRING,
+ },
+ rdnis: {
+ type: DataTypes.STRING,
+ },
+ context: {
+ type: DataTypes.STRING,
+ },
+ extension: {
+ type: DataTypes.STRING,
+ },
+ priority: {
+ type: DataTypes.STRING,
+ },
+ enhanced: {
+ type: DataTypes.STRING,
+ },
+ accountcode: {
+ type: DataTypes.STRING,
+ },
+ threadid: {
+ type: DataTypes.STRING,
+ },
+ project_name: {
+ type: DataTypes.STRING,
+ },
+ joinAt: {
+ type: DataTypes.DATE,
+ },
+ leaveAt: {
+ type: DataTypes.DATE,
+ unique: true
+ }
+ }, {
+ tableName: 'report_square_history'
+ });
+
+ return ReportSquareHistory;
+};
--- /dev/null
+/**
+ * Agent Log Model
+ */
+
+module.exports = function(sequelize, DataTypes) {
+
+ var ReportTransferHistory = sequelize.define('ReportTransferHistory', {
+ type: DataTypes.ENUM('blind', 'attended'),
+ transferercalleridnum: DataTypes.STRING,
+ transferercalleridname: DataTypes.STRING,
+ transfererconnectedlinenum: DataTypes.STRING,
+ transfererconnectedlinename: DataTypes.STRING,
+ transferercontext: DataTypes.STRING,
+ transfererexten: DataTypes.STRING,
+ transfereecontext: DataTypes.STRING,
+ transfereeexten: DataTypes.STRING,
+ transfereruniqueid: DataTypes.STRING,
+ transfererlinkedid: DataTypes.STRING,
+ extension: DataTypes.STRING,
+ }, {
+ tableName: 'report_transfer_history'
+ });
+
+ return ReportTransferHistory;
+};