Built motion from commit 511216ff.|2.6.34
[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 _0xf354=['addTags','ids','spread','AddTags','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./faxInteraction.socket','request','then','info','FaxInteraction,\x20%s,\x20%s','request\x20sent','debug','FaxInteraction,\x20%s,\x20%s,\x20%s','stringify','error','message','result','UpdateFaxInteraction','FaxInteraction','update','body','options','raw','where','attributes','limit','catch','AddTagsToFaxInteraction','find'];(function(_0x3dadb9,_0xd629da){var _0x382622=function(_0x59ec01){while(--_0x59ec01){_0x3dadb9['push'](_0x3dadb9['shift']());}};_0x382622(++_0xd629da);}(_0xf354,0x1bc));var _0x4f35=function(_0x161cdb,_0x446cc5){_0x161cdb=_0x161cdb-0x0;var _0x3bb0ef=_0xf354[_0x161cdb];return _0x3bb0ef;};'use strict';var _=require(_0x4f35('0x0'));var util=require(_0x4f35('0x1'));var moment=require(_0x4f35('0x2'));var BPromise=require(_0x4f35('0x3'));var rs=require(_0x4f35('0x4'));var fs=require('fs');var Redis=require(_0x4f35('0x5'));var db=require(_0x4f35('0x6'))['db'];var utils=require(_0x4f35('0x7'));var logger=require(_0x4f35('0x8'))('rpc');var config=require('../../config/environment');var jayson=require(_0x4f35('0x9'));var client=jayson[_0x4f35('0xa')][_0x4f35('0xb')]({'port':0x232a});config[_0x4f35('0xc')]=_[_0x4f35('0xd')](config[_0x4f35('0xc')],{'host':_0x4f35('0xe'),'port':0x18eb});var socket=require(_0x4f35('0xf'))(new Redis(config[_0x4f35('0xc')]));require(_0x4f35('0x10'))['register'](socket);function respondWithRpcPromise(_0x1a4755,_0x5079fe,_0x42bcb9){return new BPromise(function(_0x39b93e,_0x5ed9b2){return client[_0x4f35('0x11')](_0x1a4755,_0x42bcb9)[_0x4f35('0x12')](function(_0x39fc6c){logger[_0x4f35('0x13')](_0x4f35('0x14'),_0x5079fe,_0x4f35('0x15'));logger[_0x4f35('0x16')](_0x4f35('0x17'),_0x5079fe,_0x4f35('0x15'),JSON[_0x4f35('0x18')](_0x39fc6c));if(_0x39fc6c[_0x4f35('0x19')]){if(_0x39fc6c[_0x4f35('0x19')]['code']===0x1f4){logger[_0x4f35('0x19')]('FaxInteraction,\x20%s,\x20%s',_0x5079fe,_0x39fc6c[_0x4f35('0x19')][_0x4f35('0x1a')]);return _0x5ed9b2(_0x39fc6c[_0x4f35('0x19')][_0x4f35('0x1a')]);}logger[_0x4f35('0x19')]('FaxInteraction,\x20%s,\x20%s',_0x5079fe,_0x39fc6c[_0x4f35('0x19')][_0x4f35('0x1a')]);return _0x39b93e(_0x39fc6c[_0x4f35('0x19')][_0x4f35('0x1a')]);}else{logger[_0x4f35('0x13')](_0x4f35('0x14'),_0x5079fe,_0x4f35('0x15'));_0x39b93e(_0x39fc6c[_0x4f35('0x1b')][_0x4f35('0x1a')]);}})['catch'](function(_0x3d9f83){logger['error'](_0x4f35('0x14'),_0x5079fe,_0x3d9f83);_0x5ed9b2(_0x3d9f83);});});}exports[_0x4f35('0x1c')]=function(_0x36d539){var _0x492e9c=this;return new Promise(function(_0x25a042,_0x2ddb4c){return db[_0x4f35('0x1d')][_0x4f35('0x1e')](_0x36d539[_0x4f35('0x1f')],{'raw':_0x36d539[_0x4f35('0x20')]?_0x36d539[_0x4f35('0x20')][_0x4f35('0x21')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x36d539[_0x4f35('0x20')]?_0x36d539['options'][_0x4f35('0x22')]||null:null,'attributes':_0x36d539[_0x4f35('0x20')]?_0x36d539[_0x4f35('0x20')][_0x4f35('0x23')]||null:null,'limit':_0x36d539[_0x4f35('0x20')]?_0x36d539[_0x4f35('0x20')][_0x4f35('0x24')]||null:null})[_0x4f35('0x12')](function(_0x1f6097){logger[_0x4f35('0x13')]('UpdateFaxInteraction',_0x36d539);logger[_0x4f35('0x16')](_0x4f35('0x1c'),_0x36d539,JSON['stringify'](_0x1f6097));_0x25a042(_0x1f6097);})[_0x4f35('0x25')](function(_0x1082ba){logger[_0x4f35('0x19')](_0x4f35('0x1c'),_0x1082ba[_0x4f35('0x1a')],_0x36d539);_0x2ddb4c(_0x492e9c[_0x4f35('0x19')](0x1f4,_0x1082ba[_0x4f35('0x1a')]));});});};exports[_0x4f35('0x26')]=function(_0x26e896){return new Promise(function(_0x37b7d2,_0xbed8cb){return db[_0x4f35('0x1d')][_0x4f35('0x27')]({'where':_0x26e896[_0x4f35('0x20')]?_0x26e896[_0x4f35('0x20')]['where']||null:null})[_0x4f35('0x12')](function(_0x4841d2){if(_0x4841d2){return _0x4841d2[_0x4f35('0x28')](_0x26e896[_0x4f35('0x1f')][_0x4f35('0x29')],_['omit'](_0x26e896[_0x4f35('0x1f')],[_0x4f35('0x29'),'id'])||{});}})[_0x4f35('0x2a')](function(_0x2c5b30){logger['info'](_0x4f35('0x2b'),_0x26e896);logger['debug'](_0x4f35('0x2b'),_0x26e896,JSON['stringify'](_0x2c5b30));_0x37b7d2(_0x2c5b30);})[_0x4f35('0x25')](function(_0x317a14){logger[_0x4f35('0x19')](_0x4f35('0x2b'),_0x317a14[_0x4f35('0x1a')],_0x26e896);_0xbed8cb(_this[_0x4f35('0x19')](0x1f4,_0x317a14[_0x4f35('0x1a')]));});});};