Built motion from commit (unavailable).|2.5.13
[motion2.git] / server / api / mailQueueReport / mailQueueReport.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 _0x1add=['../../config/environment','jayson/promise','http','request','then','MailQueueReport,\x20%s,\x20%s','request\x20sent','debug','MailQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','catch','CreateMailQueueReport','MailQueueReport','body','options','raw','UpdateMailQueueReport','update','attributes','lodash','moment','randomstring','ioredis','../../config/logger','rpc'];(function(_0x73a1c5,_0x50ce98){var _0x403ed4=function(_0x4bfc84){while(--_0x4bfc84){_0x73a1c5['push'](_0x73a1c5['shift']());}};_0x403ed4(++_0x50ce98);}(_0x1add,0x173));var _0xd1ad=function(_0x4cd40d,_0xedfae7){_0x4cd40d=_0x4cd40d-0x0;var _0x364c64=_0x1add[_0x4cd40d];return _0x364c64;};'use strict';var _=require(_0xd1ad('0x0'));var util=require('util');var moment=require(_0xd1ad('0x1'));var BPromise=require('bluebird');var rs=require(_0xd1ad('0x2'));var fs=require('fs');var Redis=require(_0xd1ad('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xd1ad('0x4'))(_0xd1ad('0x5'));var config=require(_0xd1ad('0x6'));var jayson=require(_0xd1ad('0x7'));var client=jayson['client'][_0xd1ad('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x4526d3,_0x137084,_0x45174a){return new BPromise(function(_0x5fa5ff,_0x5a4f95){return client[_0xd1ad('0x9')](_0x4526d3,_0x45174a)[_0xd1ad('0xa')](function(_0x1ca63a){logger['info'](_0xd1ad('0xb'),_0x137084,_0xd1ad('0xc'));logger[_0xd1ad('0xd')](_0xd1ad('0xe'),_0x137084,_0xd1ad('0xc'),JSON[_0xd1ad('0xf')](_0x1ca63a));if(_0x1ca63a[_0xd1ad('0x10')]){if(_0x1ca63a['error']['code']===0x1f4){logger[_0xd1ad('0x10')]('MailQueueReport,\x20%s,\x20%s',_0x137084,_0x1ca63a[_0xd1ad('0x10')]['message']);return _0x5a4f95(_0x1ca63a[_0xd1ad('0x10')][_0xd1ad('0x11')]);}logger[_0xd1ad('0x10')](_0xd1ad('0xb'),_0x137084,_0x1ca63a['error'][_0xd1ad('0x11')]);return _0x5fa5ff(_0x1ca63a[_0xd1ad('0x10')][_0xd1ad('0x11')]);}else{logger[_0xd1ad('0x12')](_0xd1ad('0xb'),_0x137084,_0xd1ad('0xc'));_0x5fa5ff(_0x1ca63a[_0xd1ad('0x13')][_0xd1ad('0x11')]);}})[_0xd1ad('0x14')](function(_0x5ef61b){logger[_0xd1ad('0x10')]('MailQueueReport,\x20%s,\x20%s',_0x137084,_0x5ef61b);_0x5a4f95(_0x5ef61b);});});}exports[_0xd1ad('0x15')]=function(_0x55289c){var _0x151659=this;return new Promise(function(_0x509632,_0x38b0a1){return db[_0xd1ad('0x16')]['create'](_0x55289c[_0xd1ad('0x17')],{'raw':_0x55289c[_0xd1ad('0x18')]?_0x55289c[_0xd1ad('0x18')][_0xd1ad('0x19')]===undefined?!![]:![]:!![]})[_0xd1ad('0xa')](function(_0x59e494){logger[_0xd1ad('0x12')]('CreateMailQueueReport',_0x55289c);logger[_0xd1ad('0xd')](_0xd1ad('0x15'),_0x55289c,JSON[_0xd1ad('0xf')](_0x59e494));_0x509632(_0x59e494);})[_0xd1ad('0x14')](function(_0x3095a9){logger[_0xd1ad('0x10')]('CreateMailQueueReport',_0x3095a9[_0xd1ad('0x11')],_0x55289c);_0x38b0a1(_0x151659[_0xd1ad('0x10')](0x1f4,_0x3095a9[_0xd1ad('0x11')]));});});};exports[_0xd1ad('0x1a')]=function(_0x39812e){var _0x3b3994=this;return new Promise(function(_0xaea0e0,_0xe37490){return db[_0xd1ad('0x16')][_0xd1ad('0x1b')](_0x39812e[_0xd1ad('0x17')],{'raw':_0x39812e[_0xd1ad('0x18')]?_0x39812e[_0xd1ad('0x18')][_0xd1ad('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x39812e[_0xd1ad('0x18')]?_0x39812e[_0xd1ad('0x18')]['where']||null:null,'attributes':_0x39812e['options']?_0x39812e[_0xd1ad('0x18')][_0xd1ad('0x1c')]||null:null,'limit':_0x39812e[_0xd1ad('0x18')]?_0x39812e[_0xd1ad('0x18')]['limit']||null:null})[_0xd1ad('0xa')](function(_0x14145b){logger[_0xd1ad('0x12')](_0xd1ad('0x1a'),_0x39812e);logger['debug'](_0xd1ad('0x1a'),_0x39812e,JSON['stringify'](_0x14145b));_0xaea0e0(_0x14145b);})[_0xd1ad('0x14')](function(_0x4ececd){logger['error'](_0xd1ad('0x1a'),_0x4ececd[_0xd1ad('0x11')],_0x39812e);_0xe37490(_0x3b3994[_0xd1ad('0x10')](0x1f4,_0x4ececd['message']));});});};