Built motion from commit (unavailable).|2.4.2
[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 _0xbecf=['../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','debug','FaxQueueReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','FaxQueueReport,\x20%s,\x20%s','message','result','catch','CreateFaxQueueReport','FaxQueueReport','create','raw','options','where','attributes','limit','info','UpdateFaxQueueReport','moment','bluebird','randomstring','ioredis'];(function(_0x5e959e,_0x35b453){var _0x2a7611=function(_0x5d9683){while(--_0x5d9683){_0x5e959e['push'](_0x5e959e['shift']());}};_0x2a7611(++_0x35b453);}(_0xbecf,0x15c));var _0xfbec=function(_0x188047,_0x148f85){_0x188047=_0x188047-0x0;var _0x56c1a1=_0xbecf[_0x188047];return _0x56c1a1;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xfbec('0x0'));var BPromise=require(_0xfbec('0x1'));var rs=require(_0xfbec('0x2'));var fs=require('fs');var Redis=require(_0xfbec('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xfbec('0x4'));var logger=require(_0xfbec('0x5'))(_0xfbec('0x6'));var config=require(_0xfbec('0x7'));var jayson=require(_0xfbec('0x8'));var client=jayson['client'][_0xfbec('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x34a717,_0x33c701,_0x410cab){return new BPromise(function(_0x43bc5b,_0x312ad1){return client[_0xfbec('0xa')](_0x34a717,_0x410cab)[_0xfbec('0xb')](function(_0x21863f){logger['info']('FaxQueueReport,\x20%s,\x20%s',_0x33c701,'request\x20sent');logger[_0xfbec('0xc')](_0xfbec('0xd'),_0x33c701,_0xfbec('0xe'),JSON[_0xfbec('0xf')](_0x21863f));if(_0x21863f[_0xfbec('0x10')]){if(_0x21863f['error'][_0xfbec('0x11')]===0x1f4){logger[_0xfbec('0x10')](_0xfbec('0x12'),_0x33c701,_0x21863f[_0xfbec('0x10')]['message']);return _0x312ad1(_0x21863f[_0xfbec('0x10')][_0xfbec('0x13')]);}logger[_0xfbec('0x10')](_0xfbec('0x12'),_0x33c701,_0x21863f['error'][_0xfbec('0x13')]);return _0x43bc5b(_0x21863f['error'][_0xfbec('0x13')]);}else{logger['info'](_0xfbec('0x12'),_0x33c701,_0xfbec('0xe'));_0x43bc5b(_0x21863f[_0xfbec('0x14')]['message']);}})[_0xfbec('0x15')](function(_0x2a3329){logger[_0xfbec('0x10')]('FaxQueueReport,\x20%s,\x20%s',_0x33c701,_0x2a3329);_0x312ad1(_0x2a3329);});});}exports[_0xfbec('0x16')]=function(_0x267a4b){var _0x259874=this;return new Promise(function(_0x6fc8f,_0x42a6cf){return db[_0xfbec('0x17')][_0xfbec('0x18')](_0x267a4b['body'],{'raw':_0x267a4b['options']?_0x267a4b['options'][_0xfbec('0x19')]===undefined?!![]:![]:!![]})[_0xfbec('0xb')](function(_0x2c2007){logger['info'](_0xfbec('0x16'),_0x267a4b);logger[_0xfbec('0xc')]('CreateFaxQueueReport',_0x267a4b,JSON[_0xfbec('0xf')](_0x2c2007));_0x6fc8f(_0x2c2007);})[_0xfbec('0x15')](function(_0x54a20f){logger[_0xfbec('0x10')](_0xfbec('0x16'),_0x54a20f[_0xfbec('0x13')],_0x267a4b);_0x42a6cf(_0x259874[_0xfbec('0x10')](0x1f4,_0x54a20f[_0xfbec('0x13')]));});});};exports['UpdateFaxQueueReport']=function(_0x2e172e){var _0x4bc10a=this;return new Promise(function(_0x1bed47,_0x1c9a07){return db['FaxQueueReport']['update'](_0x2e172e['body'],{'raw':_0x2e172e[_0xfbec('0x1a')]?_0x2e172e[_0xfbec('0x1a')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2e172e[_0xfbec('0x1a')]?_0x2e172e[_0xfbec('0x1a')][_0xfbec('0x1b')]||null:null,'attributes':_0x2e172e['options']?_0x2e172e[_0xfbec('0x1a')][_0xfbec('0x1c')]||null:null,'limit':_0x2e172e[_0xfbec('0x1a')]?_0x2e172e[_0xfbec('0x1a')][_0xfbec('0x1d')]||null:null})[_0xfbec('0xb')](function(_0x4aff99){logger[_0xfbec('0x1e')](_0xfbec('0x1f'),_0x2e172e);logger[_0xfbec('0xc')](_0xfbec('0x1f'),_0x2e172e,JSON[_0xfbec('0xf')](_0x4aff99));_0x1bed47(_0x4aff99);})[_0xfbec('0x15')](function(_0x41b4cf){logger['error'](_0xfbec('0x1f'),_0x41b4cf['message'],_0x2e172e);_0x1c9a07(_0x4bc10a['error'](0x1f4,_0x41b4cf['message']));});});};