Built motion from commit 9d0783e6.|2.6.13
[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 _0xa393=['rpc','../../config/environment','client','http','request','then','FaxQueueReport,\x20%s,\x20%s','request\x20sent','debug','FaxQueueReport,\x20%s,\x20%s,\x20%s','error','code','message','info','result','catch','CreateFaxQueueReport','create','options','raw','stringify','UpdateFaxQueueReport','FaxQueueReport','update','body','where','attributes','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x320b7b,_0x1e2ea0){var _0x2ff108=function(_0x2fb1f7){while(--_0x2fb1f7){_0x320b7b['push'](_0x320b7b['shift']());}};_0x2ff108(++_0x1e2ea0);}(_0xa393,0xed));var _0x3a39=function(_0xfae23b,_0x2be4ba){_0xfae23b=_0xfae23b-0x0;var _0x200640=_0xa393[_0xfae23b];return _0x200640;};'use strict';var _=require(_0x3a39('0x0'));var util=require(_0x3a39('0x1'));var moment=require(_0x3a39('0x2'));var BPromise=require(_0x3a39('0x3'));var rs=require(_0x3a39('0x4'));var fs=require('fs');var Redis=require(_0x3a39('0x5'));var db=require(_0x3a39('0x6'))['db'];var utils=require(_0x3a39('0x7'));var logger=require('../../config/logger')(_0x3a39('0x8'));var config=require(_0x3a39('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x3a39('0xa')][_0x3a39('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x29d1fb,_0xc1830e,_0x4bb0f9){return new BPromise(function(_0x1caf0b,_0x12be3a){return client[_0x3a39('0xc')](_0x29d1fb,_0x4bb0f9)[_0x3a39('0xd')](function(_0x117ce3){logger['info'](_0x3a39('0xe'),_0xc1830e,_0x3a39('0xf'));logger[_0x3a39('0x10')](_0x3a39('0x11'),_0xc1830e,_0x3a39('0xf'),JSON['stringify'](_0x117ce3));if(_0x117ce3[_0x3a39('0x12')]){if(_0x117ce3[_0x3a39('0x12')][_0x3a39('0x13')]===0x1f4){logger[_0x3a39('0x12')](_0x3a39('0xe'),_0xc1830e,_0x117ce3[_0x3a39('0x12')]['message']);return _0x12be3a(_0x117ce3[_0x3a39('0x12')][_0x3a39('0x14')]);}logger[_0x3a39('0x12')]('FaxQueueReport,\x20%s,\x20%s',_0xc1830e,_0x117ce3[_0x3a39('0x12')][_0x3a39('0x14')]);return _0x1caf0b(_0x117ce3[_0x3a39('0x12')]['message']);}else{logger[_0x3a39('0x15')](_0x3a39('0xe'),_0xc1830e,_0x3a39('0xf'));_0x1caf0b(_0x117ce3[_0x3a39('0x16')][_0x3a39('0x14')]);}})[_0x3a39('0x17')](function(_0x5139f6){logger[_0x3a39('0x12')](_0x3a39('0xe'),_0xc1830e,_0x5139f6);_0x12be3a(_0x5139f6);});});}exports[_0x3a39('0x18')]=function(_0x18375f){var _0x290918=this;return new Promise(function(_0x1d0e5c,_0x591187){return db['FaxQueueReport'][_0x3a39('0x19')](_0x18375f['body'],{'raw':_0x18375f[_0x3a39('0x1a')]?_0x18375f[_0x3a39('0x1a')][_0x3a39('0x1b')]===undefined?!![]:![]:!![]})[_0x3a39('0xd')](function(_0x1d50ff){logger[_0x3a39('0x15')]('CreateFaxQueueReport',_0x18375f);logger[_0x3a39('0x10')]('CreateFaxQueueReport',_0x18375f,JSON[_0x3a39('0x1c')](_0x1d50ff));_0x1d0e5c(_0x1d50ff);})[_0x3a39('0x17')](function(_0x1c18ea){logger[_0x3a39('0x12')]('CreateFaxQueueReport',_0x1c18ea['message'],_0x18375f);_0x591187(_0x290918[_0x3a39('0x12')](0x1f4,_0x1c18ea['message']));});});};exports[_0x3a39('0x1d')]=function(_0x5c1622){var _0x5a3578=this;return new Promise(function(_0x5829b1,_0x240fb7){return db[_0x3a39('0x1e')][_0x3a39('0x1f')](_0x5c1622[_0x3a39('0x20')],{'raw':_0x5c1622['options']?_0x5c1622[_0x3a39('0x1a')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5c1622[_0x3a39('0x1a')]?_0x5c1622['options'][_0x3a39('0x21')]||null:null,'attributes':_0x5c1622[_0x3a39('0x1a')]?_0x5c1622[_0x3a39('0x1a')][_0x3a39('0x22')]||null:null,'limit':_0x5c1622[_0x3a39('0x1a')]?_0x5c1622['options']['limit']||null:null})[_0x3a39('0xd')](function(_0x544a21){logger[_0x3a39('0x15')](_0x3a39('0x1d'),_0x5c1622);logger['debug']('UpdateFaxQueueReport',_0x5c1622,JSON[_0x3a39('0x1c')](_0x544a21));_0x5829b1(_0x544a21);})[_0x3a39('0x17')](function(_0x5dc3e3){logger[_0x3a39('0x12')](_0x3a39('0x1d'),_0x5dc3e3[_0x3a39('0x14')],_0x5c1622);_0x240fb7(_0x5a3578[_0x3a39('0x12')](0x1f4,_0x5dc3e3['message']));});});};