callRecord.js 1.53 KB
/**
 * Created by Tommy Huang on 18/04/28.
 */
const sequelize = require('./db').db
const { INTEGER, STRING, BOOLEAN, TEXT, TIME } = require('sequelize')

const CallRecord = sequelize.define('call_record', {
  id: {
    type: STRING,
    primaryKey: true
  },
  telecomReportId: {
    type: STRING,
    field: 'telecom_report_id',
    allowNull: false,
  },
  callCost: { // 费用小计。整形数字精确到分
    type: STRING,
    field: 'call_cost',
    allowNull: false,
  },
  contactType: { // 号码分类。如银行、律师、快递等
    type: STRING,
    field: 'contact_type',
    allowNull: true,
  },
  contactName: { // 号码标签。若有多个标签,用”;”分割
    type: STRING,
    field: 'contact_name',
    allowNull: true,
  },
  callTypeName: { // 呼叫类型。主叫、被叫、呼转、未知
    type: STRING,
    field: 'call_type_name',
    allowNull: true,
  },
  callTime: { // 通话时长。时长精确到秒
    type: INTEGER,
    field: 'call_time',
    allowNull: true,
  },
  callOtherNumber: { // 对方号码
    type: STRING,
    field: 'call_other_number',
    allowNull: true,
  },
  callStartTime: { // 对方号码
    type: TIME,
    field: 'call_start_time',
    allowNull: true,
  },
  contactArea: { // 对方号码
    type: STRING,
    field: 'contact_area',
    allowNull: true,
  },
  callAddress: { // 对方号码
    type: STRING,
    field: 'callAddress',
    allowNull: true,
  },
}, {
  timestamp: true,
  createdAt: 'created_at',
  updatedAt: 'updated_at',
})

module.exports = CallRecord