Built motion from commit f8768ebe.|2.6.15
[motion2.git] / server / api / openchannelQueue / openchannelQueue.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 _0x6ffa=['localhost','socket.io-emitter','./openchannelQueue.socket','register','info','OpenchannelQueue,\x20%s,\x20%s','request\x20sent','debug','OpenchannelQueue,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','GetOpenchannelQueue','OpenchannelQueue','findAll','options','raw','attributes','map','model','include','ShowOpenchannelQueue','find','where','then','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','defaults'];(function(_0x26dfc5,_0x138166){var _0x566350=function(_0x28b148){while(--_0x28b148){_0x26dfc5['push'](_0x26dfc5['shift']());}};_0x566350(++_0x138166);}(_0x6ffa,0x117));var _0xa6ff=function(_0x211941,_0x5871a6){_0x211941=_0x211941-0x0;var _0x506efd=_0x6ffa[_0x211941];return _0x506efd;};'use strict';var _=require(_0xa6ff('0x0'));var util=require(_0xa6ff('0x1'));var moment=require(_0xa6ff('0x2'));var BPromise=require(_0xa6ff('0x3'));var rs=require(_0xa6ff('0x4'));var fs=require('fs');var Redis=require(_0xa6ff('0x5'));var db=require(_0xa6ff('0x6'))['db'];var utils=require(_0xa6ff('0x7'));var logger=require(_0xa6ff('0x8'))(_0xa6ff('0x9'));var config=require(_0xa6ff('0xa'));var jayson=require(_0xa6ff('0xb'));var client=jayson['client'][_0xa6ff('0xc')]({'port':0x232a});config[_0xa6ff('0xd')]=_[_0xa6ff('0xe')](config[_0xa6ff('0xd')],{'host':_0xa6ff('0xf'),'port':0x18eb});var socket=require(_0xa6ff('0x10'))(new Redis(config[_0xa6ff('0xd')]));require(_0xa6ff('0x11'))[_0xa6ff('0x12')](socket);function respondWithRpcPromise(_0x2b9c86,_0x490307,_0x48fa22){return new BPromise(function(_0x31ed45,_0x37714b){return client['request'](_0x2b9c86,_0x48fa22)['then'](function(_0x285ffd){logger[_0xa6ff('0x13')](_0xa6ff('0x14'),_0x490307,_0xa6ff('0x15'));logger[_0xa6ff('0x16')](_0xa6ff('0x17'),_0x490307,'request\x20sent',JSON[_0xa6ff('0x18')](_0x285ffd));if(_0x285ffd[_0xa6ff('0x19')]){if(_0x285ffd[_0xa6ff('0x19')]['code']===0x1f4){logger[_0xa6ff('0x19')](_0xa6ff('0x14'),_0x490307,_0x285ffd['error']['message']);return _0x37714b(_0x285ffd[_0xa6ff('0x19')][_0xa6ff('0x1a')]);}logger[_0xa6ff('0x19')](_0xa6ff('0x14'),_0x490307,_0x285ffd[_0xa6ff('0x19')]['message']);return _0x31ed45(_0x285ffd[_0xa6ff('0x19')][_0xa6ff('0x1a')]);}else{logger[_0xa6ff('0x13')](_0xa6ff('0x14'),_0x490307,'request\x20sent');_0x31ed45(_0x285ffd[_0xa6ff('0x1b')][_0xa6ff('0x1a')]);}})[_0xa6ff('0x1c')](function(_0x267c42){logger['error'](_0xa6ff('0x14'),_0x490307,_0x267c42);_0x37714b(_0x267c42);});});}exports[_0xa6ff('0x1d')]=function(_0x1c9ded){var _0x2d2432=this;return new Promise(function(_0x458938,_0x27b4b8){return db[_0xa6ff('0x1e')][_0xa6ff('0x1f')]({'raw':_0x1c9ded[_0xa6ff('0x20')]?_0x1c9ded[_0xa6ff('0x20')][_0xa6ff('0x21')]===undefined?!![]:![]:!![],'where':_0x1c9ded[_0xa6ff('0x20')]?_0x1c9ded['options']['where']||null:null,'attributes':_0x1c9ded['options']?_0x1c9ded[_0xa6ff('0x20')][_0xa6ff('0x22')]||null:null,'limit':_0x1c9ded['options']?_0x1c9ded['options']['limit']||null:null,'include':_0x1c9ded[_0xa6ff('0x20')]?_0x1c9ded[_0xa6ff('0x20')]['include']?_[_0xa6ff('0x23')](_0x1c9ded[_0xa6ff('0x20')]['include'],function(_0x25d778){return{'model':db[_0x25d778[_0xa6ff('0x24')]],'as':_0x25d778['as'],'attributes':_0x25d778[_0xa6ff('0x22')],'include':_0x25d778['include']?_[_0xa6ff('0x23')](_0x25d778[_0xa6ff('0x25')],function(_0x430115){return{'model':db[_0x430115[_0xa6ff('0x24')]],'as':_0x430115['as'],'attributes':_0x430115[_0xa6ff('0x22')],'include':_0x430115['include']?_[_0xa6ff('0x23')](_0x430115[_0xa6ff('0x25')],function(_0x56eb2c){return{'model':db[_0x56eb2c[_0xa6ff('0x24')]],'as':_0x56eb2c['as'],'attributes':_0x56eb2c[_0xa6ff('0x22')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x5c1964){logger['info'](_0xa6ff('0x1d'),_0x1c9ded);logger['debug'](_0xa6ff('0x1d'),_0x1c9ded,JSON['stringify'](_0x5c1964));_0x458938(_0x5c1964);})[_0xa6ff('0x1c')](function(_0x313dd3){logger['error'](_0xa6ff('0x1d'),_0x313dd3[_0xa6ff('0x1a')],_0x1c9ded);_0x27b4b8(_0x2d2432[_0xa6ff('0x19')](0x1f4,_0x313dd3[_0xa6ff('0x1a')]));});});};exports[_0xa6ff('0x26')]=function(_0x4b67a2){var _0xabcf6b=this;return new Promise(function(_0x30ba78,_0x1f3f66){return db[_0xa6ff('0x1e')][_0xa6ff('0x27')]({'raw':_0x4b67a2['options']?_0x4b67a2[_0xa6ff('0x20')][_0xa6ff('0x21')]===undefined?!![]:![]:!![],'where':_0x4b67a2[_0xa6ff('0x20')]?_0x4b67a2['options'][_0xa6ff('0x28')]||null:null,'attributes':_0x4b67a2[_0xa6ff('0x20')]?_0x4b67a2[_0xa6ff('0x20')][_0xa6ff('0x22')]||null:null,'include':_0x4b67a2[_0xa6ff('0x20')]?_0x4b67a2[_0xa6ff('0x20')][_0xa6ff('0x25')]?_[_0xa6ff('0x23')](_0x4b67a2[_0xa6ff('0x20')][_0xa6ff('0x25')],function(_0x3f1566){return{'model':db[_0x3f1566['model']],'as':_0x3f1566['as'],'attributes':_0x3f1566[_0xa6ff('0x22')],'include':_0x3f1566[_0xa6ff('0x25')]?_[_0xa6ff('0x23')](_0x3f1566[_0xa6ff('0x25')],function(_0x2e41ee){return{'model':db[_0x2e41ee['model']],'as':_0x2e41ee['as'],'attributes':_0x2e41ee[_0xa6ff('0x22')],'include':_0x2e41ee[_0xa6ff('0x25')]?_['map'](_0x2e41ee[_0xa6ff('0x25')],function(_0x2ce7c7){return{'model':db[_0x2ce7c7[_0xa6ff('0x24')]],'as':_0x2ce7c7['as'],'attributes':_0x2ce7c7[_0xa6ff('0x22')]};}):[]};}):[]};}):[]:[]})[_0xa6ff('0x29')](function(_0x1a3c6c){logger[_0xa6ff('0x13')]('ShowOpenchannelQueue',_0x4b67a2);logger[_0xa6ff('0x16')](_0xa6ff('0x26'),_0x4b67a2,JSON[_0xa6ff('0x18')](_0x1a3c6c));_0x30ba78(_0x1a3c6c);})[_0xa6ff('0x1c')](function(_0x1784de){logger[_0xa6ff('0x19')](_0xa6ff('0x26'),_0x1784de[_0xa6ff('0x1a')],_0x4b67a2);_0x1f3f66(_0xabcf6b[_0xa6ff('0x19')](0x1f4,_0x1784de[_0xa6ff('0x1a')]));});});};