Built motion from commit (unavailable).|2.0.82
[motion2.git] / server / api / intDeskAccount / intDeskAccount.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 _0xb087=['raw','attributes','limit','include','map','model','stringify','ShowDeskAccount','find','info','debug','lodash','util','bluebird','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','DeskAccount,\x20%s,\x20%s','request\x20sent','DeskAccount,\x20%s,\x20%s,\x20%s','error','code','message','catch','GetDeskAccount','DeskAccount','findAll','options'];(function(_0x4d4b13,_0x464741){var _0x5d2b74=function(_0x1255c6){while(--_0x1255c6){_0x4d4b13['push'](_0x4d4b13['shift']());}};_0x5d2b74(++_0x464741);}(_0xb087,0x181));var _0x7b08=function(_0x4b9722,_0x425328){_0x4b9722=_0x4b9722-0x0;var _0x455238=_0xb087[_0x4b9722];return _0x455238;};'use strict';var _=require(_0x7b08('0x0'));var util=require(_0x7b08('0x1'));var moment=require('moment');var BPromise=require(_0x7b08('0x2'));var rs=require(_0x7b08('0x3'));var fs=require('fs');var db=require('../../mysqldb')['db'];var utils=require(_0x7b08('0x4'));var logger=require(_0x7b08('0x5'))(_0x7b08('0x6'));var config=require(_0x7b08('0x7'));var jayson=require(_0x7b08('0x8'));var client=jayson['client'][_0x7b08('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x252238,_0x475d25,_0x3641cc){return new BPromise(function(_0x336937,_0xac8167){return client[_0x7b08('0xa')](_0x252238,_0x3641cc)[_0x7b08('0xb')](function(_0x2a134a){logger['info'](_0x7b08('0xc'),_0x475d25,_0x7b08('0xd'));logger['debug'](_0x7b08('0xe'),_0x475d25,_0x7b08('0xd'),JSON['stringify'](_0x2a134a));if(_0x2a134a[_0x7b08('0xf')]){if(_0x2a134a[_0x7b08('0xf')][_0x7b08('0x10')]===0x1f4){logger[_0x7b08('0xf')](_0x7b08('0xc'),_0x475d25,_0x2a134a[_0x7b08('0xf')][_0x7b08('0x11')]);return _0xac8167(_0x2a134a['error'][_0x7b08('0x11')]);}logger['error'](_0x7b08('0xc'),_0x475d25,_0x2a134a[_0x7b08('0xf')][_0x7b08('0x11')]);return _0x336937(_0x2a134a['error'][_0x7b08('0x11')]);}else{logger['info']('DeskAccount,\x20%s,\x20%s',_0x475d25,_0x7b08('0xd'));_0x336937(_0x2a134a['result']['message']);}})[_0x7b08('0x12')](function(_0xc7d999){logger[_0x7b08('0xf')](_0x7b08('0xc'),_0x475d25,_0xc7d999);_0xac8167(_0xc7d999);});});}exports[_0x7b08('0x13')]=function(_0x5a2c32){var _0x5788b2=this;return new Promise(function(_0x54a864,_0x4371a9){return db[_0x7b08('0x14')][_0x7b08('0x15')]({'raw':_0x5a2c32[_0x7b08('0x16')]?_0x5a2c32[_0x7b08('0x16')][_0x7b08('0x17')]===undefined?!![]:![]:!![],'where':_0x5a2c32[_0x7b08('0x16')]?_0x5a2c32[_0x7b08('0x16')]['where']||null:null,'attributes':_0x5a2c32[_0x7b08('0x16')]?_0x5a2c32[_0x7b08('0x16')][_0x7b08('0x18')]||null:null,'limit':_0x5a2c32[_0x7b08('0x16')]?_0x5a2c32[_0x7b08('0x16')][_0x7b08('0x19')]||null:null,'include':_0x5a2c32['options']?_0x5a2c32[_0x7b08('0x16')][_0x7b08('0x1a')]?_[_0x7b08('0x1b')](_0x5a2c32['options'][_0x7b08('0x1a')],function(_0x4a7f6a){return{'model':db[_0x4a7f6a[_0x7b08('0x1c')]],'as':_0x4a7f6a['as'],'attributes':_0x4a7f6a['attributes'],'include':_0x4a7f6a[_0x7b08('0x1a')]?_['map'](_0x4a7f6a['include'],function(_0x126411){return{'model':db[_0x126411['model']],'as':_0x126411['as'],'attributes':_0x126411[_0x7b08('0x18')],'include':_0x126411[_0x7b08('0x1a')]?_[_0x7b08('0x1b')](_0x126411[_0x7b08('0x1a')],function(_0x102eb2){return{'model':db[_0x102eb2[_0x7b08('0x1c')]],'as':_0x102eb2['as'],'attributes':_0x102eb2['attributes']};}):[]};}):[]};}):[]:[]})[_0x7b08('0xb')](function(_0x5c470c){logger['info'](_0x7b08('0x13'),_0x5a2c32);logger['debug'](_0x7b08('0x13'),_0x5a2c32,JSON[_0x7b08('0x1d')](_0x5c470c));_0x54a864(_0x5c470c);})[_0x7b08('0x12')](function(_0x5d74a3){logger[_0x7b08('0xf')](_0x7b08('0x13'),_0x5d74a3[_0x7b08('0x11')],_0x5a2c32);_0x4371a9(_0x5788b2[_0x7b08('0xf')](0x1f4,_0x5d74a3[_0x7b08('0x11')]));});});};exports[_0x7b08('0x1e')]=function(_0x7cfb57){var _0x177230=this;return new Promise(function(_0x55fcac,_0x54fc07){return db['DeskAccount'][_0x7b08('0x1f')]({'raw':_0x7cfb57[_0x7b08('0x16')]?_0x7cfb57[_0x7b08('0x16')][_0x7b08('0x17')]===undefined?!![]:![]:!![],'where':_0x7cfb57['options']?_0x7cfb57[_0x7b08('0x16')]['where']||null:null,'attributes':_0x7cfb57[_0x7b08('0x16')]?_0x7cfb57[_0x7b08('0x16')][_0x7b08('0x18')]||null:null,'include':_0x7cfb57[_0x7b08('0x16')]?_0x7cfb57['options'][_0x7b08('0x1a')]?_[_0x7b08('0x1b')](_0x7cfb57[_0x7b08('0x16')][_0x7b08('0x1a')],function(_0x39a06e){return{'model':db[_0x39a06e['model']],'as':_0x39a06e['as'],'attributes':_0x39a06e[_0x7b08('0x18')],'include':_0x39a06e[_0x7b08('0x1a')]?_[_0x7b08('0x1b')](_0x39a06e[_0x7b08('0x1a')],function(_0x568cd8){return{'model':db[_0x568cd8[_0x7b08('0x1c')]],'as':_0x568cd8['as'],'attributes':_0x568cd8[_0x7b08('0x18')],'include':_0x568cd8['include']?_[_0x7b08('0x1b')](_0x568cd8['include'],function(_0x4ce38a){return{'model':db[_0x4ce38a[_0x7b08('0x1c')]],'as':_0x4ce38a['as'],'attributes':_0x4ce38a['attributes']};}):[]};}):[]};}):[]:[]})[_0x7b08('0xb')](function(_0x580ec9){logger[_0x7b08('0x20')]('ShowDeskAccount',_0x7cfb57);logger[_0x7b08('0x21')](_0x7b08('0x1e'),_0x7cfb57,JSON[_0x7b08('0x1d')](_0x580ec9));_0x55fcac(_0x580ec9);})[_0x7b08('0x12')](function(_0x5f1625){logger['error'](_0x7b08('0x1e'),_0x5f1625['message'],_0x7cfb57);_0x54fc07(_0x177230['error'](0x1f4,_0x5f1625['message']));});});};