Built motion from commit a0baffd.|1.0.1
[motion.git] / server / models / history / report_call_history.js
1 /**
2  * CDR Model
3  */
4
5 module.exports = function(sequelize, DataTypes) {
6
7   var ReportCallHistory = sequelize.define('ReportCallHistory', {
8     sourceid: DataTypes.INTEGER,
9     uniqueid: {
10       type: DataTypes.STRING,
11       unique: true
12     },
13     type: {
14       type: DataTypes.ENUM,
15       values: ['inbound', 'internal', 'outbound', 'inbound-fax', 'outbound-fax', 'tigerdial']
16     },
17     tag: DataTypes.STRING,
18     accountcode: DataTypes.STRING,
19     source: DataTypes.STRING,
20     destination: DataTypes.STRING,
21     destinationcontext: DataTypes.STRING,
22     callerid: DataTypes.STRING,
23     channel: DataTypes.STRING,
24     destinationchannel: DataTypes.STRING,
25     lastapplication: DataTypes.STRING,
26     lastdata: DataTypes.STRING,
27     starttime: DataTypes.DATE,
28     answertime: DataTypes.DATE,
29     endtime: DataTypes.DATE,
30     duration: DataTypes.INTEGER,
31     billableseconds: DataTypes.INTEGER,
32     disposition: DataTypes.STRING,
33     amaflags: DataTypes.STRING,
34     userfield: DataTypes.STRING
35   }, {
36     tableName: 'report_call_history',
37     indexes: [{
38       name: 'sourceid',
39       fields: ['sourceid']
40     }],
41     associate: function(models) {
42       // ReportCallHistory.hasMany(models.ReportQueueHistory, {
43       //   as: 'HistoryQueueCalls',
44       //   foreignKey: 'uniqueid',
45       //   constraints: false
46       // });
47       // ReportCallHistory.hasMany(models.ReportAgentHistory, {
48       //   as: 'HistoryReportAgents',
49       //   foreignKey: 'uniqueid',
50       //   constraints: false
51       // });
52     }
53   });
54   ReportCallHistory.removeAttribute('id');
55   return ReportCallHistory;
56 };