Built motion from commit (unavailable).|2.5.29
[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 _0xf2db=['include','map','model','debug','stringify','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','request\x20sent','error','message','Setting,\x20%s,\x20%s','result','catch','ShowSetting','Setting','find','options','raw','where','attributes'];(function(_0x4e9628,_0x250573){var _0x27bc8c=function(_0xb3b7ae){while(--_0xb3b7ae){_0x4e9628['push'](_0x4e9628['shift']());}};_0x27bc8c(++_0x250573);}(_0xf2db,0x68));var _0xbf2d=function(_0x32ed23,_0x4a261b){_0x32ed23=_0x32ed23-0x0;var _0x815ed2=_0xf2db[_0x32ed23];return _0x815ed2;};'use strict';var _=require('lodash');var util=require(_0xbf2d('0x0'));var moment=require(_0xbf2d('0x1'));var BPromise=require(_0xbf2d('0x2'));var rs=require(_0xbf2d('0x3'));var fs=require('fs');var Redis=require(_0xbf2d('0x4'));var db=require(_0xbf2d('0x5'))['db'];var utils=require(_0xbf2d('0x6'));var logger=require(_0xbf2d('0x7'))(_0xbf2d('0x8'));var config=require(_0xbf2d('0x9'));var jayson=require(_0xbf2d('0xa'));var client=jayson[_0xbf2d('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x18f1bb,_0xbcca37,_0x4a6dbc){return new BPromise(function(_0x592d55,_0x31fbec){return client[_0xbf2d('0xc')](_0x18f1bb,_0x4a6dbc)[_0xbf2d('0xd')](function(_0x1dac78){logger[_0xbf2d('0xe')]('Setting,\x20%s,\x20%s',_0xbcca37,_0xbf2d('0xf'));logger['debug']('Setting,\x20%s,\x20%s,\x20%s',_0xbcca37,_0xbf2d('0xf'),JSON['stringify'](_0x1dac78));if(_0x1dac78['error']){if(_0x1dac78[_0xbf2d('0x10')]['code']===0x1f4){logger['error']('Setting,\x20%s,\x20%s',_0xbcca37,_0x1dac78[_0xbf2d('0x10')][_0xbf2d('0x11')]);return _0x31fbec(_0x1dac78[_0xbf2d('0x10')]['message']);}logger['error'](_0xbf2d('0x12'),_0xbcca37,_0x1dac78[_0xbf2d('0x10')][_0xbf2d('0x11')]);return _0x592d55(_0x1dac78[_0xbf2d('0x10')][_0xbf2d('0x11')]);}else{logger[_0xbf2d('0xe')](_0xbf2d('0x12'),_0xbcca37,_0xbf2d('0xf'));_0x592d55(_0x1dac78[_0xbf2d('0x13')]['message']);}})[_0xbf2d('0x14')](function(_0x25270b){logger[_0xbf2d('0x10')](_0xbf2d('0x12'),_0xbcca37,_0x25270b);_0x31fbec(_0x25270b);});});}exports[_0xbf2d('0x15')]=function(_0x157a6f){var _0x4e8329=this;return new Promise(function(_0x189c56,_0x5d286f){return db[_0xbf2d('0x16')][_0xbf2d('0x17')]({'raw':_0x157a6f[_0xbf2d('0x18')]?_0x157a6f[_0xbf2d('0x18')][_0xbf2d('0x19')]===undefined?!![]:![]:!![],'where':_0x157a6f[_0xbf2d('0x18')]?_0x157a6f[_0xbf2d('0x18')][_0xbf2d('0x1a')]||null:null,'attributes':_0x157a6f[_0xbf2d('0x18')]?_0x157a6f[_0xbf2d('0x18')][_0xbf2d('0x1b')]||null:null,'include':_0x157a6f[_0xbf2d('0x18')]?_0x157a6f[_0xbf2d('0x18')][_0xbf2d('0x1c')]?_[_0xbf2d('0x1d')](_0x157a6f['options'][_0xbf2d('0x1c')],function(_0x19607a){return{'model':db[_0x19607a[_0xbf2d('0x1e')]],'as':_0x19607a['as'],'attributes':_0x19607a[_0xbf2d('0x1b')],'include':_0x19607a[_0xbf2d('0x1c')]?_[_0xbf2d('0x1d')](_0x19607a['include'],function(_0x2c24a4){return{'model':db[_0x2c24a4[_0xbf2d('0x1e')]],'as':_0x2c24a4['as'],'attributes':_0x2c24a4[_0xbf2d('0x1b')],'include':_0x2c24a4['include']?_['map'](_0x2c24a4['include'],function(_0x54631e){return{'model':db[_0x54631e['model']],'as':_0x54631e['as'],'attributes':_0x54631e[_0xbf2d('0x1b')]};}):[]};}):[]};}):[]:[]})['then'](function(_0xe45d){logger[_0xbf2d('0xe')](_0xbf2d('0x15'),_0x157a6f);logger[_0xbf2d('0x1f')](_0xbf2d('0x15'),_0x157a6f,JSON[_0xbf2d('0x20')](_0xe45d));_0x189c56(_0xe45d);})[_0xbf2d('0x14')](function(_0x5ebfab){logger[_0xbf2d('0x10')](_0xbf2d('0x15'),_0x5ebfab[_0xbf2d('0x11')],_0x157a6f);_0x5d286f(_0x4e8329[_0xbf2d('0x10')](0x1f4,_0x5ebfab[_0xbf2d('0x11')]));});});};