5a3fc66e11c937cc93420d2e4e019671fa9bceda
[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 _0xb541=['findOne','then','update','createdAt','catch','error','utf8mb4','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./faxMessage.attributes','FaxMessage','fax_messages','fti_fax_messages','body','FULLTEXT','get','direction','toLowerCase','secret','isNil','UserId','FaxInteraction'];(function(_0x32d4da,_0x3d9fb8){var _0x3a2595=function(_0x274e90){while(--_0x274e90){_0x32d4da['push'](_0x32d4da['shift']());}};_0x3a2595(++_0x3d9fb8);}(_0xb541,0x163));var _0x1b54=function(_0x133345,_0x3a9104){_0x133345=_0x133345-0x0;var _0x817496=_0xb541[_0x133345];return _0x817496;};'use strict';var _=require(_0x1b54('0x0'));var util=require(_0x1b54('0x1'));var logger=require(_0x1b54('0x2'))(_0x1b54('0x3'));var moment=require(_0x1b54('0x4'));var BPromise=require(_0x1b54('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x1b54('0x6'));var rimraf=require(_0x1b54('0x7'));var config=require(_0x1b54('0x8'));var attributes=require(_0x1b54('0x9'));module['exports']=function(_0x158f34,_0x3ae8bd){return _0x158f34['define'](_0x1b54('0xa'),attributes,{'tableName':_0x1b54('0xb'),'paranoid':![],'indexes':[{'name':_0x1b54('0xc'),'fields':[_0x1b54('0xd')],'type':_0x1b54('0xe')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x6fc7f0,_0x4ab01f,_0x460d76){var _0x4a36a9=_0x158f34['models'];var _0x3d00a2=_0x6fc7f0[_0x1b54('0xf')]({'plain':!![]});if(_0x3d00a2[_0x1b54('0x10')][_0x1b54('0x11')]()==='in'||_0x3d00a2[_0x1b54('0x10')][_0x1b54('0x11')]()==='out'&&!_0x3d00a2[_0x1b54('0x12')]&&!_[_0x1b54('0x13')](_0x3d00a2[_0x1b54('0x14')])){_0x4a36a9[_0x1b54('0x15')][_0x1b54('0x16')]({'where':{'id':_0x3d00a2['FaxInteractionId']}})[_0x1b54('0x17')](function(_0xbfcdd8){if(_0xbfcdd8){_0xbfcdd8[_0x1b54('0x18')]({'lastMsgAt':_0x3d00a2[_0x1b54('0x19')],'lastMsgDirection':_0x3d00a2['direction'][_0x1b54('0x11')]()});}})[_0x1b54('0x1a')](function(_0x1a86de){console[_0x1b54('0x1b')](_0x1a86de);});}_0x460d76();}},'charset':_0x1b54('0x1c'),'collate':'utf8mb4_unicode_ci'});};