Built motion from commit (unavailable).|2.5.26
[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 _0x69fb=['error','code','message','result','catch','ShowSetting','Setting','options','raw','where','attributes','map','model','include','debug','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','Setting,\x20%s,\x20%s','request\x20sent','stringify'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x69fb,0x14a));var _0xb69f=function(_0x2459b4,_0x56b89a){_0x2459b4=_0x2459b4-0x0;var _0xf1caab=_0x69fb[_0x2459b4];return _0xf1caab;};'use strict';var _=require(_0xb69f('0x0'));var util=require(_0xb69f('0x1'));var moment=require(_0xb69f('0x2'));var BPromise=require(_0xb69f('0x3'));var rs=require(_0xb69f('0x4'));var fs=require('fs');var Redis=require(_0xb69f('0x5'));var db=require(_0xb69f('0x6'))['db'];var utils=require(_0xb69f('0x7'));var logger=require(_0xb69f('0x8'))(_0xb69f('0x9'));var config=require(_0xb69f('0xa'));var jayson=require(_0xb69f('0xb'));var client=jayson[_0xb69f('0xc')][_0xb69f('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x4824f4,_0x16d9ea,_0x1ffa38){return new BPromise(function(_0x59425b,_0x52ff34){return client[_0xb69f('0xe')](_0x4824f4,_0x1ffa38)[_0xb69f('0xf')](function(_0x33f57b){logger[_0xb69f('0x10')](_0xb69f('0x11'),_0x16d9ea,_0xb69f('0x12'));logger['debug']('Setting,\x20%s,\x20%s,\x20%s',_0x16d9ea,_0xb69f('0x12'),JSON[_0xb69f('0x13')](_0x33f57b));if(_0x33f57b['error']){if(_0x33f57b[_0xb69f('0x14')][_0xb69f('0x15')]===0x1f4){logger[_0xb69f('0x14')]('Setting,\x20%s,\x20%s',_0x16d9ea,_0x33f57b[_0xb69f('0x14')][_0xb69f('0x16')]);return _0x52ff34(_0x33f57b[_0xb69f('0x14')]['message']);}logger[_0xb69f('0x14')](_0xb69f('0x11'),_0x16d9ea,_0x33f57b['error'][_0xb69f('0x16')]);return _0x59425b(_0x33f57b[_0xb69f('0x14')][_0xb69f('0x16')]);}else{logger['info'](_0xb69f('0x11'),_0x16d9ea,'request\x20sent');_0x59425b(_0x33f57b[_0xb69f('0x17')][_0xb69f('0x16')]);}})[_0xb69f('0x18')](function(_0x55fd20){logger[_0xb69f('0x14')](_0xb69f('0x11'),_0x16d9ea,_0x55fd20);_0x52ff34(_0x55fd20);});});}exports[_0xb69f('0x19')]=function(_0x1055ff){var _0x3db65c=this;return new Promise(function(_0x9aa92c,_0x55d024){return db[_0xb69f('0x1a')]['find']({'raw':_0x1055ff[_0xb69f('0x1b')]?_0x1055ff[_0xb69f('0x1b')][_0xb69f('0x1c')]===undefined?!![]:![]:!![],'where':_0x1055ff[_0xb69f('0x1b')]?_0x1055ff[_0xb69f('0x1b')][_0xb69f('0x1d')]||null:null,'attributes':_0x1055ff[_0xb69f('0x1b')]?_0x1055ff[_0xb69f('0x1b')][_0xb69f('0x1e')]||null:null,'include':_0x1055ff[_0xb69f('0x1b')]?_0x1055ff['options']['include']?_[_0xb69f('0x1f')](_0x1055ff[_0xb69f('0x1b')]['include'],function(_0x5c7733){return{'model':db[_0x5c7733[_0xb69f('0x20')]],'as':_0x5c7733['as'],'attributes':_0x5c7733[_0xb69f('0x1e')],'include':_0x5c7733['include']?_[_0xb69f('0x1f')](_0x5c7733[_0xb69f('0x21')],function(_0x27bae9){return{'model':db[_0x27bae9[_0xb69f('0x20')]],'as':_0x27bae9['as'],'attributes':_0x27bae9[_0xb69f('0x1e')],'include':_0x27bae9[_0xb69f('0x21')]?_['map'](_0x27bae9[_0xb69f('0x21')],function(_0x5d692d){return{'model':db[_0x5d692d[_0xb69f('0x20')]],'as':_0x5d692d['as'],'attributes':_0x5d692d[_0xb69f('0x1e')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x2e9384){logger[_0xb69f('0x10')](_0xb69f('0x19'),_0x1055ff);logger[_0xb69f('0x22')](_0xb69f('0x19'),_0x1055ff,JSON['stringify'](_0x2e9384));_0x9aa92c(_0x2e9384);})['catch'](function(_0x5efa35){logger[_0xb69f('0x14')]('ShowSetting',_0x5efa35[_0xb69f('0x16')],_0x1055ff);_0x55d024(_0x3db65c[_0xb69f('0x14')](0x1f4,_0x5efa35['message']));});});};