7e6e3ed13ef3ae1499534740508d63362e37757d
[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 _0x7f79=['../../config/utils','rpc','jayson/promise','client','request','then','info','FaxQueueReport,\x20%s,\x20%s','request\x20sent','debug','FaxQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','body','options','raw','CreateFaxQueueReport','catch','UpdateFaxQueueReport','FaxQueueReport','update','where','attributes','limit','lodash','util','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x556a83,_0x56897c){var _0x1f89bf=function(_0x5d7028){while(--_0x5d7028){_0x556a83['push'](_0x556a83['shift']());}};_0x1f89bf(++_0x56897c);}(_0x7f79,0x9f));var _0x97f7=function(_0x452aec,_0x31b562){_0x452aec=_0x452aec-0x0;var _0x210b38=_0x7f79[_0x452aec];return _0x210b38;};'use strict';var _=require(_0x97f7('0x0'));var util=require(_0x97f7('0x1'));var moment=require('moment');var BPromise=require(_0x97f7('0x2'));var rs=require(_0x97f7('0x3'));var fs=require('fs');var Redis=require(_0x97f7('0x4'));var db=require(_0x97f7('0x5'))['db'];var utils=require(_0x97f7('0x6'));var logger=require('../../config/logger')(_0x97f7('0x7'));var config=require('../../config/environment');var jayson=require(_0x97f7('0x8'));var client=jayson[_0x97f7('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5cc1b5,_0x41893c,_0x3f94f1){return new BPromise(function(_0x501055,_0x274d9f){return client[_0x97f7('0xa')](_0x5cc1b5,_0x3f94f1)[_0x97f7('0xb')](function(_0x56db61){logger[_0x97f7('0xc')](_0x97f7('0xd'),_0x41893c,_0x97f7('0xe'));logger[_0x97f7('0xf')](_0x97f7('0x10'),_0x41893c,_0x97f7('0xe'),JSON[_0x97f7('0x11')](_0x56db61));if(_0x56db61[_0x97f7('0x12')]){if(_0x56db61['error'][_0x97f7('0x13')]===0x1f4){logger[_0x97f7('0x12')](_0x97f7('0xd'),_0x41893c,_0x56db61['error'][_0x97f7('0x14')]);return _0x274d9f(_0x56db61[_0x97f7('0x12')][_0x97f7('0x14')]);}logger[_0x97f7('0x12')]('FaxQueueReport,\x20%s,\x20%s',_0x41893c,_0x56db61[_0x97f7('0x12')]['message']);return _0x501055(_0x56db61[_0x97f7('0x12')][_0x97f7('0x14')]);}else{logger['info'](_0x97f7('0xd'),_0x41893c,'request\x20sent');_0x501055(_0x56db61[_0x97f7('0x15')][_0x97f7('0x14')]);}})['catch'](function(_0x4cd3c0){logger['error']('FaxQueueReport,\x20%s,\x20%s',_0x41893c,_0x4cd3c0);_0x274d9f(_0x4cd3c0);});});}exports['CreateFaxQueueReport']=function(_0x4f537f){var _0x580325=this;return new Promise(function(_0x1bbee0,_0x22e057){return db['FaxQueueReport']['create'](_0x4f537f[_0x97f7('0x16')],{'raw':_0x4f537f[_0x97f7('0x17')]?_0x4f537f[_0x97f7('0x17')][_0x97f7('0x18')]===undefined?!![]:![]:!![]})[_0x97f7('0xb')](function(_0x56cb8b){logger[_0x97f7('0xc')](_0x97f7('0x19'),_0x4f537f);logger[_0x97f7('0xf')]('CreateFaxQueueReport',_0x4f537f,JSON[_0x97f7('0x11')](_0x56cb8b));_0x1bbee0(_0x56cb8b);})[_0x97f7('0x1a')](function(_0x55f7ef){logger[_0x97f7('0x12')](_0x97f7('0x19'),_0x55f7ef[_0x97f7('0x14')],_0x4f537f);_0x22e057(_0x580325[_0x97f7('0x12')](0x1f4,_0x55f7ef[_0x97f7('0x14')]));});});};exports[_0x97f7('0x1b')]=function(_0x204539){var _0x17920c=this;return new Promise(function(_0x2e22d3,_0x59e476){return db[_0x97f7('0x1c')][_0x97f7('0x1d')](_0x204539[_0x97f7('0x16')],{'raw':_0x204539['options']?_0x204539[_0x97f7('0x17')][_0x97f7('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x204539[_0x97f7('0x17')]?_0x204539['options'][_0x97f7('0x1e')]||null:null,'attributes':_0x204539[_0x97f7('0x17')]?_0x204539[_0x97f7('0x17')][_0x97f7('0x1f')]||null:null,'limit':_0x204539[_0x97f7('0x17')]?_0x204539[_0x97f7('0x17')][_0x97f7('0x20')]||null:null})[_0x97f7('0xb')](function(_0x403917){logger[_0x97f7('0xc')](_0x97f7('0x1b'),_0x204539);logger[_0x97f7('0xf')](_0x97f7('0x1b'),_0x204539,JSON[_0x97f7('0x11')](_0x403917));_0x2e22d3(_0x403917);})[_0x97f7('0x1a')](function(_0x2b9e07){logger[_0x97f7('0x12')](_0x97f7('0x1b'),_0x2b9e07[_0x97f7('0x14')],_0x204539);_0x59e476(_0x17920c[_0x97f7('0x12')](0x1f4,_0x2b9e07[_0x97f7('0x14')]));});});};