7725ba2d45a1a2cba00753165780b2b17ea8c0e5
[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 _0x570c=['then','info','request\x20sent','debug','code','error','FaxQueueReport,\x20%s,\x20%s','message','result','catch','CreateFaxQueueReport','create','body','options','raw','UpdateFaxQueueReport','where','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client','http','request'];(function(_0x7e55a4,_0x10ff38){var _0x1e152b=function(_0x58ec93){while(--_0x58ec93){_0x7e55a4['push'](_0x7e55a4['shift']());}};_0x1e152b(++_0x10ff38);}(_0x570c,0x161));var _0xc570=function(_0x341d40,_0x2ae200){_0x341d40=_0x341d40-0x0;var _0x2565c7=_0x570c[_0x341d40];return _0x2565c7;};'use strict';var _=require(_0xc570('0x0'));var util=require('util');var moment=require(_0xc570('0x1'));var BPromise=require('bluebird');var rs=require(_0xc570('0x2'));var fs=require('fs');var Redis=require(_0xc570('0x3'));var db=require(_0xc570('0x4'))['db'];var utils=require(_0xc570('0x5'));var logger=require('../../config/logger')(_0xc570('0x6'));var config=require('../../config/environment');var jayson=require(_0xc570('0x7'));var client=jayson[_0xc570('0x8')][_0xc570('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x47fb72,_0x57b094,_0x3b041b){return new BPromise(function(_0x60e19c,_0x2edad9){return client[_0xc570('0xa')](_0x47fb72,_0x3b041b)[_0xc570('0xb')](function(_0x4fd2df){logger[_0xc570('0xc')]('FaxQueueReport,\x20%s,\x20%s',_0x57b094,_0xc570('0xd'));logger[_0xc570('0xe')]('FaxQueueReport,\x20%s,\x20%s,\x20%s',_0x57b094,_0xc570('0xd'),JSON['stringify'](_0x4fd2df));if(_0x4fd2df['error']){if(_0x4fd2df['error'][_0xc570('0xf')]===0x1f4){logger[_0xc570('0x10')](_0xc570('0x11'),_0x57b094,_0x4fd2df[_0xc570('0x10')][_0xc570('0x12')]);return _0x2edad9(_0x4fd2df[_0xc570('0x10')][_0xc570('0x12')]);}logger[_0xc570('0x10')]('FaxQueueReport,\x20%s,\x20%s',_0x57b094,_0x4fd2df[_0xc570('0x10')][_0xc570('0x12')]);return _0x60e19c(_0x4fd2df[_0xc570('0x10')][_0xc570('0x12')]);}else{logger['info'](_0xc570('0x11'),_0x57b094,_0xc570('0xd'));_0x60e19c(_0x4fd2df[_0xc570('0x13')][_0xc570('0x12')]);}})[_0xc570('0x14')](function(_0x51c5ca){logger[_0xc570('0x10')](_0xc570('0x11'),_0x57b094,_0x51c5ca);_0x2edad9(_0x51c5ca);});});}exports[_0xc570('0x15')]=function(_0x4d7b0a){var _0x6c6656=this;return new Promise(function(_0x46aece,_0x42a5cd){return db['FaxQueueReport'][_0xc570('0x16')](_0x4d7b0a[_0xc570('0x17')],{'raw':_0x4d7b0a[_0xc570('0x18')]?_0x4d7b0a[_0xc570('0x18')][_0xc570('0x19')]===undefined?!![]:![]:!![]})[_0xc570('0xb')](function(_0x492b63){logger[_0xc570('0xc')](_0xc570('0x15'),_0x4d7b0a);logger[_0xc570('0xe')](_0xc570('0x15'),_0x4d7b0a,JSON['stringify'](_0x492b63));_0x46aece(_0x492b63);})[_0xc570('0x14')](function(_0x2df1c2){logger[_0xc570('0x10')](_0xc570('0x15'),_0x2df1c2[_0xc570('0x12')],_0x4d7b0a);_0x42a5cd(_0x6c6656[_0xc570('0x10')](0x1f4,_0x2df1c2[_0xc570('0x12')]));});});};exports[_0xc570('0x1a')]=function(_0xe40934){var _0x21688a=this;return new Promise(function(_0x287643,_0x4d8f51){return db['FaxQueueReport']['update'](_0xe40934[_0xc570('0x17')],{'raw':_0xe40934['options']?_0xe40934[_0xc570('0x18')][_0xc570('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xe40934[_0xc570('0x18')]?_0xe40934[_0xc570('0x18')][_0xc570('0x1b')]||null:null,'attributes':_0xe40934[_0xc570('0x18')]?_0xe40934[_0xc570('0x18')]['attributes']||null:null,'limit':_0xe40934[_0xc570('0x18')]?_0xe40934[_0xc570('0x18')]['limit']||null:null})[_0xc570('0xb')](function(_0x38f94c){logger['info'](_0xc570('0x1a'),_0xe40934);logger[_0xc570('0xe')](_0xc570('0x1a'),_0xe40934,JSON['stringify'](_0x38f94c));_0x287643(_0x38f94c);})['catch'](function(_0x220619){logger[_0xc570('0x10')]('UpdateFaxQueueReport',_0x220619[_0xc570('0x12')],_0xe40934);_0x4d8f51(_0x21688a[_0xc570('0x10')](0x1f4,_0x220619['message']));});});};