Built motion from commit (unavailable).|2.5.29
[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 _0x9b24=['catch','error','utf8mb4','utf8mb4_unicode_ci','util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./faxMessage.attributes','exports','FaxMessage','fax_messages','fti_fax_messages','get','direction','toLowerCase','out','secret','isNil','UserId','findOne','update','createdAt'];(function(_0x2407be,_0x19f28e){var _0x1fd91c=function(_0x5f52b6){while(--_0x5f52b6){_0x2407be['push'](_0x2407be['shift']());}};_0x1fd91c(++_0x19f28e);}(_0x9b24,0x12d));var _0x49b2=function(_0x154d53,_0x4f2b9b){_0x154d53=_0x154d53-0x0;var _0x5455e0=_0x9b24[_0x154d53];return _0x5455e0;};'use strict';var _=require('lodash');var util=require(_0x49b2('0x0'));var logger=require(_0x49b2('0x1'))(_0x49b2('0x2'));var moment=require(_0x49b2('0x3'));var BPromise=require(_0x49b2('0x4'));var rp=require(_0x49b2('0x5'));var fs=require('fs');var path=require(_0x49b2('0x6'));var rimraf=require('rimraf');var config=require(_0x49b2('0x7'));var attributes=require(_0x49b2('0x8'));module[_0x49b2('0x9')]=function(_0x13146f,_0x4b97fe){return _0x13146f['define'](_0x49b2('0xa'),attributes,{'tableName':_0x49b2('0xb'),'paranoid':![],'indexes':[{'name':_0x49b2('0xc'),'fields':['body'],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'afterCreate':function(_0x59750f,_0x2c4363,_0x1f15cf){var _0x4d05d9=_0x13146f['models'];var _0x52b404=_0x59750f[_0x49b2('0xd')]({'plain':!![]});if(_0x52b404[_0x49b2('0xe')][_0x49b2('0xf')]()==='in'||_0x52b404[_0x49b2('0xe')][_0x49b2('0xf')]()===_0x49b2('0x10')&&!_0x52b404[_0x49b2('0x11')]&&!_[_0x49b2('0x12')](_0x52b404[_0x49b2('0x13')])){_0x4d05d9['FaxInteraction'][_0x49b2('0x14')]({'where':{'id':_0x52b404['FaxInteractionId']}})['then'](function(_0x727835){if(_0x727835){_0x727835[_0x49b2('0x15')]({'lastMsgAt':_0x52b404[_0x49b2('0x16')],'lastMsgDirection':_0x52b404[_0x49b2('0xe')][_0x49b2('0xf')]()});}})[_0x49b2('0x17')](function(_0x48996b){console[_0x49b2('0x18')](_0x48996b);});}_0x1f15cf();}},'charset':_0x49b2('0x19'),'collate':_0x49b2('0x1a')});};