9405dc6e15e664f7fa79b9731c773d2f33665fbd
[motion2.git] / server / api / faxMessage / faxMessage.model.js
1 // *************************************************************************
2 // *                                                                       *
3 // * xCALLY Motion -  The Omnichannel Contact Center                       *
4 // * Copyright (c) Xenialab s.r.l. All Rights Reserved                     *
5 // *                                                                       *
6 // *************************************************************************
7 // *                                                                       *
8 // * Email: info@xcally.com                                                *
9 // * Website: https://www.xcally.com                                       *
10 // *                                                                       *
11 // *************************************************************************
12 // *                                                                       *
13 // * The SOFTWARE PRODUCT is protected by copyright laws and international *
14 // * copyright treaties, as well as other intellectual property laws and   *
15 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                         *
16 // *                                                                       *
17 // *************************************************************************
18 var _0x03ca=['exports','FaxMessage','fax_messages','fti_fax_messages','body','FULLTEXT','models','get','toLowerCase','direction','out','isNil','UserId','FaxInteraction','findOne','FaxInteractionId','update','createdAt','catch','error','utf8mb4','utf8mb4_unicode_ci','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','./faxMessage.attributes'];(function(_0x526dd5,_0x953fd){var _0x497ec4=function(_0x1c4dc7){while(--_0x1c4dc7){_0x526dd5['push'](_0x526dd5['shift']());}};_0x497ec4(++_0x953fd);}(_0x03ca,0x106));var _0xa03c=function(_0x2d14d5,_0x1ea4b2){_0x2d14d5=_0x2d14d5-0x0;var _0x4d89d9=_0x03ca[_0x2d14d5];return _0x4d89d9;};'use strict';var _=require('lodash');var util=require(_0xa03c('0x0'));var logger=require(_0xa03c('0x1'))(_0xa03c('0x2'));var moment=require(_0xa03c('0x3'));var BPromise=require(_0xa03c('0x4'));var rp=require(_0xa03c('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xa03c('0x6'));var config=require('../../config/environment');var attributes=require(_0xa03c('0x7'));module[_0xa03c('0x8')]=function(_0x11cf74,_0x5c8dce){return _0x11cf74['define'](_0xa03c('0x9'),attributes,{'tableName':_0xa03c('0xa'),'paranoid':![],'indexes':[{'name':_0xa03c('0xb'),'fields':[_0xa03c('0xc')],'type':_0xa03c('0xd')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x256ff3,_0x54c82b,_0x4ff827){var _0x3cee63=_0x11cf74[_0xa03c('0xe')];var _0x4f834f=_0x256ff3[_0xa03c('0xf')]({'plain':!![]});if(_0x4f834f['direction'][_0xa03c('0x10')]()==='in'||_0x4f834f[_0xa03c('0x11')][_0xa03c('0x10')]()===_0xa03c('0x12')&&!_0x4f834f['secret']&&!_[_0xa03c('0x13')](_0x4f834f[_0xa03c('0x14')])){_0x3cee63[_0xa03c('0x15')][_0xa03c('0x16')]({'where':{'id':_0x4f834f[_0xa03c('0x17')]}})['then'](function(_0x39713a){if(_0x39713a){_0x39713a[_0xa03c('0x18')]({'lastMsgAt':_0x4f834f[_0xa03c('0x19')],'lastMsgDirection':_0x4f834f[_0xa03c('0x11')][_0xa03c('0x10')]()});}})[_0xa03c('0x1a')](function(_0x4d0f83){console[_0xa03c('0x1b')](_0x4d0f83);});}_0x4ff827();}},'charset':_0xa03c('0x1c'),'collate':_0xa03c('0x1d')});};