993d45be7f9e67fa7687f7cf74e62a1c8973cc0a
[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 _0x4eb4=['../../config/logger','api','moment','path','../../config/environment','./faxMessage.attributes','define','FaxMessage','fax_messages','fti_fax_messages','body','FULLTEXT','models','get','direction','toLowerCase','UserId','FaxInteractionId','then','update','createdAt','catch','error','utf8mb4','utf8mb4_unicode_ci','lodash'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x4eb4,0x185));var _0x44eb=function(_0x1460f6,_0x59051a){_0x1460f6=_0x1460f6-0x0;var _0x46ce94=_0x4eb4[_0x1460f6];return _0x46ce94;};'use strict';var _=require(_0x44eb('0x0'));var util=require('util');var logger=require(_0x44eb('0x1'))(_0x44eb('0x2'));var moment=require(_0x44eb('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x44eb('0x4'));var rimraf=require('rimraf');var config=require(_0x44eb('0x5'));var attributes=require(_0x44eb('0x6'));module['exports']=function(_0x1e2eed,_0x445736){return _0x1e2eed[_0x44eb('0x7')](_0x44eb('0x8'),attributes,{'tableName':_0x44eb('0x9'),'paranoid':![],'indexes':[{'name':_0x44eb('0xa'),'fields':[_0x44eb('0xb')],'type':_0x44eb('0xc')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x5c77bd,_0x14d40f,_0x15acdc){var _0x3a41fd=_0x1e2eed[_0x44eb('0xd')];var _0xc8eb7=_0x5c77bd[_0x44eb('0xe')]({'plain':!![]});if(_0xc8eb7[_0x44eb('0xf')][_0x44eb('0x10')]()==='in'||_0xc8eb7[_0x44eb('0xf')][_0x44eb('0x10')]()==='out'&&!_0xc8eb7['secret']&&!_['isNil'](_0xc8eb7[_0x44eb('0x11')])){_0x3a41fd['FaxInteraction']['findOne']({'where':{'id':_0xc8eb7[_0x44eb('0x12')]}})[_0x44eb('0x13')](function(_0x5dcee3){if(_0x5dcee3){_0x5dcee3[_0x44eb('0x14')]({'lastMsgAt':_0xc8eb7[_0x44eb('0x15')],'lastMsgDirection':_0xc8eb7[_0x44eb('0xf')][_0x44eb('0x10')]()});}})[_0x44eb('0x16')](function(_0x202a6a){console[_0x44eb('0x17')](_0x202a6a);});}_0x15acdc();}},'charset':_0x44eb('0x18'),'collate':_0x44eb('0x19')});};