Built motion from commit (unavailable).|2.5.31
[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 _0x8c3f=['info','CmHopperBlack,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','catch','GetCmHopperBlack','findAll','options','raw','where','attributes','limit','map','include','model','UpdateCmHopperBlack','CmHopperBlack','DestroyCmHopperBlack','destroy','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then'];(function(_0x7c0074,_0x1ffdcf){var _0x13e95b=function(_0x521212){while(--_0x521212){_0x7c0074['push'](_0x7c0074['shift']());}};_0x13e95b(++_0x1ffdcf);}(_0x8c3f,0x189));var _0xf8c3=function(_0x2946aa,_0x4c8fb0){_0x2946aa=_0x2946aa-0x0;var _0x2e8079=_0x8c3f[_0x2946aa];return _0x2e8079;};'use strict';var _=require(_0xf8c3('0x0'));var util=require(_0xf8c3('0x1'));var moment=require(_0xf8c3('0x2'));var BPromise=require(_0xf8c3('0x3'));var rs=require(_0xf8c3('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xf8c3('0x5'))['db'];var utils=require(_0xf8c3('0x6'));var logger=require(_0xf8c3('0x7'))(_0xf8c3('0x8'));var config=require('../../config/environment');var jayson=require(_0xf8c3('0x9'));var client=jayson[_0xf8c3('0xa')][_0xf8c3('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x298695,_0x2456f8,_0x5777b8){return new BPromise(function(_0x2b6c9b,_0x58eb93){return client[_0xf8c3('0xc')](_0x298695,_0x5777b8)[_0xf8c3('0xd')](function(_0x2f49a7){logger[_0xf8c3('0xe')](_0xf8c3('0xf'),_0x2456f8,_0xf8c3('0x10'));logger[_0xf8c3('0x11')]('CmHopperBlack,\x20%s,\x20%s,\x20%s',_0x2456f8,_0xf8c3('0x10'),JSON[_0xf8c3('0x12')](_0x2f49a7));if(_0x2f49a7[_0xf8c3('0x13')]){if(_0x2f49a7[_0xf8c3('0x13')][_0xf8c3('0x14')]===0x1f4){logger['error'](_0xf8c3('0xf'),_0x2456f8,_0x2f49a7[_0xf8c3('0x13')][_0xf8c3('0x15')]);return _0x58eb93(_0x2f49a7[_0xf8c3('0x13')][_0xf8c3('0x15')]);}logger['error'](_0xf8c3('0xf'),_0x2456f8,_0x2f49a7[_0xf8c3('0x13')]['message']);return _0x2b6c9b(_0x2f49a7[_0xf8c3('0x13')][_0xf8c3('0x15')]);}else{logger['info'](_0xf8c3('0xf'),_0x2456f8,'request\x20sent');_0x2b6c9b(_0x2f49a7['result'][_0xf8c3('0x15')]);}})[_0xf8c3('0x16')](function(_0x11dff1){logger[_0xf8c3('0x13')](_0xf8c3('0xf'),_0x2456f8,_0x11dff1);_0x58eb93(_0x11dff1);});});}exports[_0xf8c3('0x17')]=function(_0x10abc4){var _0x23b72d=this;return new Promise(function(_0x448837,_0x34c853){return db['CmHopperBlack'][_0xf8c3('0x18')]({'raw':_0x10abc4[_0xf8c3('0x19')]?_0x10abc4[_0xf8c3('0x19')][_0xf8c3('0x1a')]===undefined?!![]:![]:!![],'where':_0x10abc4[_0xf8c3('0x19')]?_0x10abc4[_0xf8c3('0x19')][_0xf8c3('0x1b')]||null:null,'attributes':_0x10abc4[_0xf8c3('0x19')]?_0x10abc4[_0xf8c3('0x19')][_0xf8c3('0x1c')]||null:null,'limit':_0x10abc4['options']?_0x10abc4[_0xf8c3('0x19')][_0xf8c3('0x1d')]||null:null,'include':_0x10abc4[_0xf8c3('0x19')]?_0x10abc4[_0xf8c3('0x19')]['include']?_[_0xf8c3('0x1e')](_0x10abc4[_0xf8c3('0x19')][_0xf8c3('0x1f')],function(_0x331ae0){return{'model':db[_0x331ae0['model']],'as':_0x331ae0['as'],'attributes':_0x331ae0[_0xf8c3('0x1c')],'include':_0x331ae0['include']?_['map'](_0x331ae0['include'],function(_0x47a840){return{'model':db[_0x47a840['model']],'as':_0x47a840['as'],'attributes':_0x47a840[_0xf8c3('0x1c')],'include':_0x47a840[_0xf8c3('0x1f')]?_['map'](_0x47a840[_0xf8c3('0x1f')],function(_0x44b85f){return{'model':db[_0x44b85f[_0xf8c3('0x20')]],'as':_0x44b85f['as'],'attributes':_0x44b85f[_0xf8c3('0x1c')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x4741db){logger[_0xf8c3('0xe')]('GetCmHopperBlack',_0x10abc4);logger[_0xf8c3('0x11')](_0xf8c3('0x17'),_0x10abc4,JSON[_0xf8c3('0x12')](_0x4741db));_0x448837(_0x4741db);})[_0xf8c3('0x16')](function(_0x400b6a){logger[_0xf8c3('0x13')](_0xf8c3('0x17'),_0x400b6a[_0xf8c3('0x15')],_0x10abc4);_0x34c853(_0x23b72d[_0xf8c3('0x13')](0x1f4,_0x400b6a[_0xf8c3('0x15')]));});});};exports[_0xf8c3('0x21')]=function(_0x28334e){var _0x4efbb4=this;return new Promise(function(_0x1eba0f,_0x3cc345){return db[_0xf8c3('0x22')]['update'](_0x28334e['body'],{'raw':_0x28334e[_0xf8c3('0x19')]?_0x28334e[_0xf8c3('0x19')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x28334e[_0xf8c3('0x19')]?_0x28334e[_0xf8c3('0x19')][_0xf8c3('0x1b')]||null:null,'attributes':_0x28334e['options']?_0x28334e[_0xf8c3('0x19')][_0xf8c3('0x1c')]||null:null,'limit':_0x28334e[_0xf8c3('0x19')]?_0x28334e[_0xf8c3('0x19')]['limit']||null:null})['then'](function(_0x1c2fa9){logger['info'](_0xf8c3('0x21'),_0x28334e);logger[_0xf8c3('0x11')](_0xf8c3('0x21'),_0x28334e,JSON[_0xf8c3('0x12')](_0x1c2fa9));_0x1eba0f(_0x1c2fa9);})[_0xf8c3('0x16')](function(_0x120adc){logger['error']('UpdateCmHopperBlack',_0x120adc[_0xf8c3('0x15')],_0x28334e);_0x3cc345(_0x4efbb4['error'](0x1f4,_0x120adc[_0xf8c3('0x15')]));});});};exports[_0xf8c3('0x23')]=function(_0x2fb513){var _0x2d8902=this;return new Promise(function(_0x452a70,_0x590734){return db['CmHopperBlack'][_0xf8c3('0x24')]({'where':_0x2fb513[_0xf8c3('0x19')]?_0x2fb513[_0xf8c3('0x19')][_0xf8c3('0x1b')]||null:null})[_0xf8c3('0xd')](function(_0x50bbf5){logger[_0xf8c3('0xe')](_0xf8c3('0x23'),_0x2fb513);logger['debug'](_0xf8c3('0x23'),_0x2fb513,JSON[_0xf8c3('0x12')](_0x50bbf5));_0x452a70(_0x50bbf5);})[_0xf8c3('0x16')](function(_0x386ad3){logger['error'](_0xf8c3('0x23'),_0x386ad3['message'],_0x2fb513);_0x590734(_0x2d8902[_0xf8c3('0x13')](0x1f4,_0x386ad3[_0xf8c3('0x15')]));});});};