Built motion from commit a134ab58.|2.6.29
[motion2.git] / server / api / faxQueueReport / faxQueueReport.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 _0xfccb=['options','raw','UpdateFaxQueueReport','limit','lodash','util','moment','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','http','request','then','info','request\x20sent','debug','FaxQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','FaxQueueReport,\x20%s,\x20%s','result','catch','CreateFaxQueueReport','create','body'];(function(_0x48b012,_0x35586b){var _0x1520ac=function(_0xfce57c){while(--_0xfce57c){_0x48b012['push'](_0x48b012['shift']());}};_0x1520ac(++_0x35586b);}(_0xfccb,0x1f1));var _0xbfcc=function(_0x3258e5,_0x757ef5){_0x3258e5=_0x3258e5-0x0;var _0x12a721=_0xfccb[_0x3258e5];return _0x12a721;};'use strict';var _=require(_0xbfcc('0x0'));var util=require(_0xbfcc('0x1'));var moment=require(_0xbfcc('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xbfcc('0x3'));var db=require(_0xbfcc('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xbfcc('0x5'))('rpc');var config=require(_0xbfcc('0x6'));var jayson=require(_0xbfcc('0x7'));var client=jayson['client'][_0xbfcc('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x831a1b,_0x287374,_0x734b26){return new BPromise(function(_0x5d47d5,_0x400870){return client[_0xbfcc('0x9')](_0x831a1b,_0x734b26)[_0xbfcc('0xa')](function(_0x59e775){logger[_0xbfcc('0xb')]('FaxQueueReport,\x20%s,\x20%s',_0x287374,_0xbfcc('0xc'));logger[_0xbfcc('0xd')](_0xbfcc('0xe'),_0x287374,_0xbfcc('0xc'),JSON[_0xbfcc('0xf')](_0x59e775));if(_0x59e775['error']){if(_0x59e775[_0xbfcc('0x10')][_0xbfcc('0x11')]===0x1f4){logger[_0xbfcc('0x10')]('FaxQueueReport,\x20%s,\x20%s',_0x287374,_0x59e775[_0xbfcc('0x10')]['message']);return _0x400870(_0x59e775['error'][_0xbfcc('0x12')]);}logger['error']('FaxQueueReport,\x20%s,\x20%s',_0x287374,_0x59e775[_0xbfcc('0x10')]['message']);return _0x5d47d5(_0x59e775['error'][_0xbfcc('0x12')]);}else{logger[_0xbfcc('0xb')](_0xbfcc('0x13'),_0x287374,_0xbfcc('0xc'));_0x5d47d5(_0x59e775[_0xbfcc('0x14')][_0xbfcc('0x12')]);}})[_0xbfcc('0x15')](function(_0x535dfd){logger[_0xbfcc('0x10')](_0xbfcc('0x13'),_0x287374,_0x535dfd);_0x400870(_0x535dfd);});});}exports[_0xbfcc('0x16')]=function(_0x334537){var _0x4a54ce=this;return new Promise(function(_0x22977b,_0x1d405d){return db['FaxQueueReport'][_0xbfcc('0x17')](_0x334537[_0xbfcc('0x18')],{'raw':_0x334537[_0xbfcc('0x19')]?_0x334537[_0xbfcc('0x19')][_0xbfcc('0x1a')]===undefined?!![]:![]:!![]})[_0xbfcc('0xa')](function(_0xfdad4d){logger[_0xbfcc('0xb')](_0xbfcc('0x16'),_0x334537);logger[_0xbfcc('0xd')](_0xbfcc('0x16'),_0x334537,JSON[_0xbfcc('0xf')](_0xfdad4d));_0x22977b(_0xfdad4d);})[_0xbfcc('0x15')](function(_0x55a2cd){logger['error'](_0xbfcc('0x16'),_0x55a2cd[_0xbfcc('0x12')],_0x334537);_0x1d405d(_0x4a54ce[_0xbfcc('0x10')](0x1f4,_0x55a2cd[_0xbfcc('0x12')]));});});};exports[_0xbfcc('0x1b')]=function(_0x146484){var _0x5ea12a=this;return new Promise(function(_0x2b6608,_0x37224){return db['FaxQueueReport']['update'](_0x146484['body'],{'raw':_0x146484['options']?_0x146484[_0xbfcc('0x19')][_0xbfcc('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x146484[_0xbfcc('0x19')]?_0x146484['options']['where']||null:null,'attributes':_0x146484[_0xbfcc('0x19')]?_0x146484[_0xbfcc('0x19')]['attributes']||null:null,'limit':_0x146484[_0xbfcc('0x19')]?_0x146484[_0xbfcc('0x19')][_0xbfcc('0x1c')]||null:null})['then'](function(_0x3853d9){logger[_0xbfcc('0xb')](_0xbfcc('0x1b'),_0x146484);logger['debug']('UpdateFaxQueueReport',_0x146484,JSON[_0xbfcc('0xf')](_0x3853d9));_0x2b6608(_0x3853d9);})['catch'](function(_0x4e0be9){logger[_0xbfcc('0x10')](_0xbfcc('0x1b'),_0x4e0be9['message'],_0x146484);_0x37224(_0x5ea12a['error'](0x1f4,_0x4e0be9[_0xbfcc('0x12')]));});});};