c75fd8ce394a6939c25a22ee24d9ad15e1e5a2ff
[motion2.git] / server / api / smsQueueReport / smsQueueReport.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 _0x6786=['moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','SmsQueueReport,\x20%s,\x20%s','request\x20sent','SmsQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','CreateSmsQueueReport','body','options','raw','debug','UpdateSmsQueueReport','SmsQueueReport','update','attributes','util'];(function(_0x347324,_0x3ced7f){var _0x21a3c9=function(_0x531c97){while(--_0x531c97){_0x347324['push'](_0x347324['shift']());}};_0x21a3c9(++_0x3ced7f);}(_0x6786,0x128));var _0x6678=function(_0x476b00,_0x250877){_0x476b00=_0x476b00-0x0;var _0x44ec8e=_0x6786[_0x476b00];return _0x44ec8e;};'use strict';var _=require('lodash');var util=require(_0x6678('0x0'));var moment=require(_0x6678('0x1'));var BPromise=require(_0x6678('0x2'));var rs=require(_0x6678('0x3'));var fs=require('fs');var Redis=require(_0x6678('0x4'));var db=require(_0x6678('0x5'))['db'];var utils=require(_0x6678('0x6'));var logger=require(_0x6678('0x7'))(_0x6678('0x8'));var config=require(_0x6678('0x9'));var jayson=require(_0x6678('0xa'));var client=jayson[_0x6678('0xb')][_0x6678('0xc')]({'port':0x232a});function respondWithRpcPromise(_0xb64b67,_0x3d1dd5,_0x1f05f0){return new BPromise(function(_0x4553a7,_0x1cb0ca){return client[_0x6678('0xd')](_0xb64b67,_0x1f05f0)[_0x6678('0xe')](function(_0x1ae0f0){logger[_0x6678('0xf')](_0x6678('0x10'),_0x3d1dd5,_0x6678('0x11'));logger['debug'](_0x6678('0x12'),_0x3d1dd5,_0x6678('0x11'),JSON[_0x6678('0x13')](_0x1ae0f0));if(_0x1ae0f0[_0x6678('0x14')]){if(_0x1ae0f0['error']['code']===0x1f4){logger[_0x6678('0x14')](_0x6678('0x10'),_0x3d1dd5,_0x1ae0f0[_0x6678('0x14')]['message']);return _0x1cb0ca(_0x1ae0f0[_0x6678('0x14')][_0x6678('0x15')]);}logger[_0x6678('0x14')](_0x6678('0x10'),_0x3d1dd5,_0x1ae0f0[_0x6678('0x14')][_0x6678('0x15')]);return _0x4553a7(_0x1ae0f0[_0x6678('0x14')][_0x6678('0x15')]);}else{logger[_0x6678('0xf')](_0x6678('0x10'),_0x3d1dd5,_0x6678('0x11'));_0x4553a7(_0x1ae0f0[_0x6678('0x16')][_0x6678('0x15')]);}})[_0x6678('0x17')](function(_0x3e2a3f){logger[_0x6678('0x14')](_0x6678('0x10'),_0x3d1dd5,_0x3e2a3f);_0x1cb0ca(_0x3e2a3f);});});}exports[_0x6678('0x18')]=function(_0x29a81b){var _0x199338=this;return new Promise(function(_0x404f5c,_0xf4b69d){return db['SmsQueueReport']['create'](_0x29a81b[_0x6678('0x19')],{'raw':_0x29a81b['options']?_0x29a81b[_0x6678('0x1a')][_0x6678('0x1b')]===undefined?!![]:![]:!![]})[_0x6678('0xe')](function(_0x3cdac0){logger[_0x6678('0xf')](_0x6678('0x18'),_0x29a81b);logger[_0x6678('0x1c')]('CreateSmsQueueReport',_0x29a81b,JSON[_0x6678('0x13')](_0x3cdac0));_0x404f5c(_0x3cdac0);})['catch'](function(_0x1e5791){logger[_0x6678('0x14')](_0x6678('0x18'),_0x1e5791['message'],_0x29a81b);_0xf4b69d(_0x199338[_0x6678('0x14')](0x1f4,_0x1e5791[_0x6678('0x15')]));});});};exports[_0x6678('0x1d')]=function(_0x2f1687){var _0x5df879=this;return new Promise(function(_0x6f91f5,_0x18acbc){return db[_0x6678('0x1e')][_0x6678('0x1f')](_0x2f1687['body'],{'raw':_0x2f1687[_0x6678('0x1a')]?_0x2f1687[_0x6678('0x1a')][_0x6678('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2f1687[_0x6678('0x1a')]?_0x2f1687['options']['where']||null:null,'attributes':_0x2f1687[_0x6678('0x1a')]?_0x2f1687[_0x6678('0x1a')][_0x6678('0x20')]||null:null,'limit':_0x2f1687[_0x6678('0x1a')]?_0x2f1687[_0x6678('0x1a')]['limit']||null:null})[_0x6678('0xe')](function(_0x490375){logger[_0x6678('0xf')](_0x6678('0x1d'),_0x2f1687);logger[_0x6678('0x1c')](_0x6678('0x1d'),_0x2f1687,JSON[_0x6678('0x13')](_0x490375));_0x6f91f5(_0x490375);})[_0x6678('0x17')](function(_0x3dcc4e){logger[_0x6678('0x14')]('UpdateSmsQueueReport',_0x3dcc4e[_0x6678('0x15')],_0x2f1687);_0x18acbc(_0x5df879[_0x6678('0x14')](0x1f4,_0x3dcc4e[_0x6678('0x15')]));});});};