X-Git-Url: http://repos.xcallymotion.com/?a=blobdiff_plain;f=server%2Fmodels%2Fvoice_voicemail_messages.js;h=b9df0a65ad240def0d143a09fd0ac7f4781fcd47;hb=17e83c68f5e6cb12c966f488b68296a3e2033bc0;hp=fbfc6914f7a8277f75cc5078bdbc9f9a8d665185;hpb=f82395beaf4cb9459262ff413925323cb0c9e927;p=motion.git diff --git a/server/models/voice_voicemail_messages.js b/server/models/voice_voicemail_messages.js index fbfc691..b9df0a6 100644 --- a/server/models/voice_voicemail_messages.js +++ b/server/models/voice_voicemail_messages.js @@ -1,4 +1,5 @@ /* jshint indent: 2 */ +var moment = require('moment'); module.exports = function(sequelize, DataTypes) { var VoiceVoicemailMessages = sequelize.define('VoiceVoicemailMessages', { @@ -54,6 +55,22 @@ module.exports = function(sequelize, DataTypes) { stamp: { type: 'TIMESTAMP', allowNull: false + }, + createdAt: { + type: DataTypes.DATE, + defaultValue: sequelize.fn('NOW'), + get: function() { + // 'this' allows you to access attributes of the instance + return moment(this.getDataValue('createdAt')).format("MM-DD-YYYY HH:mm").toString(); + } + }, + updatedAt: { + type: DataTypes.DATE, + defaultValue: sequelize.fn('NOW'), + get: function() { + // 'this' allows you to access attributes of the instance + return moment(this.getDataValue('updatedAt')).format("MM-DD-YYYY HH:mm").toString(); + } } }, { tableName: 'voice_voicemail_messages',