0c9b9c2aa9fa1b52f55f9e642e1fdda2c6c4280a
[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 _0x0090=['util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','request','then','info','FaxQueueReport,\x20%s,\x20%s','debug','FaxQueueReport,\x20%s,\x20%s,\x20%s','request\x20sent','error','message','catch','CreateFaxQueueReport','FaxQueueReport','body','options','raw','stringify','UpdateFaxQueueReport','update','attributes','lodash'];(function(_0x5c2748,_0x564960){var _0x59761d=function(_0x1ccb1a){while(--_0x1ccb1a){_0x5c2748['push'](_0x5c2748['shift']());}};_0x59761d(++_0x564960);}(_0x0090,0x95));var _0x0009=function(_0x4657ec,_0x1822dd){_0x4657ec=_0x4657ec-0x0;var _0x317ba4=_0x0090[_0x4657ec];return _0x317ba4;};'use strict';var _=require(_0x0009('0x0'));var util=require(_0x0009('0x1'));var moment=require('moment');var BPromise=require(_0x0009('0x2'));var rs=require(_0x0009('0x3'));var fs=require('fs');var Redis=require(_0x0009('0x4'));var db=require(_0x0009('0x5'))['db'];var utils=require(_0x0009('0x6'));var logger=require(_0x0009('0x7'))(_0x0009('0x8'));var config=require(_0x0009('0x9'));var jayson=require(_0x0009('0xa'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x3dea46,_0x4316ac,_0x9ce951){return new BPromise(function(_0x90a8df,_0x271891){return client[_0x0009('0xb')](_0x3dea46,_0x9ce951)[_0x0009('0xc')](function(_0x8c37c4){logger[_0x0009('0xd')](_0x0009('0xe'),_0x4316ac,'request\x20sent');logger[_0x0009('0xf')](_0x0009('0x10'),_0x4316ac,_0x0009('0x11'),JSON['stringify'](_0x8c37c4));if(_0x8c37c4[_0x0009('0x12')]){if(_0x8c37c4['error']['code']===0x1f4){logger[_0x0009('0x12')](_0x0009('0xe'),_0x4316ac,_0x8c37c4[_0x0009('0x12')]['message']);return _0x271891(_0x8c37c4[_0x0009('0x12')][_0x0009('0x13')]);}logger[_0x0009('0x12')]('FaxQueueReport,\x20%s,\x20%s',_0x4316ac,_0x8c37c4['error'][_0x0009('0x13')]);return _0x90a8df(_0x8c37c4[_0x0009('0x12')][_0x0009('0x13')]);}else{logger[_0x0009('0xd')](_0x0009('0xe'),_0x4316ac,_0x0009('0x11'));_0x90a8df(_0x8c37c4['result'][_0x0009('0x13')]);}})[_0x0009('0x14')](function(_0x1a5018){logger[_0x0009('0x12')](_0x0009('0xe'),_0x4316ac,_0x1a5018);_0x271891(_0x1a5018);});});}exports[_0x0009('0x15')]=function(_0x4b0c9){var _0x4d81e1=this;return new Promise(function(_0x1daeca,_0x47a92e){return db[_0x0009('0x16')]['create'](_0x4b0c9[_0x0009('0x17')],{'raw':_0x4b0c9['options']?_0x4b0c9[_0x0009('0x18')][_0x0009('0x19')]===undefined?!![]:![]:!![]})['then'](function(_0x5befbb){logger[_0x0009('0xd')]('CreateFaxQueueReport',_0x4b0c9);logger[_0x0009('0xf')]('CreateFaxQueueReport',_0x4b0c9,JSON[_0x0009('0x1a')](_0x5befbb));_0x1daeca(_0x5befbb);})[_0x0009('0x14')](function(_0x2e2b5e){logger[_0x0009('0x12')](_0x0009('0x15'),_0x2e2b5e[_0x0009('0x13')],_0x4b0c9);_0x47a92e(_0x4d81e1[_0x0009('0x12')](0x1f4,_0x2e2b5e[_0x0009('0x13')]));});});};exports[_0x0009('0x1b')]=function(_0x7ca7ab){var _0x13b942=this;return new Promise(function(_0x513ff8,_0x114fee){return db[_0x0009('0x16')][_0x0009('0x1c')](_0x7ca7ab['body'],{'raw':_0x7ca7ab[_0x0009('0x18')]?_0x7ca7ab[_0x0009('0x18')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x7ca7ab[_0x0009('0x18')]?_0x7ca7ab['options']['where']||null:null,'attributes':_0x7ca7ab[_0x0009('0x18')]?_0x7ca7ab['options'][_0x0009('0x1d')]||null:null,'limit':_0x7ca7ab[_0x0009('0x18')]?_0x7ca7ab[_0x0009('0x18')]['limit']||null:null})[_0x0009('0xc')](function(_0x19919b){logger[_0x0009('0xd')](_0x0009('0x1b'),_0x7ca7ab);logger[_0x0009('0xf')]('UpdateFaxQueueReport',_0x7ca7ab,JSON[_0x0009('0x1a')](_0x19919b));_0x513ff8(_0x19919b);})[_0x0009('0x14')](function(_0x557dc8){logger[_0x0009('0x12')]('UpdateFaxQueueReport',_0x557dc8[_0x0009('0x13')],_0x7ca7ab);_0x114fee(_0x13b942[_0x0009('0x12')](0x1f4,_0x557dc8[_0x0009('0x13')]));});});};