Built motion from commit 67e5df37.|2.0.66
[motion2.git] / server / api / faxInteraction / faxInteraction.rpc.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 _0x26f1=['spread','AddTags','lodash','moment','bluebird','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','socket.io-emitter','localhost','./faxInteraction.socket','register','then','info','FaxInteraction,\x20%s,\x20%s','request\x20sent','debug','FaxInteraction,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','UpdateFaxInteraction','FaxInteraction','update','options','where','attributes','limit','stringify','AddTagsToFaxInteraction','find','body','ids','omit'];(function(_0x371620,_0x5dbfa5){var _0x42df06=function(_0x57d259){while(--_0x57d259){_0x371620['push'](_0x371620['shift']());}};_0x42df06(++_0x5dbfa5);}(_0x26f1,0xa2));var _0x126f=function(_0x334841,_0x2bbc4c){_0x334841=_0x334841-0x0;var _0x5beb4b=_0x26f1[_0x334841];return _0x5beb4b;};'use strict';var _=require(_0x126f('0x0'));var util=require('util');var moment=require(_0x126f('0x1'));var BPromise=require(_0x126f('0x2'));var rs=require('randomstring');var fs=require('fs');var db=require(_0x126f('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x126f('0x4'))(_0x126f('0x5'));var config=require(_0x126f('0x6'));var jayson=require(_0x126f('0x7'));var client=jayson[_0x126f('0x8')][_0x126f('0x9')]({'port':0x232a});var socket=require(_0x126f('0xa'))({'host':_0x126f('0xb'),'port':0x18eb});require(_0x126f('0xc'))[_0x126f('0xd')](socket);function respondWithRpcPromise(_0x34515f,_0x4f4848,_0x581b36){return new BPromise(function(_0x21bbf2,_0x3e8532){return client['request'](_0x34515f,_0x581b36)[_0x126f('0xe')](function(_0x5dc192){logger[_0x126f('0xf')](_0x126f('0x10'),_0x4f4848,_0x126f('0x11'));logger[_0x126f('0x12')](_0x126f('0x13'),_0x4f4848,_0x126f('0x11'),JSON['stringify'](_0x5dc192));if(_0x5dc192[_0x126f('0x14')]){if(_0x5dc192[_0x126f('0x14')][_0x126f('0x15')]===0x1f4){logger[_0x126f('0x14')](_0x126f('0x10'),_0x4f4848,_0x5dc192[_0x126f('0x14')][_0x126f('0x16')]);return _0x3e8532(_0x5dc192[_0x126f('0x14')][_0x126f('0x16')]);}logger[_0x126f('0x14')](_0x126f('0x10'),_0x4f4848,_0x5dc192[_0x126f('0x14')][_0x126f('0x16')]);return _0x21bbf2(_0x5dc192[_0x126f('0x14')][_0x126f('0x16')]);}else{logger[_0x126f('0xf')]('FaxInteraction,\x20%s,\x20%s',_0x4f4848,'request\x20sent');_0x21bbf2(_0x5dc192[_0x126f('0x17')]['message']);}})[_0x126f('0x18')](function(_0x5aebc7){logger[_0x126f('0x14')](_0x126f('0x10'),_0x4f4848,_0x5aebc7);_0x3e8532(_0x5aebc7);});});}exports[_0x126f('0x19')]=function(_0x4f3426){var _0x3e54fe=this;return new Promise(function(_0x452871,_0x61a127){return db[_0x126f('0x1a')][_0x126f('0x1b')](_0x4f3426['body'],{'raw':_0x4f3426[_0x126f('0x1c')]?_0x4f3426[_0x126f('0x1c')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4f3426[_0x126f('0x1c')]?_0x4f3426[_0x126f('0x1c')][_0x126f('0x1d')]||null:null,'attributes':_0x4f3426[_0x126f('0x1c')]?_0x4f3426[_0x126f('0x1c')][_0x126f('0x1e')]||null:null,'limit':_0x4f3426['options']?_0x4f3426['options'][_0x126f('0x1f')]||null:null})[_0x126f('0xe')](function(_0xe233b9){logger[_0x126f('0xf')](_0x126f('0x19'),_0x4f3426);logger[_0x126f('0x12')](_0x126f('0x19'),_0x4f3426,JSON[_0x126f('0x20')](_0xe233b9));_0x452871(_0xe233b9);})['catch'](function(_0x4047bf){logger[_0x126f('0x14')]('UpdateFaxInteraction',_0x4047bf[_0x126f('0x16')],_0x4f3426);_0x61a127(_0x3e54fe[_0x126f('0x14')](0x1f4,_0x4047bf[_0x126f('0x16')]));});});};exports[_0x126f('0x21')]=function(_0x27d2da){return new Promise(function(_0x44fb55,_0xd02adb){return db[_0x126f('0x1a')][_0x126f('0x22')]({'where':_0x27d2da[_0x126f('0x1c')]?_0x27d2da[_0x126f('0x1c')]['where']||null:null})[_0x126f('0xe')](function(_0x33c820){if(_0x33c820){return _0x33c820['addTags'](_0x27d2da[_0x126f('0x23')][_0x126f('0x24')],_[_0x126f('0x25')](_0x27d2da[_0x126f('0x23')],[_0x126f('0x24'),'id'])||{});}})[_0x126f('0x26')](function(_0x562d10){logger[_0x126f('0xf')]('AddTags',_0x27d2da);logger['debug']('AddTags',_0x27d2da,JSON[_0x126f('0x20')](_0x562d10));_0x44fb55(_0x562d10);})[_0x126f('0x18')](function(_0x496e4f){logger[_0x126f('0x14')](_0x126f('0x27'),_0x496e4f['message'],_0x27d2da);_0xd02adb(_this[_0x126f('0x14')](0x1f4,_0x496e4f['message']));});});};