Built motion from commit (unavailable).|2.6.0
[motion2.git] / server / api / cmHopperBlack / cmHopperBlack.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 _0xc88c=['result','catch','GetCmHopperBlack','CmHopperBlack','options','raw','where','attributes','limit','map','model','include','update','body','UpdateCmHopperBlack','DestroyCmHopperBlack','destroy','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','then','info','CmHopperBlack,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message'];(function(_0x11bb10,_0x55386b){var _0x911613=function(_0x266e81){while(--_0x266e81){_0x11bb10['push'](_0x11bb10['shift']());}};_0x911613(++_0x55386b);}(_0xc88c,0x86));var _0xcc88=function(_0x5bf520,_0x832825){_0x5bf520=_0x5bf520-0x0;var _0x24910c=_0xc88c[_0x5bf520];return _0x24910c;};'use strict';var _=require(_0xcc88('0x0'));var util=require(_0xcc88('0x1'));var moment=require(_0xcc88('0x2'));var BPromise=require(_0xcc88('0x3'));var rs=require(_0xcc88('0x4'));var fs=require('fs');var Redis=require(_0xcc88('0x5'));var db=require(_0xcc88('0x6'))['db'];var utils=require(_0xcc88('0x7'));var logger=require(_0xcc88('0x8'))('rpc');var config=require(_0xcc88('0x9'));var jayson=require(_0xcc88('0xa'));var client=jayson[_0xcc88('0xb')][_0xcc88('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x20c86a,_0x9fe67,_0x58e097){return new BPromise(function(_0x52bbfb,_0x30c3c7){return client['request'](_0x20c86a,_0x58e097)[_0xcc88('0xd')](function(_0x3a68ce){logger[_0xcc88('0xe')](_0xcc88('0xf'),_0x9fe67,'request\x20sent');logger[_0xcc88('0x10')]('CmHopperBlack,\x20%s,\x20%s,\x20%s',_0x9fe67,_0xcc88('0x11'),JSON[_0xcc88('0x12')](_0x3a68ce));if(_0x3a68ce[_0xcc88('0x13')]){if(_0x3a68ce[_0xcc88('0x13')][_0xcc88('0x14')]===0x1f4){logger[_0xcc88('0x13')](_0xcc88('0xf'),_0x9fe67,_0x3a68ce[_0xcc88('0x13')][_0xcc88('0x15')]);return _0x30c3c7(_0x3a68ce[_0xcc88('0x13')]['message']);}logger[_0xcc88('0x13')](_0xcc88('0xf'),_0x9fe67,_0x3a68ce[_0xcc88('0x13')][_0xcc88('0x15')]);return _0x52bbfb(_0x3a68ce[_0xcc88('0x13')][_0xcc88('0x15')]);}else{logger[_0xcc88('0xe')](_0xcc88('0xf'),_0x9fe67,_0xcc88('0x11'));_0x52bbfb(_0x3a68ce[_0xcc88('0x16')][_0xcc88('0x15')]);}})[_0xcc88('0x17')](function(_0x273e1e){logger['error'](_0xcc88('0xf'),_0x9fe67,_0x273e1e);_0x30c3c7(_0x273e1e);});});}exports[_0xcc88('0x18')]=function(_0x11063a){var _0x1224b0=this;return new Promise(function(_0x251e3f,_0x5dd076){return db[_0xcc88('0x19')]['findAll']({'raw':_0x11063a[_0xcc88('0x1a')]?_0x11063a[_0xcc88('0x1a')][_0xcc88('0x1b')]===undefined?!![]:![]:!![],'where':_0x11063a['options']?_0x11063a[_0xcc88('0x1a')][_0xcc88('0x1c')]||null:null,'attributes':_0x11063a['options']?_0x11063a['options'][_0xcc88('0x1d')]||null:null,'limit':_0x11063a[_0xcc88('0x1a')]?_0x11063a[_0xcc88('0x1a')][_0xcc88('0x1e')]||null:null,'include':_0x11063a[_0xcc88('0x1a')]?_0x11063a[_0xcc88('0x1a')]['include']?_[_0xcc88('0x1f')](_0x11063a[_0xcc88('0x1a')]['include'],function(_0x502a2a){return{'model':db[_0x502a2a[_0xcc88('0x20')]],'as':_0x502a2a['as'],'attributes':_0x502a2a['attributes'],'include':_0x502a2a[_0xcc88('0x21')]?_[_0xcc88('0x1f')](_0x502a2a['include'],function(_0x33d6ce){return{'model':db[_0x33d6ce['model']],'as':_0x33d6ce['as'],'attributes':_0x33d6ce[_0xcc88('0x1d')],'include':_0x33d6ce['include']?_[_0xcc88('0x1f')](_0x33d6ce[_0xcc88('0x21')],function(_0x359da7){return{'model':db[_0x359da7[_0xcc88('0x20')]],'as':_0x359da7['as'],'attributes':_0x359da7[_0xcc88('0x1d')]};}):[]};}):[]};}):[]:[]})[_0xcc88('0xd')](function(_0x1b8616){logger[_0xcc88('0xe')](_0xcc88('0x18'),_0x11063a);logger['debug'](_0xcc88('0x18'),_0x11063a,JSON[_0xcc88('0x12')](_0x1b8616));_0x251e3f(_0x1b8616);})[_0xcc88('0x17')](function(_0x9d25c2){logger['error'](_0xcc88('0x18'),_0x9d25c2[_0xcc88('0x15')],_0x11063a);_0x5dd076(_0x1224b0[_0xcc88('0x13')](0x1f4,_0x9d25c2[_0xcc88('0x15')]));});});};exports['UpdateCmHopperBlack']=function(_0xcef9d2){var _0x464614=this;return new Promise(function(_0xffd8f,_0x4589c5){return db[_0xcc88('0x19')][_0xcc88('0x22')](_0xcef9d2[_0xcc88('0x23')],{'raw':_0xcef9d2[_0xcc88('0x1a')]?_0xcef9d2[_0xcc88('0x1a')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xcef9d2[_0xcc88('0x1a')]?_0xcef9d2[_0xcc88('0x1a')][_0xcc88('0x1c')]||null:null,'attributes':_0xcef9d2[_0xcc88('0x1a')]?_0xcef9d2[_0xcc88('0x1a')][_0xcc88('0x1d')]||null:null,'limit':_0xcef9d2['options']?_0xcef9d2[_0xcc88('0x1a')][_0xcc88('0x1e')]||null:null})[_0xcc88('0xd')](function(_0x40763f){logger[_0xcc88('0xe')](_0xcc88('0x24'),_0xcef9d2);logger['debug'](_0xcc88('0x24'),_0xcef9d2,JSON[_0xcc88('0x12')](_0x40763f));_0xffd8f(_0x40763f);})[_0xcc88('0x17')](function(_0xdcb565){logger[_0xcc88('0x13')](_0xcc88('0x24'),_0xdcb565[_0xcc88('0x15')],_0xcef9d2);_0x4589c5(_0x464614[_0xcc88('0x13')](0x1f4,_0xdcb565['message']));});});};exports[_0xcc88('0x25')]=function(_0x113533){var _0x5c774a=this;return new Promise(function(_0x175914,_0x491062){return db[_0xcc88('0x19')][_0xcc88('0x26')]({'where':_0x113533[_0xcc88('0x1a')]?_0x113533[_0xcc88('0x1a')][_0xcc88('0x1c')]||null:null})[_0xcc88('0xd')](function(_0x2818d5){logger[_0xcc88('0xe')](_0xcc88('0x25'),_0x113533);logger[_0xcc88('0x10')](_0xcc88('0x25'),_0x113533,JSON[_0xcc88('0x12')](_0x2818d5));_0x175914(_0x2818d5);})[_0xcc88('0x17')](function(_0x56ef1e){logger[_0xcc88('0x13')](_0xcc88('0x25'),_0x56ef1e[_0xcc88('0x15')],_0x113533);_0x491062(_0x5c774a['error'](0x1f4,_0x56ef1e['message']));});});};