Built motion from commit ffdca78c.|2.6.24
[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 _0x3c0b=['randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','Setting,\x20%s,\x20%s','request\x20sent','debug','Setting,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','ShowSetting','Setting','find','options','raw','where','attributes','map','model','include','info','lodash','util'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0x3c0b,0x1de));var _0xb3c0=function(_0x3a3c8a,_0x137e29){_0x3a3c8a=_0x3a3c8a-0x0;var _0x3ab6c2=_0x3c0b[_0x3a3c8a];return _0x3ab6c2;};'use strict';var _=require(_0xb3c0('0x0'));var util=require(_0xb3c0('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xb3c0('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xb3c0('0x3'))['db'];var utils=require(_0xb3c0('0x4'));var logger=require(_0xb3c0('0x5'))(_0xb3c0('0x6'));var config=require(_0xb3c0('0x7'));var jayson=require(_0xb3c0('0x8'));var client=jayson[_0xb3c0('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5dd5d3,_0x4adb1e,_0xdae360){return new BPromise(function(_0x83b66a,_0x15d33c){return client[_0xb3c0('0xa')](_0x5dd5d3,_0xdae360)[_0xb3c0('0xb')](function(_0x1ae80c){logger['info'](_0xb3c0('0xc'),_0x4adb1e,_0xb3c0('0xd'));logger[_0xb3c0('0xe')](_0xb3c0('0xf'),_0x4adb1e,_0xb3c0('0xd'),JSON[_0xb3c0('0x10')](_0x1ae80c));if(_0x1ae80c[_0xb3c0('0x11')]){if(_0x1ae80c[_0xb3c0('0x11')]['code']===0x1f4){logger[_0xb3c0('0x11')]('Setting,\x20%s,\x20%s',_0x4adb1e,_0x1ae80c[_0xb3c0('0x11')][_0xb3c0('0x12')]);return _0x15d33c(_0x1ae80c[_0xb3c0('0x11')][_0xb3c0('0x12')]);}logger['error'](_0xb3c0('0xc'),_0x4adb1e,_0x1ae80c[_0xb3c0('0x11')][_0xb3c0('0x12')]);return _0x83b66a(_0x1ae80c[_0xb3c0('0x11')]['message']);}else{logger['info']('Setting,\x20%s,\x20%s',_0x4adb1e,_0xb3c0('0xd'));_0x83b66a(_0x1ae80c[_0xb3c0('0x13')]['message']);}})[_0xb3c0('0x14')](function(_0x1984d9){logger[_0xb3c0('0x11')](_0xb3c0('0xc'),_0x4adb1e,_0x1984d9);_0x15d33c(_0x1984d9);});});}exports[_0xb3c0('0x15')]=function(_0x2d9066){var _0x3cc75d=this;return new Promise(function(_0x3b2b8a,_0x525368){return db[_0xb3c0('0x16')][_0xb3c0('0x17')]({'raw':_0x2d9066[_0xb3c0('0x18')]?_0x2d9066['options'][_0xb3c0('0x19')]===undefined?!![]:![]:!![],'where':_0x2d9066[_0xb3c0('0x18')]?_0x2d9066[_0xb3c0('0x18')][_0xb3c0('0x1a')]||null:null,'attributes':_0x2d9066[_0xb3c0('0x18')]?_0x2d9066[_0xb3c0('0x18')][_0xb3c0('0x1b')]||null:null,'include':_0x2d9066[_0xb3c0('0x18')]?_0x2d9066['options']['include']?_[_0xb3c0('0x1c')](_0x2d9066[_0xb3c0('0x18')]['include'],function(_0x565d81){return{'model':db[_0x565d81[_0xb3c0('0x1d')]],'as':_0x565d81['as'],'attributes':_0x565d81[_0xb3c0('0x1b')],'include':_0x565d81[_0xb3c0('0x1e')]?_[_0xb3c0('0x1c')](_0x565d81[_0xb3c0('0x1e')],function(_0x5dd352){return{'model':db[_0x5dd352[_0xb3c0('0x1d')]],'as':_0x5dd352['as'],'attributes':_0x5dd352[_0xb3c0('0x1b')],'include':_0x5dd352['include']?_[_0xb3c0('0x1c')](_0x5dd352[_0xb3c0('0x1e')],function(_0x2b2c6b){return{'model':db[_0x2b2c6b[_0xb3c0('0x1d')]],'as':_0x2b2c6b['as'],'attributes':_0x2b2c6b[_0xb3c0('0x1b')]};}):[]};}):[]};}):[]:[]})[_0xb3c0('0xb')](function(_0x53dbbe){logger[_0xb3c0('0x1f')](_0xb3c0('0x15'),_0x2d9066);logger['debug']('ShowSetting',_0x2d9066,JSON[_0xb3c0('0x10')](_0x53dbbe));_0x3b2b8a(_0x53dbbe);})[_0xb3c0('0x14')](function(_0x2b7d54){logger[_0xb3c0('0x11')](_0xb3c0('0x15'),_0x2b7d54[_0xb3c0('0x12')],_0x2d9066);_0x525368(_0x3cc75d[_0xb3c0('0x11')](0x1f4,_0x2b7d54[_0xb3c0('0x12')]));});});};