Built motion from commit (unavailable).|2.5.21
[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 _0x11ba=['secret','isNil','UserId','findOne','FaxInteractionId','then','catch','error','utf8mb4','util','../../config/logger','moment','bluebird','request-promise','path','../../config/environment','./faxMessage.attributes','exports','define','FaxMessage','body','FULLTEXT','models','get','direction','toLowerCase','out'];(function(_0x1283d4,_0x36b6f1){var _0x433643=function(_0x4c9fbe){while(--_0x4c9fbe){_0x1283d4['push'](_0x1283d4['shift']());}};_0x433643(++_0x36b6f1);}(_0x11ba,0x1d4));var _0xa11b=function(_0x5721f0,_0x4dd6df){_0x5721f0=_0x5721f0-0x0;var _0x4cdbc6=_0x11ba[_0x5721f0];return _0x4cdbc6;};'use strict';var _=require('lodash');var util=require(_0xa11b('0x0'));var logger=require(_0xa11b('0x1'))('api');var moment=require(_0xa11b('0x2'));var BPromise=require(_0xa11b('0x3'));var rp=require(_0xa11b('0x4'));var fs=require('fs');var path=require(_0xa11b('0x5'));var rimraf=require('rimraf');var config=require(_0xa11b('0x6'));var attributes=require(_0xa11b('0x7'));module[_0xa11b('0x8')]=function(_0x57256f,_0x514f81){return _0x57256f[_0xa11b('0x9')](_0xa11b('0xa'),attributes,{'tableName':'fax_messages','paranoid':![],'indexes':[{'name':'fti_fax_messages','fields':[_0xa11b('0xb')],'type':_0xa11b('0xc')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x10f813,_0x17c6d2,_0x3bdd64){var _0x5833f8=_0x57256f[_0xa11b('0xd')];var _0x371ce3=_0x10f813[_0xa11b('0xe')]({'plain':!![]});if(_0x371ce3[_0xa11b('0xf')][_0xa11b('0x10')]()==='in'||_0x371ce3['direction'][_0xa11b('0x10')]()===_0xa11b('0x11')&&!_0x371ce3[_0xa11b('0x12')]&&!_[_0xa11b('0x13')](_0x371ce3[_0xa11b('0x14')])){_0x5833f8['FaxInteraction'][_0xa11b('0x15')]({'where':{'id':_0x371ce3[_0xa11b('0x16')]}})[_0xa11b('0x17')](function(_0x5193cd){if(_0x5193cd){_0x5193cd['update']({'lastMsgAt':_0x371ce3['createdAt'],'lastMsgDirection':_0x371ce3[_0xa11b('0xf')]['toLowerCase']()});}})[_0xa11b('0x18')](function(_0x24977c){console[_0xa11b('0x19')](_0x24977c);});}_0x3bdd64();}},'charset':_0xa11b('0x1a'),'collate':'utf8mb4_unicode_ci'});};