Built motion from commit (unavailable).|2.4.20
[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 _0x0bb5=['error','message','request\x20sent','result','FaxQueueReport','body','options','raw','then','CreateFaxQueueReport','catch','UpdateFaxQueueReport','update','where','limit','stringify','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','info','FaxQueueReport,\x20%s,\x20%s','debug','FaxQueueReport,\x20%s,\x20%s,\x20%s'];(function(_0x7b064c,_0x54298e){var _0xa84678=function(_0x2e87a6){while(--_0x2e87a6){_0x7b064c['push'](_0x7b064c['shift']());}};_0xa84678(++_0x54298e);}(_0x0bb5,0x90));var _0x50bb=function(_0x172566,_0x32093c){_0x172566=_0x172566-0x0;var _0x43caa8=_0x0bb5[_0x172566];return _0x43caa8;};'use strict';var _=require('lodash');var util=require(_0x50bb('0x0'));var moment=require(_0x50bb('0x1'));var BPromise=require(_0x50bb('0x2'));var rs=require(_0x50bb('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x50bb('0x4'))['db'];var utils=require(_0x50bb('0x5'));var logger=require(_0x50bb('0x6'))('rpc');var config=require(_0x50bb('0x7'));var jayson=require(_0x50bb('0x8'));var client=jayson[_0x50bb('0x9')][_0x50bb('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xd0ab68,_0x4433a7,_0x415feb){return new BPromise(function(_0x219b1f,_0x5aba20){return client[_0x50bb('0xb')](_0xd0ab68,_0x415feb)['then'](function(_0x5f5b8e){logger[_0x50bb('0xc')](_0x50bb('0xd'),_0x4433a7,'request\x20sent');logger[_0x50bb('0xe')](_0x50bb('0xf'),_0x4433a7,'request\x20sent',JSON['stringify'](_0x5f5b8e));if(_0x5f5b8e[_0x50bb('0x10')]){if(_0x5f5b8e[_0x50bb('0x10')]['code']===0x1f4){logger[_0x50bb('0x10')](_0x50bb('0xd'),_0x4433a7,_0x5f5b8e['error'][_0x50bb('0x11')]);return _0x5aba20(_0x5f5b8e['error'][_0x50bb('0x11')]);}logger[_0x50bb('0x10')](_0x50bb('0xd'),_0x4433a7,_0x5f5b8e[_0x50bb('0x10')]['message']);return _0x219b1f(_0x5f5b8e['error'][_0x50bb('0x11')]);}else{logger[_0x50bb('0xc')]('FaxQueueReport,\x20%s,\x20%s',_0x4433a7,_0x50bb('0x12'));_0x219b1f(_0x5f5b8e[_0x50bb('0x13')][_0x50bb('0x11')]);}})['catch'](function(_0x142ddc){logger['error'](_0x50bb('0xd'),_0x4433a7,_0x142ddc);_0x5aba20(_0x142ddc);});});}exports['CreateFaxQueueReport']=function(_0x379597){var _0x28927e=this;return new Promise(function(_0x1255f0,_0x41dd3e){return db[_0x50bb('0x14')]['create'](_0x379597[_0x50bb('0x15')],{'raw':_0x379597[_0x50bb('0x16')]?_0x379597[_0x50bb('0x16')][_0x50bb('0x17')]===undefined?!![]:![]:!![]})[_0x50bb('0x18')](function(_0x2164bf){logger[_0x50bb('0xc')]('CreateFaxQueueReport',_0x379597);logger[_0x50bb('0xe')](_0x50bb('0x19'),_0x379597,JSON['stringify'](_0x2164bf));_0x1255f0(_0x2164bf);})[_0x50bb('0x1a')](function(_0x1d7f89){logger[_0x50bb('0x10')](_0x50bb('0x19'),_0x1d7f89[_0x50bb('0x11')],_0x379597);_0x41dd3e(_0x28927e['error'](0x1f4,_0x1d7f89[_0x50bb('0x11')]));});});};exports[_0x50bb('0x1b')]=function(_0x40b7ed){var _0x4e50db=this;return new Promise(function(_0x5333ed,_0x5000c6){return db['FaxQueueReport'][_0x50bb('0x1c')](_0x40b7ed[_0x50bb('0x15')],{'raw':_0x40b7ed['options']?_0x40b7ed[_0x50bb('0x16')][_0x50bb('0x17')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x40b7ed[_0x50bb('0x16')]?_0x40b7ed['options'][_0x50bb('0x1d')]||null:null,'attributes':_0x40b7ed[_0x50bb('0x16')]?_0x40b7ed['options']['attributes']||null:null,'limit':_0x40b7ed[_0x50bb('0x16')]?_0x40b7ed[_0x50bb('0x16')][_0x50bb('0x1e')]||null:null})['then'](function(_0x106c43){logger['info'](_0x50bb('0x1b'),_0x40b7ed);logger['debug'](_0x50bb('0x1b'),_0x40b7ed,JSON[_0x50bb('0x1f')](_0x106c43));_0x5333ed(_0x106c43);})[_0x50bb('0x1a')](function(_0xfd7918){logger['error'](_0x50bb('0x1b'),_0xfd7918['message'],_0x40b7ed);_0x5000c6(_0x4e50db[_0x50bb('0x10')](0x1f4,_0xfd7918[_0x50bb('0x11')]));});});};