credit.js 1.95 KB
/**
 * Created by Tommy Huang on 18/04/29.
 */

const sequelize = require('./db').db
const Sequelize = require('sequelize')

const Credit = sequelize.define('credit', {
  id: {
    type: Sequelize.STRING,
    primaryKey: true
  },
  userId: {
    field: 'user_id',
    type: Sequelize.STRING,
    allowNull: false,
  },
  name: {
    type: Sequelize.STRING,
    allowNull: false,
  },
  idNo: {
    field: 'id_no',
    type: Sequelize.STRING,
    allowNull: false
  },
  phone: {
    type: Sequelize.STRING,
    allowNull: false
  },
  wechatAccount: {
    field: 'wechat_account',
    type: Sequelize.STRING,
    allowNull: false
  },
  area: {
    type: Sequelize.STRING,
    allowNull: false
  },
  address: {
    type: Sequelize.STRING,
    allowNull: false
  },
  contactA: {
    field: 'contact_a',
    type: Sequelize.STRING,
    allowNull: false,
  },
  contactARole: {
    field: 'contact_a_role',
    type: Sequelize.STRING,
    allowNull: false,
  },
  contactAPhone: {
    field: 'contact_a_phone',
    type: Sequelize.STRING,
    allowNull: false,
  },
  contactB: {
    field: 'contact_b',
    type: Sequelize.STRING,
    allowNull: false,
  },
  contactBRole: {
    field: 'contact_b_role',
    type: Sequelize.STRING,
    allowNull: false,
  },
  contactBPhone: {
    field: 'contact_b_phone',
    type: Sequelize.STRING,
    allowNull: false,
  },
  baseCreatedTime: {
    type: Sequelize.TIME,
    field: 'base_created_time',
    allowNull: false
  },
  contactATime: {
    field: 'contact_a_time',
    type: Sequelize.INTEGER,
    allowNull: false,
  },
  contactBTime: {
    field: 'contact_b_time',
    type: Sequelize.INTEGER,
    allowNull: false,
  },
  contactAAmount: {
    field: 'contact_a_amount',
    type: Sequelize.INTEGER,
    allowNull: false,
  },
  contactBAmount: {
    field: 'contact_b_amount',
    type: Sequelize.INTEGER,
    allowNull: false,
  },
}, {
  timestamp: true,
  createdAt: 'created_at',
  updatedAt: 'updated_at',
})
module.exports = Credit