Built motion from commit (unavailable).|2.5.13
[motion2.git] / server / api / smsQueueReport / smsQueueReport.controller.js
index 073d5c9..3398d63 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x29f7=['query','filters','intersection','attributes','fields','length','hasOwnProperty','limit','order','sort','filter','where','merge','type','count','includeAll','findAll','rows','show','params','keys','include','options','create','body','catch','find','describe','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','offset','Content-Range','json','apply','save','update','then','destroy','error','stack','name','index','map','SmsQueueReport','rawAttributes','key','model'];(function(_0x2299e8,_0x3e4063){var _0x433c0e=function(_0x43f27e){while(--_0x43f27e){_0x2299e8['push'](_0x2299e8['shift']());}};_0x433c0e(++_0x3e4063);}(_0x29f7,0x100));var _0x729f=function(_0x326845,_0x152fef){_0x326845=_0x326845-0x0;var _0x52c03c=_0x29f7[_0x326845];return _0x52c03c;};'use strict';var pdf=require(_0x729f('0x0'));var emlformat=require(_0x729f('0x1'));var rimraf=require(_0x729f('0x2'));var zipdir=require(_0x729f('0x3'));var jsonpatch=require(_0x729f('0x4'));var rp=require(_0x729f('0x5'));var moment=require(_0x729f('0x6'));var BPromise=require(_0x729f('0x7'));var Mustache=require('mustache');var util=require(_0x729f('0x8'));var path=require(_0x729f('0x9'));var sox=require(_0x729f('0xa'));var csv=require(_0x729f('0xb'));var ejs=require(_0x729f('0xc'));var fs=require('fs');var _=require(_0x729f('0xd'));var squel=require(_0x729f('0xe'));var crypto=require(_0x729f('0xf'));var jsforce=require(_0x729f('0x10'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x729f('0x11'));var Papa=require(_0x729f('0x12'));var Redis=require(_0x729f('0x13'));var authService=require(_0x729f('0x14'));var qs=require(_0x729f('0x15'));var as=require(_0x729f('0x16'));var hardwareService=require(_0x729f('0x17'));var logger=require(_0x729f('0x18'))('api');var utils=require(_0x729f('0x19'));var config=require(_0x729f('0x1a'));var licenseUtil=require(_0x729f('0x1b'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x62f621,_0x5ea3d2){_0x5ea3d2=_0x5ea3d2||0xcc;return function(_0x22602f){if(_0x22602f){return _0x62f621[_0x729f('0x1c')](_0x5ea3d2);}return _0x62f621[_0x729f('0x1d')](_0x5ea3d2)[_0x729f('0x1e')]();};}function respondWithResult(_0x460e36,_0xea50c8){_0xea50c8=_0xea50c8||0xc8;return function(_0x311307){if(_0x311307){return _0x460e36['status'](_0xea50c8)['json'](_0x311307);}};}function respondWithFilteredResult(_0x5df47e,_0x5bb447){return function(_0x50f383){if(_0x50f383){var _0x45784b=_0x50f383['count'],_0x431425=_0x5bb447[_0x729f('0x1f')],_0x54d499=_0x5bb447[_0x729f('0x1f')]+_0x5bb447['limit'],_0x571be2;if(_0x54d499>=_0x45784b){_0x54d499=_0x45784b;_0x571be2=0xc8;}else{_0x571be2=0xce;}_0x5df47e[_0x729f('0x1d')](_0x571be2);return _0x5df47e['set'](_0x729f('0x20'),_0x431425+'-'+_0x54d499+'/'+_0x45784b)[_0x729f('0x21')](_0x50f383);}return null;};}function patchUpdates(_0x4abd88){return function(_0x406f52){try{jsonpatch[_0x729f('0x22')](_0x406f52,_0x4abd88,!![]);}catch(_0x32aa56){return BPromise['reject'](_0x32aa56);}return _0x406f52[_0x729f('0x23')]();};}function saveUpdates(_0x3b3ec6,_0xd35dc7){return function(_0x4fa035){if(_0x4fa035){return _0x4fa035[_0x729f('0x24')](_0x3b3ec6)[_0x729f('0x25')](function(_0xfff375){return _0xfff375;});}return null;};}function removeEntity(_0x29ce84,_0x4a21c7){return function(_0x25b9ad){if(_0x25b9ad){return _0x25b9ad[_0x729f('0x26')]()['then'](function(){_0x29ce84[_0x729f('0x1d')](0xcc)[_0x729f('0x1e')]();});}};}function handleEntityNotFound(_0x5b7df0,_0x1af913){return function(_0x20b34b){if(!_0x20b34b){_0x5b7df0['sendStatus'](0x194);}return _0x20b34b;};}function handleError(_0x55b94e,_0x2ec525){_0x2ec525=_0x2ec525||0x1f4;return function(_0x472a99){logger[_0x729f('0x27')](_0x472a99[_0x729f('0x28')]);if(_0x472a99[_0x729f('0x29')]){delete _0x472a99[_0x729f('0x29')];}_0x55b94e[_0x729f('0x1d')](_0x2ec525)['send'](_0x472a99);};}exports[_0x729f('0x2a')]=function(_0x41b130,_0x56f88c){var _0x240b1c={},_0x374c15={},_0x4b9782={'count':0x0,'rows':[]};var _0x5df10a=_[_0x729f('0x2b')](db[_0x729f('0x2c')][_0x729f('0x2d')],function(_0x39e207){return{'name':_0x39e207['fieldName'],'type':_0x39e207['type'][_0x729f('0x2e')]};});_0x374c15[_0x729f('0x2f')]=_[_0x729f('0x2b')](_0x5df10a,_0x729f('0x29'));_0x374c15[_0x729f('0x30')]=_['keys'](_0x41b130['query']);_0x374c15[_0x729f('0x31')]=_[_0x729f('0x32')](_0x374c15['model'],_0x374c15[_0x729f('0x30')]);_0x240b1c[_0x729f('0x33')]=_['intersection'](_0x374c15[_0x729f('0x2f')],qs['fields'](_0x41b130[_0x729f('0x30')][_0x729f('0x34')]));_0x240b1c[_0x729f('0x33')]=_0x240b1c['attributes'][_0x729f('0x35')]?_0x240b1c[_0x729f('0x33')]:_0x374c15[_0x729f('0x2f')];if(!_0x41b130[_0x729f('0x30')][_0x729f('0x36')]('nolimit')){_0x240b1c[_0x729f('0x37')]=qs[_0x729f('0x37')](_0x41b130[_0x729f('0x30')][_0x729f('0x37')]);_0x240b1c['offset']=qs[_0x729f('0x1f')](_0x41b130[_0x729f('0x30')][_0x729f('0x1f')]);}_0x240b1c[_0x729f('0x38')]=qs[_0x729f('0x39')](_0x41b130[_0x729f('0x30')][_0x729f('0x39')]);_0x240b1c['where']=qs[_0x729f('0x31')](_['pick'](_0x41b130[_0x729f('0x30')],_0x374c15[_0x729f('0x31')]),_0x5df10a);if(_0x41b130[_0x729f('0x30')][_0x729f('0x3a')]){_0x240b1c[_0x729f('0x3b')]=_[_0x729f('0x3c')](_0x240b1c[_0x729f('0x3b')],{'$or':_['map'](_0x5df10a,function(_0x159fbb){if(_0x159fbb[_0x729f('0x3d')]!=='VIRTUAL'){var _0xccf081={};_0xccf081[_0x159fbb['name']]={'$like':'%'+_0x41b130['query'][_0x729f('0x3a')]+'%'};return _0xccf081;}})});}_0x240b1c=_[_0x729f('0x3c')]({},_0x240b1c,_0x41b130['options']);var _0x2e8871={'where':_0x240b1c[_0x729f('0x3b')]};return db[_0x729f('0x2c')][_0x729f('0x3e')](_0x2e8871)[_0x729f('0x25')](function(_0x5da035){_0x4b9782['count']=_0x5da035;if(_0x41b130[_0x729f('0x30')][_0x729f('0x3f')]){_0x240b1c['include']=[{'all':!![]}];}return db['SmsQueueReport'][_0x729f('0x40')](_0x240b1c);})[_0x729f('0x25')](function(_0xecf853){_0x4b9782[_0x729f('0x41')]=_0xecf853;return _0x4b9782;})[_0x729f('0x25')](respondWithFilteredResult(_0x56f88c,_0x240b1c))['catch'](handleError(_0x56f88c,null));};exports[_0x729f('0x42')]=function(_0x5d8ec5,_0x384c6a){var _0x6165f2={'raw':!![],'where':{'id':_0x5d8ec5[_0x729f('0x43')]['id']}},_0x40a5b7={};_0x40a5b7[_0x729f('0x2f')]=_[_0x729f('0x44')](db[_0x729f('0x2c')][_0x729f('0x2d')]);_0x40a5b7[_0x729f('0x30')]=_[_0x729f('0x44')](_0x5d8ec5[_0x729f('0x30')]);_0x40a5b7[_0x729f('0x31')]=_[_0x729f('0x32')](_0x40a5b7[_0x729f('0x2f')],_0x40a5b7[_0x729f('0x30')]);_0x6165f2[_0x729f('0x33')]=_['intersection'](_0x40a5b7[_0x729f('0x2f')],qs['fields'](_0x5d8ec5[_0x729f('0x30')][_0x729f('0x34')]));_0x6165f2['attributes']=_0x6165f2[_0x729f('0x33')][_0x729f('0x35')]?_0x6165f2[_0x729f('0x33')]:_0x40a5b7['model'];if(_0x5d8ec5[_0x729f('0x30')][_0x729f('0x3f')]){_0x6165f2[_0x729f('0x45')]=[{'all':!![]}];}_0x6165f2=_[_0x729f('0x3c')]({},_0x6165f2,_0x5d8ec5[_0x729f('0x46')]);return db[_0x729f('0x2c')]['find'](_0x6165f2)['then'](handleEntityNotFound(_0x384c6a,null))[_0x729f('0x25')](respondWithResult(_0x384c6a,null))['catch'](handleError(_0x384c6a,null));};exports[_0x729f('0x47')]=function(_0x44f32d,_0x212d2f){return db[_0x729f('0x2c')][_0x729f('0x47')](_0x44f32d[_0x729f('0x48')],{})[_0x729f('0x25')](respondWithResult(_0x212d2f,0xc9))[_0x729f('0x49')](handleError(_0x212d2f,null));};exports[_0x729f('0x24')]=function(_0x372e2f,_0x377124){if(_0x372e2f[_0x729f('0x48')]['id']){delete _0x372e2f[_0x729f('0x48')]['id'];}return db['SmsQueueReport'][_0x729f('0x4a')]({'where':{'id':_0x372e2f[_0x729f('0x43')]['id']}})[_0x729f('0x25')](handleEntityNotFound(_0x377124,null))[_0x729f('0x25')](saveUpdates(_0x372e2f[_0x729f('0x48')],null))[_0x729f('0x25')](respondWithResult(_0x377124,null))[_0x729f('0x49')](handleError(_0x377124,null));};exports[_0x729f('0x26')]=function(_0x35f6f0,_0x3e2e50){return db[_0x729f('0x2c')][_0x729f('0x4a')]({'where':{'id':_0x35f6f0[_0x729f('0x43')]['id']}})[_0x729f('0x25')](handleEntityNotFound(_0x3e2e50,null))[_0x729f('0x25')](removeEntity(_0x3e2e50,null))[_0x729f('0x49')](handleError(_0x3e2e50,null));};exports[_0x729f('0x4b')]=function(_0x44ade0,_0x446b91){return db[_0x729f('0x2c')]['describe']()[_0x729f('0x25')](respondWithResult(_0x446b91,null))[_0x729f('0x49')](handleError(_0x446b91,null));};
\ No newline at end of file
+var _0x005b=['../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','count','offset','set','Content-Range','apply','save','update','then','destroy','error','stack','name','map','SmsQueueReport','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','limit','order','sort','pick','merge','where','VIRTUAL','filter','options','includeAll','include','findAll','rows','show','params','find','create','catch','body','describe','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','mustache','util','path','sox','ejs','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware'];(function(_0x211a02,_0x3b5362){var _0x13d91c=function(_0x559b49){while(--_0x559b49){_0x211a02['push'](_0x211a02['shift']());}};_0x13d91c(++_0x3b5362);}(_0x005b,0x1a7));var _0xb005=function(_0x3f58d8,_0x504f2b){_0x3f58d8=_0x3f58d8-0x0;var _0x2c6fe3=_0x005b[_0x3f58d8];return _0x2c6fe3;};'use strict';var pdf=require(_0xb005('0x0'));var emlformat=require(_0xb005('0x1'));var rimraf=require(_0xb005('0x2'));var zipdir=require(_0xb005('0x3'));var jsonpatch=require(_0xb005('0x4'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xb005('0x5'));var Mustache=require(_0xb005('0x6'));var util=require(_0xb005('0x7'));var path=require(_0xb005('0x8'));var sox=require(_0xb005('0x9'));var csv=require('to-csv');var ejs=require(_0xb005('0xa'));var fs=require('fs');var _=require('lodash');var squel=require(_0xb005('0xb'));var crypto=require(_0xb005('0xc'));var jsforce=require(_0xb005('0xd'));var deskjs=require(_0xb005('0xe'));var toCsv=require('to-csv');var querystring=require(_0xb005('0xf'));var Papa=require(_0xb005('0x10'));var Redis=require(_0xb005('0x11'));var authService=require(_0xb005('0x12'));var qs=require(_0xb005('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xb005('0x14'));var logger=require('../../config/logger')('api');var utils=require(_0xb005('0x15'));var config=require(_0xb005('0x16'));var licenseUtil=require(_0xb005('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3ec9c9,_0x3fbb09){_0x3fbb09=_0x3fbb09||0xcc;return function(_0x5a7939){if(_0x5a7939){return _0x3ec9c9[_0xb005('0x18')](_0x3fbb09);}return _0x3ec9c9[_0xb005('0x19')](_0x3fbb09)[_0xb005('0x1a')]();};}function respondWithResult(_0x467e2d,_0x2066a5){_0x2066a5=_0x2066a5||0xc8;return function(_0xab0fa){if(_0xab0fa){return _0x467e2d[_0xb005('0x19')](_0x2066a5)['json'](_0xab0fa);}};}function respondWithFilteredResult(_0x35ad51,_0x32e736){return function(_0x1c2fef){if(_0x1c2fef){var _0x4ec4e3=_0x1c2fef[_0xb005('0x1b')],_0x1f23d5=_0x32e736[_0xb005('0x1c')],_0x33e79d=_0x32e736[_0xb005('0x1c')]+_0x32e736['limit'],_0x1da2a0;if(_0x33e79d>=_0x4ec4e3){_0x33e79d=_0x4ec4e3;_0x1da2a0=0xc8;}else{_0x1da2a0=0xce;}_0x35ad51[_0xb005('0x19')](_0x1da2a0);return _0x35ad51[_0xb005('0x1d')](_0xb005('0x1e'),_0x1f23d5+'-'+_0x33e79d+'/'+_0x4ec4e3)['json'](_0x1c2fef);}return null;};}function patchUpdates(_0x3f9e44){return function(_0x577991){try{jsonpatch[_0xb005('0x1f')](_0x577991,_0x3f9e44,!![]);}catch(_0x47538b){return BPromise['reject'](_0x47538b);}return _0x577991[_0xb005('0x20')]();};}function saveUpdates(_0x3936cb,_0x5fa275){return function(_0x1b1a1b){if(_0x1b1a1b){return _0x1b1a1b[_0xb005('0x21')](_0x3936cb)[_0xb005('0x22')](function(_0x3b610d){return _0x3b610d;});}return null;};}function removeEntity(_0x2f1bda,_0x5e57a8){return function(_0x52c346){if(_0x52c346){return _0x52c346[_0xb005('0x23')]()[_0xb005('0x22')](function(){_0x2f1bda[_0xb005('0x19')](0xcc)[_0xb005('0x1a')]();});}};}function handleEntityNotFound(_0x301e91,_0x328cc9){return function(_0x358e90){if(!_0x358e90){_0x301e91[_0xb005('0x18')](0x194);}return _0x358e90;};}function handleError(_0x4b806d,_0x49312f){_0x49312f=_0x49312f||0x1f4;return function(_0x9b73b2){logger[_0xb005('0x24')](_0x9b73b2[_0xb005('0x25')]);if(_0x9b73b2[_0xb005('0x26')]){delete _0x9b73b2['name'];}_0x4b806d[_0xb005('0x19')](_0x49312f)['send'](_0x9b73b2);};}exports['index']=function(_0x1660b5,_0x4fef86){var _0x187d69={},_0x5d6b81={},_0x317b57={'count':0x0,'rows':[]};var _0x2004c2=_[_0xb005('0x27')](db[_0xb005('0x28')][_0xb005('0x29')],function(_0x8f62d2){return{'name':_0x8f62d2[_0xb005('0x2a')],'type':_0x8f62d2[_0xb005('0x2b')][_0xb005('0x2c')]};});_0x5d6b81[_0xb005('0x2d')]=_[_0xb005('0x27')](_0x2004c2,'name');_0x5d6b81[_0xb005('0x2e')]=_[_0xb005('0x2f')](_0x1660b5['query']);_0x5d6b81[_0xb005('0x30')]=_[_0xb005('0x31')](_0x5d6b81[_0xb005('0x2d')],_0x5d6b81[_0xb005('0x2e')]);_0x187d69[_0xb005('0x32')]=_['intersection'](_0x5d6b81['model'],qs[_0xb005('0x33')](_0x1660b5[_0xb005('0x2e')]['fields']));_0x187d69[_0xb005('0x32')]=_0x187d69[_0xb005('0x32')][_0xb005('0x34')]?_0x187d69[_0xb005('0x32')]:_0x5d6b81[_0xb005('0x2d')];if(!_0x1660b5[_0xb005('0x2e')][_0xb005('0x35')]('nolimit')){_0x187d69[_0xb005('0x36')]=qs[_0xb005('0x36')](_0x1660b5[_0xb005('0x2e')][_0xb005('0x36')]);_0x187d69[_0xb005('0x1c')]=qs[_0xb005('0x1c')](_0x1660b5[_0xb005('0x2e')][_0xb005('0x1c')]);}_0x187d69[_0xb005('0x37')]=qs['sort'](_0x1660b5[_0xb005('0x2e')][_0xb005('0x38')]);_0x187d69['where']=qs[_0xb005('0x30')](_[_0xb005('0x39')](_0x1660b5[_0xb005('0x2e')],_0x5d6b81['filters']),_0x2004c2);if(_0x1660b5[_0xb005('0x2e')]['filter']){_0x187d69['where']=_[_0xb005('0x3a')](_0x187d69[_0xb005('0x3b')],{'$or':_[_0xb005('0x27')](_0x2004c2,function(_0x3028ce){if(_0x3028ce[_0xb005('0x2b')]!==_0xb005('0x3c')){var _0x9c4ebb={};_0x9c4ebb[_0x3028ce['name']]={'$like':'%'+_0x1660b5[_0xb005('0x2e')][_0xb005('0x3d')]+'%'};return _0x9c4ebb;}})});}_0x187d69=_[_0xb005('0x3a')]({},_0x187d69,_0x1660b5[_0xb005('0x3e')]);var _0x5a688e={'where':_0x187d69[_0xb005('0x3b')]};return db[_0xb005('0x28')][_0xb005('0x1b')](_0x5a688e)[_0xb005('0x22')](function(_0x30e531){_0x317b57[_0xb005('0x1b')]=_0x30e531;if(_0x1660b5[_0xb005('0x2e')][_0xb005('0x3f')]){_0x187d69[_0xb005('0x40')]=[{'all':!![]}];}return db[_0xb005('0x28')][_0xb005('0x41')](_0x187d69);})[_0xb005('0x22')](function(_0x532c42){_0x317b57[_0xb005('0x42')]=_0x532c42;return _0x317b57;})[_0xb005('0x22')](respondWithFilteredResult(_0x4fef86,_0x187d69))['catch'](handleError(_0x4fef86,null));};exports[_0xb005('0x43')]=function(_0x117972,_0x416216){var _0x1450e0={'raw':!![],'where':{'id':_0x117972[_0xb005('0x44')]['id']}},_0x3f9225={};_0x3f9225[_0xb005('0x2d')]=_['keys'](db['SmsQueueReport']['rawAttributes']);_0x3f9225['query']=_[_0xb005('0x2f')](_0x117972[_0xb005('0x2e')]);_0x3f9225[_0xb005('0x30')]=_['intersection'](_0x3f9225['model'],_0x3f9225[_0xb005('0x2e')]);_0x1450e0['attributes']=_[_0xb005('0x31')](_0x3f9225[_0xb005('0x2d')],qs[_0xb005('0x33')](_0x117972[_0xb005('0x2e')]['fields']));_0x1450e0['attributes']=_0x1450e0[_0xb005('0x32')][_0xb005('0x34')]?_0x1450e0[_0xb005('0x32')]:_0x3f9225['model'];if(_0x117972[_0xb005('0x2e')][_0xb005('0x3f')]){_0x1450e0[_0xb005('0x40')]=[{'all':!![]}];}_0x1450e0=_[_0xb005('0x3a')]({},_0x1450e0,_0x117972[_0xb005('0x3e')]);return db[_0xb005('0x28')][_0xb005('0x45')](_0x1450e0)['then'](handleEntityNotFound(_0x416216,null))[_0xb005('0x22')](respondWithResult(_0x416216,null))['catch'](handleError(_0x416216,null));};exports[_0xb005('0x46')]=function(_0x1ce954,_0x178a8f){return db[_0xb005('0x28')][_0xb005('0x46')](_0x1ce954['body'],{})[_0xb005('0x22')](respondWithResult(_0x178a8f,0xc9))[_0xb005('0x47')](handleError(_0x178a8f,null));};exports[_0xb005('0x21')]=function(_0x139811,_0x17670d){if(_0x139811[_0xb005('0x48')]['id']){delete _0x139811[_0xb005('0x48')]['id'];}return db[_0xb005('0x28')][_0xb005('0x45')]({'where':{'id':_0x139811[_0xb005('0x44')]['id']}})['then'](handleEntityNotFound(_0x17670d,null))[_0xb005('0x22')](saveUpdates(_0x139811[_0xb005('0x48')],null))['then'](respondWithResult(_0x17670d,null))[_0xb005('0x47')](handleError(_0x17670d,null));};exports[_0xb005('0x23')]=function(_0x11f674,_0x2cbf69){return db[_0xb005('0x28')][_0xb005('0x45')]({'where':{'id':_0x11f674['params']['id']}})[_0xb005('0x22')](handleEntityNotFound(_0x2cbf69,null))[_0xb005('0x22')](removeEntity(_0x2cbf69,null))[_0xb005('0x47')](handleError(_0x2cbf69,null));};exports[_0xb005('0x49')]=function(_0x1c32b5,_0x2f46e1){return db[_0xb005('0x28')][_0xb005('0x49')]()[_0xb005('0x22')](respondWithResult(_0x2f46e1,null))[_0xb005('0x47')](handleError(_0x2f46e1,null));};
\ No newline at end of file