Built motion from commit da617fac.|2.6.6
[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 _0xb5c1=['error','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','FaxMessage','fax_messages','fti_fax_messages','body','FULLTEXT','models','get','direction','toLowerCase','out','secret','isNil','UserId','FaxInteraction','FaxInteractionId','then','update','catch'];(function(_0x55821d,_0x27a22e){var _0x58ea8a=function(_0x5bdd3d){while(--_0x5bdd3d){_0x55821d['push'](_0x55821d['shift']());}};_0x58ea8a(++_0x27a22e);}(_0xb5c1,0x1f2));var _0x1b5c=function(_0x1a4f2b,_0x4d0023){_0x1a4f2b=_0x1a4f2b-0x0;var _0x4ce7fb=_0xb5c1[_0x1a4f2b];return _0x4ce7fb;};'use strict';var _=require(_0x1b5c('0x0'));var util=require(_0x1b5c('0x1'));var logger=require(_0x1b5c('0x2'))(_0x1b5c('0x3'));var moment=require(_0x1b5c('0x4'));var BPromise=require(_0x1b5c('0x5'));var rp=require(_0x1b5c('0x6'));var fs=require('fs');var path=require(_0x1b5c('0x7'));var rimraf=require(_0x1b5c('0x8'));var config=require(_0x1b5c('0x9'));var attributes=require('./faxMessage.attributes');module[_0x1b5c('0xa')]=function(_0x2505e0,_0x2d2ac0){return _0x2505e0[_0x1b5c('0xb')](_0x1b5c('0xc'),attributes,{'tableName':_0x1b5c('0xd'),'paranoid':![],'indexes':[{'name':_0x1b5c('0xe'),'fields':[_0x1b5c('0xf')],'type':_0x1b5c('0x10')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x4fcb0d,_0x53ce43,_0x20ab12){var _0x4a0ef3=_0x2505e0[_0x1b5c('0x11')];var _0x33c517=_0x4fcb0d[_0x1b5c('0x12')]({'plain':!![]});if(_0x33c517[_0x1b5c('0x13')]['toLowerCase']()==='in'||_0x33c517[_0x1b5c('0x13')][_0x1b5c('0x14')]()===_0x1b5c('0x15')&&!_0x33c517[_0x1b5c('0x16')]&&!_[_0x1b5c('0x17')](_0x33c517[_0x1b5c('0x18')])){_0x4a0ef3[_0x1b5c('0x19')]['findOne']({'where':{'id':_0x33c517[_0x1b5c('0x1a')]}})[_0x1b5c('0x1b')](function(_0x4f893b){if(_0x4f893b){_0x4f893b[_0x1b5c('0x1c')]({'lastMsgAt':_0x33c517['createdAt'],'lastMsgDirection':_0x33c517[_0x1b5c('0x13')][_0x1b5c('0x14')]()});}})[_0x1b5c('0x1d')](function(_0x320de4){console[_0x1b5c('0x1e')](_0x320de4);});}_0x20ab12();}},'charset':_0x1b5c('0x1f'),'collate':_0x1b5c('0x20')});};