Built motion from commit e6806ed6.|2.6.0
[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 _0x9bbb=['../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','FaxQueueReport,\x20%s,\x20%s','request\x20sent','debug','FaxQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','FaxQueueReport','create','body','raw','CreateFaxQueueReport','catch','UpdateFaxQueueReport','update','options','lodash','util','moment','randomstring'];(function(_0x5aedf7,_0xb2ed87){var _0x2189b2=function(_0x20e81a){while(--_0x20e81a){_0x5aedf7['push'](_0x5aedf7['shift']());}};_0x2189b2(++_0xb2ed87);}(_0x9bbb,0xbc));var _0xb9bb=function(_0x217903,_0x26a26f){_0x217903=_0x217903-0x0;var _0x52fb3f=_0x9bbb[_0x217903];return _0x52fb3f;};'use strict';var _=require(_0xb9bb('0x0'));var util=require(_0xb9bb('0x1'));var moment=require(_0xb9bb('0x2'));var BPromise=require('bluebird');var rs=require(_0xb9bb('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xb9bb('0x4'))['db'];var utils=require(_0xb9bb('0x5'));var logger=require(_0xb9bb('0x6'))(_0xb9bb('0x7'));var config=require(_0xb9bb('0x8'));var jayson=require(_0xb9bb('0x9'));var client=jayson[_0xb9bb('0xa')][_0xb9bb('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x57d5a6,_0x113756,_0x274393){return new BPromise(function(_0xa6bd5d,_0x1ac589){return client['request'](_0x57d5a6,_0x274393)[_0xb9bb('0xc')](function(_0x15edfe){logger[_0xb9bb('0xd')](_0xb9bb('0xe'),_0x113756,_0xb9bb('0xf'));logger[_0xb9bb('0x10')](_0xb9bb('0x11'),_0x113756,_0xb9bb('0xf'),JSON[_0xb9bb('0x12')](_0x15edfe));if(_0x15edfe[_0xb9bb('0x13')]){if(_0x15edfe[_0xb9bb('0x13')][_0xb9bb('0x14')]===0x1f4){logger[_0xb9bb('0x13')](_0xb9bb('0xe'),_0x113756,_0x15edfe['error'][_0xb9bb('0x15')]);return _0x1ac589(_0x15edfe[_0xb9bb('0x13')]['message']);}logger['error']('FaxQueueReport,\x20%s,\x20%s',_0x113756,_0x15edfe[_0xb9bb('0x13')][_0xb9bb('0x15')]);return _0xa6bd5d(_0x15edfe[_0xb9bb('0x13')][_0xb9bb('0x15')]);}else{logger[_0xb9bb('0xd')](_0xb9bb('0xe'),_0x113756,_0xb9bb('0xf'));_0xa6bd5d(_0x15edfe[_0xb9bb('0x16')]['message']);}})['catch'](function(_0x3b5bdb){logger[_0xb9bb('0x13')](_0xb9bb('0xe'),_0x113756,_0x3b5bdb);_0x1ac589(_0x3b5bdb);});});}exports['CreateFaxQueueReport']=function(_0x27e94d){var _0x465302=this;return new Promise(function(_0x404c4f,_0x53d689){return db[_0xb9bb('0x17')][_0xb9bb('0x18')](_0x27e94d[_0xb9bb('0x19')],{'raw':_0x27e94d['options']?_0x27e94d['options'][_0xb9bb('0x1a')]===undefined?!![]:![]:!![]})[_0xb9bb('0xc')](function(_0x3da9bb){logger[_0xb9bb('0xd')](_0xb9bb('0x1b'),_0x27e94d);logger[_0xb9bb('0x10')](_0xb9bb('0x1b'),_0x27e94d,JSON['stringify'](_0x3da9bb));_0x404c4f(_0x3da9bb);})[_0xb9bb('0x1c')](function(_0x18850b){logger['error']('CreateFaxQueueReport',_0x18850b['message'],_0x27e94d);_0x53d689(_0x465302[_0xb9bb('0x13')](0x1f4,_0x18850b[_0xb9bb('0x15')]));});});};exports[_0xb9bb('0x1d')]=function(_0x14360f){var _0x8fb6c4=this;return new Promise(function(_0x50239b,_0x210a67){return db['FaxQueueReport'][_0xb9bb('0x1e')](_0x14360f['body'],{'raw':_0x14360f[_0xb9bb('0x1f')]?_0x14360f[_0xb9bb('0x1f')][_0xb9bb('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x14360f[_0xb9bb('0x1f')]?_0x14360f[_0xb9bb('0x1f')]['where']||null:null,'attributes':_0x14360f[_0xb9bb('0x1f')]?_0x14360f[_0xb9bb('0x1f')]['attributes']||null:null,'limit':_0x14360f[_0xb9bb('0x1f')]?_0x14360f['options']['limit']||null:null})[_0xb9bb('0xc')](function(_0x5786e1){logger[_0xb9bb('0xd')](_0xb9bb('0x1d'),_0x14360f);logger[_0xb9bb('0x10')]('UpdateFaxQueueReport',_0x14360f,JSON[_0xb9bb('0x12')](_0x5786e1));_0x50239b(_0x5786e1);})[_0xb9bb('0x1c')](function(_0x4db191){logger[_0xb9bb('0x13')](_0xb9bb('0x1d'),_0x4db191[_0xb9bb('0x15')],_0x14360f);_0x210a67(_0x8fb6c4[_0xb9bb('0x13')](0x1f4,_0x4db191[_0xb9bb('0x15')]));});});};