Built motion from commit da24aabd.|2.6.20
[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 _0x2cc1=['model','then','stringify','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','client','http','request','info','request\x20sent','debug','error','code','Setting,\x20%s,\x20%s','message','result','catch','ShowSetting','Setting','find','options','raw','where','attributes','include','map'];(function(_0x231c4b,_0xca7fc2){var _0x478db0=function(_0x23ca99){while(--_0x23ca99){_0x231c4b['push'](_0x231c4b['shift']());}};_0x478db0(++_0xca7fc2);}(_0x2cc1,0x18f));var _0x12cc=function(_0x1c546c,_0x5c57cb){_0x1c546c=_0x1c546c-0x0;var _0x2cc384=_0x2cc1[_0x1c546c];return _0x2cc384;};'use strict';var _=require('lodash');var util=require(_0x12cc('0x0'));var moment=require(_0x12cc('0x1'));var BPromise=require(_0x12cc('0x2'));var rs=require(_0x12cc('0x3'));var fs=require('fs');var Redis=require(_0x12cc('0x4'));var db=require(_0x12cc('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x12cc('0x6'))(_0x12cc('0x7'));var config=require(_0x12cc('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x12cc('0x9')][_0x12cc('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4648c8,_0x444909,_0x1deff1){return new BPromise(function(_0x361281,_0x246b26){return client[_0x12cc('0xb')](_0x4648c8,_0x1deff1)['then'](function(_0x58c5af){logger[_0x12cc('0xc')]('Setting,\x20%s,\x20%s',_0x444909,_0x12cc('0xd'));logger[_0x12cc('0xe')]('Setting,\x20%s,\x20%s,\x20%s',_0x444909,_0x12cc('0xd'),JSON['stringify'](_0x58c5af));if(_0x58c5af[_0x12cc('0xf')]){if(_0x58c5af[_0x12cc('0xf')][_0x12cc('0x10')]===0x1f4){logger[_0x12cc('0xf')](_0x12cc('0x11'),_0x444909,_0x58c5af[_0x12cc('0xf')][_0x12cc('0x12')]);return _0x246b26(_0x58c5af[_0x12cc('0xf')][_0x12cc('0x12')]);}logger['error'](_0x12cc('0x11'),_0x444909,_0x58c5af['error'][_0x12cc('0x12')]);return _0x361281(_0x58c5af[_0x12cc('0xf')]['message']);}else{logger[_0x12cc('0xc')](_0x12cc('0x11'),_0x444909,_0x12cc('0xd'));_0x361281(_0x58c5af[_0x12cc('0x13')][_0x12cc('0x12')]);}})[_0x12cc('0x14')](function(_0x33ac28){logger[_0x12cc('0xf')]('Setting,\x20%s,\x20%s',_0x444909,_0x33ac28);_0x246b26(_0x33ac28);});});}exports[_0x12cc('0x15')]=function(_0x57f2a9){var _0x10b008=this;return new Promise(function(_0xf9aca1,_0x56b815){return db[_0x12cc('0x16')][_0x12cc('0x17')]({'raw':_0x57f2a9[_0x12cc('0x18')]?_0x57f2a9[_0x12cc('0x18')][_0x12cc('0x19')]===undefined?!![]:![]:!![],'where':_0x57f2a9['options']?_0x57f2a9[_0x12cc('0x18')][_0x12cc('0x1a')]||null:null,'attributes':_0x57f2a9[_0x12cc('0x18')]?_0x57f2a9[_0x12cc('0x18')][_0x12cc('0x1b')]||null:null,'include':_0x57f2a9[_0x12cc('0x18')]?_0x57f2a9[_0x12cc('0x18')][_0x12cc('0x1c')]?_[_0x12cc('0x1d')](_0x57f2a9[_0x12cc('0x18')][_0x12cc('0x1c')],function(_0x2427a1){return{'model':db[_0x2427a1['model']],'as':_0x2427a1['as'],'attributes':_0x2427a1[_0x12cc('0x1b')],'include':_0x2427a1[_0x12cc('0x1c')]?_[_0x12cc('0x1d')](_0x2427a1[_0x12cc('0x1c')],function(_0x20e0aa){return{'model':db[_0x20e0aa[_0x12cc('0x1e')]],'as':_0x20e0aa['as'],'attributes':_0x20e0aa[_0x12cc('0x1b')],'include':_0x20e0aa[_0x12cc('0x1c')]?_[_0x12cc('0x1d')](_0x20e0aa[_0x12cc('0x1c')],function(_0x3ea4e2){return{'model':db[_0x3ea4e2[_0x12cc('0x1e')]],'as':_0x3ea4e2['as'],'attributes':_0x3ea4e2[_0x12cc('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x12cc('0x1f')](function(_0x20319c){logger[_0x12cc('0xc')](_0x12cc('0x15'),_0x57f2a9);logger[_0x12cc('0xe')](_0x12cc('0x15'),_0x57f2a9,JSON[_0x12cc('0x20')](_0x20319c));_0xf9aca1(_0x20319c);})[_0x12cc('0x14')](function(_0x3df009){logger['error'](_0x12cc('0x15'),_0x3df009[_0x12cc('0x12')],_0x57f2a9);_0x56b815(_0x10b008['error'](0x1f4,_0x3df009['message']));});});};