Built motion from commit (unavailable).|2.4.4
[motion2.git] / server / api / faxMessage / faxMessage.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 _0x5b20=['body','options','raw','stringify','update','where','limit','UpdateFaxMessage','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','defaults','redis','localhost','socket.io-emitter','./faxMessage.socket','register','request','then','info','request\x20sent','debug','FaxMessage,\x20%s,\x20%s,\x20%s','error','code','message','FaxMessage,\x20%s,\x20%s','result','catch','CreateFaxMessage','FaxMessage','create'];(function(_0x232b30,_0x9229c6){var _0x5ccc98=function(_0x222dde){while(--_0x222dde){_0x232b30['push'](_0x232b30['shift']());}};_0x5ccc98(++_0x9229c6);}(_0x5b20,0x86));var _0x05b2=function(_0x1cc8fe,_0x105328){_0x1cc8fe=_0x1cc8fe-0x0;var _0x230054=_0x5b20[_0x1cc8fe];return _0x230054;};'use strict';var _=require(_0x05b2('0x0'));var util=require(_0x05b2('0x1'));var moment=require(_0x05b2('0x2'));var BPromise=require(_0x05b2('0x3'));var rs=require(_0x05b2('0x4'));var fs=require('fs');var Redis=require(_0x05b2('0x5'));var db=require(_0x05b2('0x6'))['db'];var utils=require(_0x05b2('0x7'));var logger=require(_0x05b2('0x8'))(_0x05b2('0x9'));var config=require(_0x05b2('0xa'));var jayson=require('jayson/promise');var client=jayson[_0x05b2('0xb')][_0x05b2('0xc')]({'port':0x232a});config['redis']=_[_0x05b2('0xd')](config[_0x05b2('0xe')],{'host':_0x05b2('0xf'),'port':0x18eb});var socket=require(_0x05b2('0x10'))(new Redis(config[_0x05b2('0xe')]));require(_0x05b2('0x11'))[_0x05b2('0x12')](socket);function respondWithRpcPromise(_0x3029eb,_0x2645ff,_0x2b10a5){return new BPromise(function(_0x9a7fd7,_0x2f2e4a){return client[_0x05b2('0x13')](_0x3029eb,_0x2b10a5)[_0x05b2('0x14')](function(_0x155644){logger[_0x05b2('0x15')]('FaxMessage,\x20%s,\x20%s',_0x2645ff,_0x05b2('0x16'));logger[_0x05b2('0x17')](_0x05b2('0x18'),_0x2645ff,_0x05b2('0x16'),JSON['stringify'](_0x155644));if(_0x155644[_0x05b2('0x19')]){if(_0x155644[_0x05b2('0x19')][_0x05b2('0x1a')]===0x1f4){logger['error']('FaxMessage,\x20%s,\x20%s',_0x2645ff,_0x155644[_0x05b2('0x19')][_0x05b2('0x1b')]);return _0x2f2e4a(_0x155644['error']['message']);}logger[_0x05b2('0x19')](_0x05b2('0x1c'),_0x2645ff,_0x155644[_0x05b2('0x19')][_0x05b2('0x1b')]);return _0x9a7fd7(_0x155644[_0x05b2('0x19')][_0x05b2('0x1b')]);}else{logger[_0x05b2('0x15')](_0x05b2('0x1c'),_0x2645ff,_0x05b2('0x16'));_0x9a7fd7(_0x155644[_0x05b2('0x1d')][_0x05b2('0x1b')]);}})[_0x05b2('0x1e')](function(_0x18eed9){logger[_0x05b2('0x19')](_0x05b2('0x1c'),_0x2645ff,_0x18eed9);_0x2f2e4a(_0x18eed9);});});}exports[_0x05b2('0x1f')]=function(_0x5a21a7){var _0x3671aa=this;return new Promise(function(_0x489768,_0xd1a576){return db[_0x05b2('0x20')][_0x05b2('0x21')](_0x5a21a7[_0x05b2('0x22')],{'raw':_0x5a21a7[_0x05b2('0x23')]?_0x5a21a7['options'][_0x05b2('0x24')]===undefined?!![]:![]:!![]})['then'](function(_0x2874e8){logger[_0x05b2('0x15')]('CreateFaxMessage',_0x5a21a7);logger[_0x05b2('0x17')](_0x05b2('0x1f'),_0x5a21a7,JSON[_0x05b2('0x25')](_0x2874e8));_0x489768(_0x2874e8);})[_0x05b2('0x1e')](function(_0xca0d6){logger[_0x05b2('0x19')](_0x05b2('0x1f'),_0xca0d6[_0x05b2('0x1b')],_0x5a21a7);_0xd1a576(_0x3671aa['error'](0x1f4,_0xca0d6['message']));});});};exports['UpdateFaxMessage']=function(_0x171fc2){var _0x4f0b2b=this;return new Promise(function(_0x5d79a2,_0x35b6ba){return db[_0x05b2('0x20')][_0x05b2('0x26')](_0x171fc2[_0x05b2('0x22')],{'raw':_0x171fc2[_0x05b2('0x23')]?_0x171fc2[_0x05b2('0x23')][_0x05b2('0x24')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x171fc2['options']?_0x171fc2[_0x05b2('0x23')][_0x05b2('0x27')]||null:null,'attributes':_0x171fc2[_0x05b2('0x23')]?_0x171fc2[_0x05b2('0x23')]['attributes']||null:null,'limit':_0x171fc2[_0x05b2('0x23')]?_0x171fc2['options'][_0x05b2('0x28')]||null:null})[_0x05b2('0x14')](function(_0x3a4ea9){logger[_0x05b2('0x15')]('UpdateFaxMessage',_0x171fc2);logger[_0x05b2('0x17')]('UpdateFaxMessage',_0x171fc2,JSON[_0x05b2('0x25')](_0x3a4ea9));_0x5d79a2(_0x3a4ea9);})['catch'](function(_0x27f699){logger[_0x05b2('0x19')](_0x05b2('0x29'),_0x27f699['message'],_0x171fc2);_0x35b6ba(_0x4f0b2b['error'](0x1f4,_0x27f699[_0x05b2('0x1b')]));});});};