7aea75ea35bb7ba0e9ad2eba79f9edba964db21d
[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 _0x4511=['OpenchannelApplication,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','UpdateOpenchannelApplication','OpenchannelApplication','update','body','options','where','limit','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','request','then','OpenchannelApplication,\x20%s,\x20%s','request\x20sent'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0x4511,0x15d));var _0x1451=function(_0x42c71d,_0x27e4bc){_0x42c71d=_0x42c71d-0x0;var _0x6e1117=_0x4511[_0x42c71d];return _0x6e1117;};'use strict';var _=require(_0x1451('0x0'));var util=require(_0x1451('0x1'));var moment=require(_0x1451('0x2'));var BPromise=require(_0x1451('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x1451('0x4'));var db=require(_0x1451('0x5'))['db'];var utils=require(_0x1451('0x6'));var logger=require(_0x1451('0x7'))('rpc');var config=require(_0x1451('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x1451('0x9')][_0x1451('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x195f71,_0x45900d,_0x48727b){return new BPromise(function(_0x2ac6ef,_0x1b2e72){return client[_0x1451('0xb')](_0x195f71,_0x48727b)[_0x1451('0xc')](function(_0x55ecc8){logger['info'](_0x1451('0xd'),_0x45900d,_0x1451('0xe'));logger['debug'](_0x1451('0xf'),_0x45900d,_0x1451('0xe'),JSON[_0x1451('0x10')](_0x55ecc8));if(_0x55ecc8[_0x1451('0x11')]){if(_0x55ecc8[_0x1451('0x11')]['code']===0x1f4){logger[_0x1451('0x11')]('OpenchannelApplication,\x20%s,\x20%s',_0x45900d,_0x55ecc8[_0x1451('0x11')][_0x1451('0x12')]);return _0x1b2e72(_0x55ecc8['error'][_0x1451('0x12')]);}logger[_0x1451('0x11')](_0x1451('0xd'),_0x45900d,_0x55ecc8[_0x1451('0x11')]['message']);return _0x2ac6ef(_0x55ecc8[_0x1451('0x11')][_0x1451('0x12')]);}else{logger['info'](_0x1451('0xd'),_0x45900d,_0x1451('0xe'));_0x2ac6ef(_0x55ecc8[_0x1451('0x13')][_0x1451('0x12')]);}})[_0x1451('0x14')](function(_0xdd596f){logger[_0x1451('0x11')]('OpenchannelApplication,\x20%s,\x20%s',_0x45900d,_0xdd596f);_0x1b2e72(_0xdd596f);});});}exports[_0x1451('0x15')]=function(_0xcb8802){var _0xdbadd0=this;return new Promise(function(_0x514382,_0x4f3aa1){return db[_0x1451('0x16')][_0x1451('0x17')](_0xcb8802[_0x1451('0x18')],{'raw':_0xcb8802[_0x1451('0x19')]?_0xcb8802[_0x1451('0x19')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xcb8802['options']?_0xcb8802[_0x1451('0x19')][_0x1451('0x1a')]||null:null,'attributes':_0xcb8802['options']?_0xcb8802[_0x1451('0x19')]['attributes']||null:null,'limit':_0xcb8802[_0x1451('0x19')]?_0xcb8802['options'][_0x1451('0x1b')]||null:null})[_0x1451('0xc')](function(_0x1b5bc5){logger['info']('UpdateOpenchannelApplication',_0xcb8802);logger['debug']('UpdateOpenchannelApplication',_0xcb8802,JSON[_0x1451('0x10')](_0x1b5bc5));_0x514382(_0x1b5bc5);})[_0x1451('0x14')](function(_0x3276d7){logger[_0x1451('0x11')](_0x1451('0x15'),_0x3276d7[_0x1451('0x12')],_0xcb8802);_0x4f3aa1(_0xdbadd0[_0x1451('0x11')](0x1f4,_0x3276d7[_0x1451('0x12')]));});});};