Built motion from commit (unavailable).|2.4.21
[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 _0x2e75=['request\x20sent','OpenchannelQueue,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','catch','GetOpenchannelQueue','OpenchannelQueue','findAll','options','attributes','limit','include','map','model','debug','ShowOpenchannelQueue','find','raw','where','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','defaults','redis','localhost','socket.io-emitter','./openchannelQueue.socket','register','request','then','OpenchannelQueue,\x20%s,\x20%s'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x2e75,0x70));var _0x52e7=function(_0x2e6243,_0x5c4c96){_0x2e6243=_0x2e6243-0x0;var _0x11f84f=_0x2e75[_0x2e6243];return _0x11f84f;};'use strict';var _=require(_0x52e7('0x0'));var util=require(_0x52e7('0x1'));var moment=require(_0x52e7('0x2'));var BPromise=require(_0x52e7('0x3'));var rs=require(_0x52e7('0x4'));var fs=require('fs');var Redis=require(_0x52e7('0x5'));var db=require(_0x52e7('0x6'))['db'];var utils=require(_0x52e7('0x7'));var logger=require(_0x52e7('0x8'))(_0x52e7('0x9'));var config=require(_0x52e7('0xa'));var jayson=require(_0x52e7('0xb'));var client=jayson[_0x52e7('0xc')][_0x52e7('0xd')]({'port':0x232a});config['redis']=_[_0x52e7('0xe')](config[_0x52e7('0xf')],{'host':_0x52e7('0x10'),'port':0x18eb});var socket=require(_0x52e7('0x11'))(new Redis(config[_0x52e7('0xf')]));require(_0x52e7('0x12'))[_0x52e7('0x13')](socket);function respondWithRpcPromise(_0xee59f3,_0x2b5b96,_0x4c60ee){return new BPromise(function(_0x182b79,_0x28f49f){return client[_0x52e7('0x14')](_0xee59f3,_0x4c60ee)[_0x52e7('0x15')](function(_0x2ef676){logger['info'](_0x52e7('0x16'),_0x2b5b96,_0x52e7('0x17'));logger['debug'](_0x52e7('0x18'),_0x2b5b96,_0x52e7('0x17'),JSON[_0x52e7('0x19')](_0x2ef676));if(_0x2ef676[_0x52e7('0x1a')]){if(_0x2ef676['error']['code']===0x1f4){logger[_0x52e7('0x1a')](_0x52e7('0x16'),_0x2b5b96,_0x2ef676[_0x52e7('0x1a')]['message']);return _0x28f49f(_0x2ef676[_0x52e7('0x1a')]['message']);}logger[_0x52e7('0x1a')]('OpenchannelQueue,\x20%s,\x20%s',_0x2b5b96,_0x2ef676[_0x52e7('0x1a')][_0x52e7('0x1b')]);return _0x182b79(_0x2ef676['error'][_0x52e7('0x1b')]);}else{logger[_0x52e7('0x1c')]('OpenchannelQueue,\x20%s,\x20%s',_0x2b5b96,_0x52e7('0x17'));_0x182b79(_0x2ef676[_0x52e7('0x1d')][_0x52e7('0x1b')]);}})[_0x52e7('0x1e')](function(_0x2fab9e){logger[_0x52e7('0x1a')](_0x52e7('0x16'),_0x2b5b96,_0x2fab9e);_0x28f49f(_0x2fab9e);});});}exports[_0x52e7('0x1f')]=function(_0x7bf275){var _0x13f92d=this;return new Promise(function(_0x44f854,_0x2ec558){return db[_0x52e7('0x20')][_0x52e7('0x21')]({'raw':_0x7bf275[_0x52e7('0x22')]?_0x7bf275[_0x52e7('0x22')]['raw']===undefined?!![]:![]:!![],'where':_0x7bf275[_0x52e7('0x22')]?_0x7bf275[_0x52e7('0x22')]['where']||null:null,'attributes':_0x7bf275[_0x52e7('0x22')]?_0x7bf275[_0x52e7('0x22')][_0x52e7('0x23')]||null:null,'limit':_0x7bf275[_0x52e7('0x22')]?_0x7bf275['options'][_0x52e7('0x24')]||null:null,'include':_0x7bf275[_0x52e7('0x22')]?_0x7bf275[_0x52e7('0x22')][_0x52e7('0x25')]?_[_0x52e7('0x26')](_0x7bf275[_0x52e7('0x22')][_0x52e7('0x25')],function(_0x5dda23){return{'model':db[_0x5dda23[_0x52e7('0x27')]],'as':_0x5dda23['as'],'attributes':_0x5dda23['attributes'],'include':_0x5dda23[_0x52e7('0x25')]?_[_0x52e7('0x26')](_0x5dda23[_0x52e7('0x25')],function(_0x30e2ea){return{'model':db[_0x30e2ea[_0x52e7('0x27')]],'as':_0x30e2ea['as'],'attributes':_0x30e2ea[_0x52e7('0x23')],'include':_0x30e2ea[_0x52e7('0x25')]?_['map'](_0x30e2ea[_0x52e7('0x25')],function(_0x107b01){return{'model':db[_0x107b01['model']],'as':_0x107b01['as'],'attributes':_0x107b01[_0x52e7('0x23')]};}):[]};}):[]};}):[]:[]})[_0x52e7('0x15')](function(_0x249e87){logger[_0x52e7('0x1c')](_0x52e7('0x1f'),_0x7bf275);logger[_0x52e7('0x28')](_0x52e7('0x1f'),_0x7bf275,JSON['stringify'](_0x249e87));_0x44f854(_0x249e87);})[_0x52e7('0x1e')](function(_0x3e036a){logger[_0x52e7('0x1a')](_0x52e7('0x1f'),_0x3e036a['message'],_0x7bf275);_0x2ec558(_0x13f92d[_0x52e7('0x1a')](0x1f4,_0x3e036a[_0x52e7('0x1b')]));});});};exports[_0x52e7('0x29')]=function(_0x5a8b5c){var _0x4db105=this;return new Promise(function(_0x566018,_0x5d505b){return db['OpenchannelQueue'][_0x52e7('0x2a')]({'raw':_0x5a8b5c[_0x52e7('0x22')]?_0x5a8b5c[_0x52e7('0x22')][_0x52e7('0x2b')]===undefined?!![]:![]:!![],'where':_0x5a8b5c[_0x52e7('0x22')]?_0x5a8b5c[_0x52e7('0x22')][_0x52e7('0x2c')]||null:null,'attributes':_0x5a8b5c[_0x52e7('0x22')]?_0x5a8b5c[_0x52e7('0x22')]['attributes']||null:null,'include':_0x5a8b5c[_0x52e7('0x22')]?_0x5a8b5c[_0x52e7('0x22')]['include']?_[_0x52e7('0x26')](_0x5a8b5c[_0x52e7('0x22')][_0x52e7('0x25')],function(_0x5575c7){return{'model':db[_0x5575c7[_0x52e7('0x27')]],'as':_0x5575c7['as'],'attributes':_0x5575c7['attributes'],'include':_0x5575c7['include']?_['map'](_0x5575c7['include'],function(_0x266201){return{'model':db[_0x266201['model']],'as':_0x266201['as'],'attributes':_0x266201[_0x52e7('0x23')],'include':_0x266201['include']?_[_0x52e7('0x26')](_0x266201['include'],function(_0x3bc89b){return{'model':db[_0x3bc89b[_0x52e7('0x27')]],'as':_0x3bc89b['as'],'attributes':_0x3bc89b['attributes']};}):[]};}):[]};}):[]:[]})[_0x52e7('0x15')](function(_0x7df000){logger['info'](_0x52e7('0x29'),_0x5a8b5c);logger[_0x52e7('0x28')](_0x52e7('0x29'),_0x5a8b5c,JSON[_0x52e7('0x19')](_0x7df000));_0x566018(_0x7df000);})[_0x52e7('0x1e')](function(_0x31328a){logger[_0x52e7('0x1a')]('ShowOpenchannelQueue',_0x31328a[_0x52e7('0x1b')],_0x5a8b5c);_0x5d505b(_0x4db105[_0x52e7('0x1a')](0x1f4,_0x31328a[_0x52e7('0x1b')]));});});};