Built motion from commit 56b8093a.|2.6.29
[motion2.git] / server / api / openchannelApplication / openchannelApplication.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 _0x0343=['stringify','lodash','util','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','OpenchannelApplication,\x20%s,\x20%s','request\x20sent','debug','OpenchannelApplication,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','UpdateOpenchannelApplication','OpenchannelApplication','update','body','options','raw','where','attributes','limit'];(function(_0x13b02f,_0x462a53){var _0x12e9a6=function(_0x187d57){while(--_0x187d57){_0x13b02f['push'](_0x13b02f['shift']());}};_0x12e9a6(++_0x462a53);}(_0x0343,0x1e1));var _0x3034=function(_0x4f750b,_0x4e3e43){_0x4f750b=_0x4f750b-0x0;var _0x918b39=_0x0343[_0x4f750b];return _0x918b39;};'use strict';var _=require(_0x3034('0x0'));var util=require(_0x3034('0x1'));var moment=require('moment');var BPromise=require(_0x3034('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x3034('0x3'))['db'];var utils=require(_0x3034('0x4'));var logger=require(_0x3034('0x5'))(_0x3034('0x6'));var config=require(_0x3034('0x7'));var jayson=require(_0x3034('0x8'));var client=jayson[_0x3034('0x9')][_0x3034('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2b271b,_0x3fe8bc,_0xe265a9){return new BPromise(function(_0x4ff3d9,_0x3d4d51){return client['request'](_0x2b271b,_0xe265a9)[_0x3034('0xb')](function(_0x2118a0){logger[_0x3034('0xc')](_0x3034('0xd'),_0x3fe8bc,_0x3034('0xe'));logger[_0x3034('0xf')](_0x3034('0x10'),_0x3fe8bc,_0x3034('0xe'),JSON['stringify'](_0x2118a0));if(_0x2118a0['error']){if(_0x2118a0[_0x3034('0x11')][_0x3034('0x12')]===0x1f4){logger[_0x3034('0x11')](_0x3034('0xd'),_0x3fe8bc,_0x2118a0[_0x3034('0x11')][_0x3034('0x13')]);return _0x3d4d51(_0x2118a0['error'][_0x3034('0x13')]);}logger[_0x3034('0x11')](_0x3034('0xd'),_0x3fe8bc,_0x2118a0['error']['message']);return _0x4ff3d9(_0x2118a0[_0x3034('0x11')][_0x3034('0x13')]);}else{logger[_0x3034('0xc')](_0x3034('0xd'),_0x3fe8bc,'request\x20sent');_0x4ff3d9(_0x2118a0[_0x3034('0x14')]['message']);}})[_0x3034('0x15')](function(_0x21b672){logger['error'](_0x3034('0xd'),_0x3fe8bc,_0x21b672);_0x3d4d51(_0x21b672);});});}exports[_0x3034('0x16')]=function(_0x599807){var _0x35bb57=this;return new Promise(function(_0x464df2,_0x3a1b9d){return db[_0x3034('0x17')][_0x3034('0x18')](_0x599807[_0x3034('0x19')],{'raw':_0x599807[_0x3034('0x1a')]?_0x599807[_0x3034('0x1a')][_0x3034('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x599807[_0x3034('0x1a')]?_0x599807['options'][_0x3034('0x1c')]||null:null,'attributes':_0x599807[_0x3034('0x1a')]?_0x599807[_0x3034('0x1a')][_0x3034('0x1d')]||null:null,'limit':_0x599807[_0x3034('0x1a')]?_0x599807[_0x3034('0x1a')][_0x3034('0x1e')]||null:null})[_0x3034('0xb')](function(_0x52160f){logger['info'](_0x3034('0x16'),_0x599807);logger[_0x3034('0xf')](_0x3034('0x16'),_0x599807,JSON[_0x3034('0x1f')](_0x52160f));_0x464df2(_0x52160f);})[_0x3034('0x15')](function(_0x3b134c){logger['error'](_0x3034('0x16'),_0x3b134c['message'],_0x599807);_0x3a1b9d(_0x35bb57[_0x3034('0x11')](0x1f4,_0x3b134c[_0x3034('0x13')]));});});};