Built motion from commit (unavailable).|2.5.31
[motion2.git] / server / api / setting / setting.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 _0x878f=['options','raw','where','attributes','include','map','model','lodash','util','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','request','info','Setting,\x20%s,\x20%s','request\x20sent','debug','Setting,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','ShowSetting','Setting','find'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x878f,0xa2));var _0xf878=function(_0x2315c5,_0x40de36){_0x2315c5=_0x2315c5-0x0;var _0x264751=_0x878f[_0x2315c5];return _0x264751;};'use strict';var _=require(_0xf878('0x0'));var util=require(_0xf878('0x1'));var moment=require(_0xf878('0x2'));var BPromise=require(_0xf878('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xf878('0x4'))['db'];var utils=require(_0xf878('0x5'));var logger=require(_0xf878('0x6'))(_0xf878('0x7'));var config=require(_0xf878('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xf878('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x482579,_0x62d55f,_0x4c49d7){return new BPromise(function(_0x1107fc,_0x479aac){return client[_0xf878('0xa')](_0x482579,_0x4c49d7)['then'](function(_0x46b8e0){logger[_0xf878('0xb')](_0xf878('0xc'),_0x62d55f,_0xf878('0xd'));logger[_0xf878('0xe')](_0xf878('0xf'),_0x62d55f,'request\x20sent',JSON[_0xf878('0x10')](_0x46b8e0));if(_0x46b8e0[_0xf878('0x11')]){if(_0x46b8e0['error'][_0xf878('0x12')]===0x1f4){logger['error'](_0xf878('0xc'),_0x62d55f,_0x46b8e0['error']['message']);return _0x479aac(_0x46b8e0[_0xf878('0x11')][_0xf878('0x13')]);}logger['error'](_0xf878('0xc'),_0x62d55f,_0x46b8e0[_0xf878('0x11')]['message']);return _0x1107fc(_0x46b8e0[_0xf878('0x11')][_0xf878('0x13')]);}else{logger[_0xf878('0xb')](_0xf878('0xc'),_0x62d55f,_0xf878('0xd'));_0x1107fc(_0x46b8e0['result'][_0xf878('0x13')]);}})[_0xf878('0x14')](function(_0x1dfc14){logger[_0xf878('0x11')]('Setting,\x20%s,\x20%s',_0x62d55f,_0x1dfc14);_0x479aac(_0x1dfc14);});});}exports[_0xf878('0x15')]=function(_0x1c559b){var _0x15cbfb=this;return new Promise(function(_0x5579d2,_0x8b5519){return db[_0xf878('0x16')][_0xf878('0x17')]({'raw':_0x1c559b[_0xf878('0x18')]?_0x1c559b[_0xf878('0x18')][_0xf878('0x19')]===undefined?!![]:![]:!![],'where':_0x1c559b[_0xf878('0x18')]?_0x1c559b[_0xf878('0x18')][_0xf878('0x1a')]||null:null,'attributes':_0x1c559b[_0xf878('0x18')]?_0x1c559b[_0xf878('0x18')][_0xf878('0x1b')]||null:null,'include':_0x1c559b[_0xf878('0x18')]?_0x1c559b[_0xf878('0x18')][_0xf878('0x1c')]?_[_0xf878('0x1d')](_0x1c559b[_0xf878('0x18')][_0xf878('0x1c')],function(_0x10d3d1){return{'model':db[_0x10d3d1[_0xf878('0x1e')]],'as':_0x10d3d1['as'],'attributes':_0x10d3d1[_0xf878('0x1b')],'include':_0x10d3d1[_0xf878('0x1c')]?_[_0xf878('0x1d')](_0x10d3d1[_0xf878('0x1c')],function(_0x2c1ce2){return{'model':db[_0x2c1ce2[_0xf878('0x1e')]],'as':_0x2c1ce2['as'],'attributes':_0x2c1ce2[_0xf878('0x1b')],'include':_0x2c1ce2[_0xf878('0x1c')]?_[_0xf878('0x1d')](_0x2c1ce2[_0xf878('0x1c')],function(_0x255352){return{'model':db[_0x255352['model']],'as':_0x255352['as'],'attributes':_0x255352[_0xf878('0x1b')]};}):[]};}):[]};}):[]:[]})['then'](function(_0xb7382d){logger[_0xf878('0xb')]('ShowSetting',_0x1c559b);logger['debug'](_0xf878('0x15'),_0x1c559b,JSON[_0xf878('0x10')](_0xb7382d));_0x5579d2(_0xb7382d);})[_0xf878('0x14')](function(_0x3cbfc1){logger['error'](_0xf878('0x15'),_0x3cbfc1[_0xf878('0x13')],_0x1c559b);_0x8b5519(_0x15cbfb[_0xf878('0x11')](0x1f4,_0x3cbfc1[_0xf878('0x13')]));});});};