Built motion from commit 5b761a7b.|2.5.36
[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 _0xb25d=['model','ShowSetting','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','Setting,\x20%s,\x20%s','request\x20sent','debug','Setting,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','Setting','find','options','raw','where','attributes','include','map'];(function(_0x300ea7,_0x330ebe){var _0x31404f=function(_0x3f6f1d){while(--_0x3f6f1d){_0x300ea7['push'](_0x300ea7['shift']());}};_0x31404f(++_0x330ebe);}(_0xb25d,0x160));var _0xdb25=function(_0x2c306c,_0x13e664){_0x2c306c=_0x2c306c-0x0;var _0x3fc622=_0xb25d[_0x2c306c];return _0x3fc622;};'use strict';var _=require(_0xdb25('0x0'));var util=require(_0xdb25('0x1'));var moment=require(_0xdb25('0x2'));var BPromise=require(_0xdb25('0x3'));var rs=require(_0xdb25('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xdb25('0x5'))['db'];var utils=require(_0xdb25('0x6'));var logger=require(_0xdb25('0x7'))(_0xdb25('0x8'));var config=require(_0xdb25('0x9'));var jayson=require(_0xdb25('0xa'));var client=jayson[_0xdb25('0xb')][_0xdb25('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x5f1b5e,_0xca23d4,_0x560c32){return new BPromise(function(_0x15267e,_0x47b47b){return client[_0xdb25('0xd')](_0x5f1b5e,_0x560c32)[_0xdb25('0xe')](function(_0x15243c){logger[_0xdb25('0xf')](_0xdb25('0x10'),_0xca23d4,_0xdb25('0x11'));logger[_0xdb25('0x12')](_0xdb25('0x13'),_0xca23d4,'request\x20sent',JSON[_0xdb25('0x14')](_0x15243c));if(_0x15243c['error']){if(_0x15243c['error']['code']===0x1f4){logger[_0xdb25('0x15')](_0xdb25('0x10'),_0xca23d4,_0x15243c['error'][_0xdb25('0x16')]);return _0x47b47b(_0x15243c['error'][_0xdb25('0x16')]);}logger['error'](_0xdb25('0x10'),_0xca23d4,_0x15243c[_0xdb25('0x15')]['message']);return _0x15267e(_0x15243c[_0xdb25('0x15')][_0xdb25('0x16')]);}else{logger[_0xdb25('0xf')](_0xdb25('0x10'),_0xca23d4,_0xdb25('0x11'));_0x15267e(_0x15243c[_0xdb25('0x17')][_0xdb25('0x16')]);}})[_0xdb25('0x18')](function(_0x4794ed){logger[_0xdb25('0x15')]('Setting,\x20%s,\x20%s',_0xca23d4,_0x4794ed);_0x47b47b(_0x4794ed);});});}exports['ShowSetting']=function(_0x1cb05c){var _0x7b4365=this;return new Promise(function(_0x4c0417,_0x58f25c){return db[_0xdb25('0x19')][_0xdb25('0x1a')]({'raw':_0x1cb05c[_0xdb25('0x1b')]?_0x1cb05c[_0xdb25('0x1b')][_0xdb25('0x1c')]===undefined?!![]:![]:!![],'where':_0x1cb05c[_0xdb25('0x1b')]?_0x1cb05c[_0xdb25('0x1b')][_0xdb25('0x1d')]||null:null,'attributes':_0x1cb05c['options']?_0x1cb05c[_0xdb25('0x1b')][_0xdb25('0x1e')]||null:null,'include':_0x1cb05c[_0xdb25('0x1b')]?_0x1cb05c[_0xdb25('0x1b')][_0xdb25('0x1f')]?_[_0xdb25('0x20')](_0x1cb05c[_0xdb25('0x1b')][_0xdb25('0x1f')],function(_0x1aa8eb){return{'model':db[_0x1aa8eb[_0xdb25('0x21')]],'as':_0x1aa8eb['as'],'attributes':_0x1aa8eb[_0xdb25('0x1e')],'include':_0x1aa8eb[_0xdb25('0x1f')]?_['map'](_0x1aa8eb[_0xdb25('0x1f')],function(_0x5f5c70){return{'model':db[_0x5f5c70[_0xdb25('0x21')]],'as':_0x5f5c70['as'],'attributes':_0x5f5c70['attributes'],'include':_0x5f5c70[_0xdb25('0x1f')]?_[_0xdb25('0x20')](_0x5f5c70[_0xdb25('0x1f')],function(_0x5f07dd){return{'model':db[_0x5f07dd[_0xdb25('0x21')]],'as':_0x5f07dd['as'],'attributes':_0x5f07dd['attributes']};}):[]};}):[]};}):[]:[]})[_0xdb25('0xe')](function(_0x8745d5){logger[_0xdb25('0xf')](_0xdb25('0x22'),_0x1cb05c);logger[_0xdb25('0x12')](_0xdb25('0x22'),_0x1cb05c,JSON['stringify'](_0x8745d5));_0x4c0417(_0x8745d5);})[_0xdb25('0x18')](function(_0x49787d){logger['error'](_0xdb25('0x22'),_0x49787d[_0xdb25('0x16')],_0x1cb05c);_0x58f25c(_0x7b4365['error'](0x1f4,_0x49787d[_0xdb25('0x16')]));});});};