Built motion from commit (unavailable).|2.5.20
[motion2.git] / server / api / smsQueueReport / smsQueueReport.controller.js
index 073d5c9..c1b7bf0 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 _0x025a=['includeAll','find','create','body','update','describe','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','then','destroy','sendStatus','error','stack','name','map','SmsQueueReport','rawAttributes','fieldName','type','key','model','query','keys','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','include','findAll','rows','catch','show','params'];(function(_0x1a1916,_0x2286ad){var _0xa7ee30=function(_0x49d253){while(--_0x49d253){_0x1a1916['push'](_0x1a1916['shift']());}};_0xa7ee30(++_0x2286ad);}(_0x025a,0x13e));var _0xa025=function(_0x5dc45d,_0x55f90f){_0x5dc45d=_0x5dc45d-0x0;var _0x4ce697=_0x025a[_0x5dc45d];return _0x4ce697;};'use strict';var pdf=require(_0xa025('0x0'));var emlformat=require(_0xa025('0x1'));var rimraf=require('rimraf');var zipdir=require(_0xa025('0x2'));var jsonpatch=require(_0xa025('0x3'));var rp=require(_0xa025('0x4'));var moment=require('moment');var BPromise=require(_0xa025('0x5'));var Mustache=require(_0xa025('0x6'));var util=require(_0xa025('0x7'));var path=require(_0xa025('0x8'));var sox=require(_0xa025('0x9'));var csv=require(_0xa025('0xa'));var ejs=require(_0xa025('0xb'));var fs=require('fs');var _=require('lodash');var squel=require(_0xa025('0xc'));var crypto=require(_0xa025('0xd'));var jsforce=require(_0xa025('0xe'));var deskjs=require(_0xa025('0xf'));var toCsv=require(_0xa025('0xa'));var querystring=require(_0xa025('0x10'));var Papa=require(_0xa025('0x11'));var Redis=require(_0xa025('0x12'));var authService=require(_0xa025('0x13'));var qs=require(_0xa025('0x14'));var as=require(_0xa025('0x15'));var hardwareService=require(_0xa025('0x16'));var logger=require('../../config/logger')(_0xa025('0x17'));var utils=require('../../config/utils');var config=require(_0xa025('0x18'));var licenseUtil=require(_0xa025('0x19'));var db=require(_0xa025('0x1a'))['db'];function respondWithStatusCode(_0x1b18fa,_0x1fffdb){_0x1fffdb=_0x1fffdb||0xcc;return function(_0x49f13f){if(_0x49f13f){return _0x1b18fa['sendStatus'](_0x1fffdb);}return _0x1b18fa[_0xa025('0x1b')](_0x1fffdb)[_0xa025('0x1c')]();};}function respondWithResult(_0x3db922,_0x202552){_0x202552=_0x202552||0xc8;return function(_0x11f037){if(_0x11f037){return _0x3db922['status'](_0x202552)[_0xa025('0x1d')](_0x11f037);}};}function respondWithFilteredResult(_0x40c22a,_0x17dd36){return function(_0x2a8af1){if(_0x2a8af1){var _0x4ee0f9=_0x2a8af1[_0xa025('0x1e')],_0xdc10d5=_0x17dd36[_0xa025('0x1f')],_0x123b0e=_0x17dd36[_0xa025('0x1f')]+_0x17dd36[_0xa025('0x20')],_0x416349;if(_0x123b0e>=_0x4ee0f9){_0x123b0e=_0x4ee0f9;_0x416349=0xc8;}else{_0x416349=0xce;}_0x40c22a[_0xa025('0x1b')](_0x416349);return _0x40c22a[_0xa025('0x21')](_0xa025('0x22'),_0xdc10d5+'-'+_0x123b0e+'/'+_0x4ee0f9)[_0xa025('0x1d')](_0x2a8af1);}return null;};}function patchUpdates(_0x158b40){return function(_0x3051a4){try{jsonpatch[_0xa025('0x23')](_0x3051a4,_0x158b40,!![]);}catch(_0x313f00){return BPromise[_0xa025('0x24')](_0x313f00);}return _0x3051a4[_0xa025('0x25')]();};}function saveUpdates(_0x170da8,_0x2ca09a){return function(_0x140b11){if(_0x140b11){return _0x140b11['update'](_0x170da8)[_0xa025('0x26')](function(_0x8390b6){return _0x8390b6;});}return null;};}function removeEntity(_0x4885f3,_0x5b9132){return function(_0x28db0b){if(_0x28db0b){return _0x28db0b[_0xa025('0x27')]()[_0xa025('0x26')](function(){_0x4885f3['status'](0xcc)[_0xa025('0x1c')]();});}};}function handleEntityNotFound(_0x8c0a78,_0x3a659b){return function(_0x186c25){if(!_0x186c25){_0x8c0a78[_0xa025('0x28')](0x194);}return _0x186c25;};}function handleError(_0x47d8d6,_0x127762){_0x127762=_0x127762||0x1f4;return function(_0x5d658c){logger[_0xa025('0x29')](_0x5d658c[_0xa025('0x2a')]);if(_0x5d658c['name']){delete _0x5d658c[_0xa025('0x2b')];}_0x47d8d6[_0xa025('0x1b')](_0x127762)['send'](_0x5d658c);};}exports['index']=function(_0x111477,_0x1632c0){var _0x44d5f1={},_0x1e629c={},_0x54d9fc={'count':0x0,'rows':[]};var _0x5f12dc=_[_0xa025('0x2c')](db[_0xa025('0x2d')][_0xa025('0x2e')],function(_0x1a6df0){return{'name':_0x1a6df0[_0xa025('0x2f')],'type':_0x1a6df0[_0xa025('0x30')][_0xa025('0x31')]};});_0x1e629c[_0xa025('0x32')]=_['map'](_0x5f12dc,_0xa025('0x2b'));_0x1e629c[_0xa025('0x33')]=_[_0xa025('0x34')](_0x111477[_0xa025('0x33')]);_0x1e629c['filters']=_[_0xa025('0x35')](_0x1e629c['model'],_0x1e629c[_0xa025('0x33')]);_0x44d5f1['attributes']=_[_0xa025('0x35')](_0x1e629c['model'],qs[_0xa025('0x36')](_0x111477['query']['fields']));_0x44d5f1[_0xa025('0x37')]=_0x44d5f1[_0xa025('0x37')][_0xa025('0x38')]?_0x44d5f1[_0xa025('0x37')]:_0x1e629c[_0xa025('0x32')];if(!_0x111477[_0xa025('0x33')][_0xa025('0x39')](_0xa025('0x3a'))){_0x44d5f1[_0xa025('0x20')]=qs[_0xa025('0x20')](_0x111477[_0xa025('0x33')][_0xa025('0x20')]);_0x44d5f1['offset']=qs[_0xa025('0x1f')](_0x111477[_0xa025('0x33')]['offset']);}_0x44d5f1[_0xa025('0x3b')]=qs[_0xa025('0x3c')](_0x111477[_0xa025('0x33')][_0xa025('0x3c')]);_0x44d5f1[_0xa025('0x3d')]=qs[_0xa025('0x3e')](_[_0xa025('0x3f')](_0x111477[_0xa025('0x33')],_0x1e629c[_0xa025('0x3e')]),_0x5f12dc);if(_0x111477['query']['filter']){_0x44d5f1['where']=_['merge'](_0x44d5f1[_0xa025('0x3d')],{'$or':_['map'](_0x5f12dc,function(_0x229d77){if(_0x229d77[_0xa025('0x30')]!=='VIRTUAL'){var _0x174bf8={};_0x174bf8[_0x229d77[_0xa025('0x2b')]]={'$like':'%'+_0x111477['query'][_0xa025('0x40')]+'%'};return _0x174bf8;}})});}_0x44d5f1=_[_0xa025('0x41')]({},_0x44d5f1,_0x111477['options']);var _0x14666e={'where':_0x44d5f1[_0xa025('0x3d')]};return db[_0xa025('0x2d')][_0xa025('0x1e')](_0x14666e)[_0xa025('0x26')](function(_0x4765e2){_0x54d9fc['count']=_0x4765e2;if(_0x111477[_0xa025('0x33')]['includeAll']){_0x44d5f1[_0xa025('0x42')]=[{'all':!![]}];}return db['SmsQueueReport'][_0xa025('0x43')](_0x44d5f1);})[_0xa025('0x26')](function(_0x1c507a){_0x54d9fc[_0xa025('0x44')]=_0x1c507a;return _0x54d9fc;})[_0xa025('0x26')](respondWithFilteredResult(_0x1632c0,_0x44d5f1))[_0xa025('0x45')](handleError(_0x1632c0,null));};exports[_0xa025('0x46')]=function(_0x21439b,_0x21894d){var _0x389c11={'raw':!![],'where':{'id':_0x21439b[_0xa025('0x47')]['id']}},_0x4ae6e9={};_0x4ae6e9[_0xa025('0x32')]=_[_0xa025('0x34')](db['SmsQueueReport'][_0xa025('0x2e')]);_0x4ae6e9['query']=_['keys'](_0x21439b[_0xa025('0x33')]);_0x4ae6e9['filters']=_['intersection'](_0x4ae6e9[_0xa025('0x32')],_0x4ae6e9[_0xa025('0x33')]);_0x389c11[_0xa025('0x37')]=_[_0xa025('0x35')](_0x4ae6e9[_0xa025('0x32')],qs[_0xa025('0x36')](_0x21439b[_0xa025('0x33')][_0xa025('0x36')]));_0x389c11['attributes']=_0x389c11[_0xa025('0x37')][_0xa025('0x38')]?_0x389c11[_0xa025('0x37')]:_0x4ae6e9[_0xa025('0x32')];if(_0x21439b[_0xa025('0x33')][_0xa025('0x48')]){_0x389c11[_0xa025('0x42')]=[{'all':!![]}];}_0x389c11=_['merge']({},_0x389c11,_0x21439b['options']);return db[_0xa025('0x2d')][_0xa025('0x49')](_0x389c11)[_0xa025('0x26')](handleEntityNotFound(_0x21894d,null))[_0xa025('0x26')](respondWithResult(_0x21894d,null))[_0xa025('0x45')](handleError(_0x21894d,null));};exports[_0xa025('0x4a')]=function(_0x228136,_0x43a693){return db[_0xa025('0x2d')][_0xa025('0x4a')](_0x228136[_0xa025('0x4b')],{})[_0xa025('0x26')](respondWithResult(_0x43a693,0xc9))[_0xa025('0x45')](handleError(_0x43a693,null));};exports[_0xa025('0x4c')]=function(_0x13c495,_0x2f2581){if(_0x13c495[_0xa025('0x4b')]['id']){delete _0x13c495[_0xa025('0x4b')]['id'];}return db[_0xa025('0x2d')][_0xa025('0x49')]({'where':{'id':_0x13c495['params']['id']}})[_0xa025('0x26')](handleEntityNotFound(_0x2f2581,null))[_0xa025('0x26')](saveUpdates(_0x13c495['body'],null))[_0xa025('0x26')](respondWithResult(_0x2f2581,null))[_0xa025('0x45')](handleError(_0x2f2581,null));};exports['destroy']=function(_0x5bf24c,_0x548582){return db[_0xa025('0x2d')][_0xa025('0x49')]({'where':{'id':_0x5bf24c[_0xa025('0x47')]['id']}})[_0xa025('0x26')](handleEntityNotFound(_0x548582,null))[_0xa025('0x26')](removeEntity(_0x548582,null))['catch'](handleError(_0x548582,null));};exports[_0xa025('0x4d')]=function(_0x31dbdc,_0x1e6baa){return db[_0xa025('0x2d')]['describe']()[_0xa025('0x26')](respondWithResult(_0x1e6baa,null))['catch'](handleError(_0x1e6baa,null));};
\ No newline at end of file