@speakr/speakr-module-services
Version:
SPEAKR Shared Service Module
53 lines (48 loc) • 1.05 kB
JavaScript
'use strict';
let _ = require('underscore');
module.exports = function (sequelize, DataTypes) {
let contacts = sequelize.define('contacts', {
id: {
type: DataTypes.INTEGER,
autoIncrement: true,
allowNull: false,
primaryKey: true
},
id_hash: {
type: DataTypes.UUID,
defaultValue: DataTypes.UUIDV4,
allowNull: false
},
title: {
type: DataTypes.STRING
},
name: {
type: DataTypes.STRING
},
phone: {
type: DataTypes.STRING
},
email: {
type: DataTypes.STRING
},
type: {
type: DataTypes.STRING,
validate: {
isIn: [['speakr', 'agency']]
}
},
campaign_id: {
type: DataTypes.INTEGER,
allowNull: false
}
}, {
underscored: true,
timestamps: true,
paranoid: true
});
// contacts.prototype.toPublicJSON = function () {
// let json = this.toJSON();
// return _.pick(json, 'id', 'id_hash', 'title', 'name', 'phone', 'email', 'type');
// };
return contacts;
};