Built motion from commit (unavailable).|2.5.20
[motion2.git] / server / api / smsQueueReport / smsQueueReport.controller.js
index 2a6897b..c1b7bf0 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x87f4=['set','Content-Range','json','apply','reject','save','update','then','destroy','error','stack','name','index','SmsQueueReport','type','key','model','map','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','where','filter','merge','VIRTUAL','options','includeAll','include','catch','show','rawAttributes','find','create','body','params','describe','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/environment','sendStatus','status','end','count','offset','limit'];(function(_0x1cc519,_0x4fd527){var _0x5418c5=function(_0x4d0639){while(--_0x4d0639){_0x1cc519['push'](_0x1cc519['shift']());}};_0x5418c5(++_0x4fd527);}(_0x87f4,0x73));var _0x487f=function(_0x4ae32d,_0x256489){_0x4ae32d=_0x4ae32d-0x0;var _0x550537=_0x87f4[_0x4ae32d];return _0x550537;};'use strict';var pdf=require(_0x487f('0x0'));var emlformat=require(_0x487f('0x1'));var rimraf=require(_0x487f('0x2'));var zipdir=require(_0x487f('0x3'));var jsonpatch=require(_0x487f('0x4'));var rp=require('request-promise');var moment=require(_0x487f('0x5'));var BPromise=require(_0x487f('0x6'));var Mustache=require(_0x487f('0x7'));var util=require(_0x487f('0x8'));var path=require('path');var sox=require(_0x487f('0x9'));var csv=require(_0x487f('0xa'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x487f('0xb'));var squel=require(_0x487f('0xc'));var crypto=require(_0x487f('0xd'));var jsforce=require(_0x487f('0xe'));var deskjs=require(_0x487f('0xf'));var toCsv=require(_0x487f('0xa'));var querystring=require(_0x487f('0x10'));var Papa=require(_0x487f('0x11'));var Redis=require('ioredis');var authService=require(_0x487f('0x12'));var qs=require(_0x487f('0x13'));var as=require(_0x487f('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x487f('0x15'))('api');var utils=require('../../config/utils');var config=require(_0x487f('0x16'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xcbb1ef,_0x52cc81){_0x52cc81=_0x52cc81||0xcc;return function(_0x54998d){if(_0x54998d){return _0xcbb1ef[_0x487f('0x17')](_0x52cc81);}return _0xcbb1ef[_0x487f('0x18')](_0x52cc81)[_0x487f('0x19')]();};}function respondWithResult(_0x3218ac,_0x19d67b){_0x19d67b=_0x19d67b||0xc8;return function(_0x5c399e){if(_0x5c399e){return _0x3218ac[_0x487f('0x18')](_0x19d67b)['json'](_0x5c399e);}};}function respondWithFilteredResult(_0x440efd,_0x272de2){return function(_0x214611){if(_0x214611){var _0x54475e=_0x214611[_0x487f('0x1a')],_0x4e502e=_0x272de2[_0x487f('0x1b')],_0x2b18af=_0x272de2['offset']+_0x272de2[_0x487f('0x1c')],_0xdf45e6;if(_0x2b18af>=_0x54475e){_0x2b18af=_0x54475e;_0xdf45e6=0xc8;}else{_0xdf45e6=0xce;}_0x440efd[_0x487f('0x18')](_0xdf45e6);return _0x440efd[_0x487f('0x1d')](_0x487f('0x1e'),_0x4e502e+'-'+_0x2b18af+'/'+_0x54475e)[_0x487f('0x1f')](_0x214611);}return null;};}function patchUpdates(_0x53f05e){return function(_0x147011){try{jsonpatch[_0x487f('0x20')](_0x147011,_0x53f05e,!![]);}catch(_0x273d0e){return BPromise[_0x487f('0x21')](_0x273d0e);}return _0x147011[_0x487f('0x22')]();};}function saveUpdates(_0x493115,_0x38a3a0){return function(_0x3a6cbf){if(_0x3a6cbf){return _0x3a6cbf[_0x487f('0x23')](_0x493115)[_0x487f('0x24')](function(_0x52139c){return _0x52139c;});}return null;};}function removeEntity(_0x216d4e,_0x1c8dc8){return function(_0x278b80){if(_0x278b80){return _0x278b80[_0x487f('0x25')]()[_0x487f('0x24')](function(){_0x216d4e[_0x487f('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1e2d47,_0x2caf25){return function(_0x178e6b){if(!_0x178e6b){_0x1e2d47[_0x487f('0x17')](0x194);}return _0x178e6b;};}function handleError(_0x4c917f,_0x32fa0a){_0x32fa0a=_0x32fa0a||0x1f4;return function(_0x58e9e6){logger[_0x487f('0x26')](_0x58e9e6[_0x487f('0x27')]);if(_0x58e9e6[_0x487f('0x28')]){delete _0x58e9e6['name'];}_0x4c917f[_0x487f('0x18')](_0x32fa0a)['send'](_0x58e9e6);};}exports[_0x487f('0x29')]=function(_0x498006,_0x1e2f64){var _0x105e74={},_0x3ab3cf={},_0xece87a={'count':0x0,'rows':[]};var _0x28f3ca=_['map'](db[_0x487f('0x2a')]['rawAttributes'],function(_0x10475d){return{'name':_0x10475d['fieldName'],'type':_0x10475d[_0x487f('0x2b')][_0x487f('0x2c')]};});_0x3ab3cf[_0x487f('0x2d')]=_[_0x487f('0x2e')](_0x28f3ca,'name');_0x3ab3cf[_0x487f('0x2f')]=_[_0x487f('0x30')](_0x498006[_0x487f('0x2f')]);_0x3ab3cf[_0x487f('0x31')]=_['intersection'](_0x3ab3cf[_0x487f('0x2d')],_0x3ab3cf['query']);_0x105e74[_0x487f('0x32')]=_[_0x487f('0x33')](_0x3ab3cf[_0x487f('0x2d')],qs[_0x487f('0x34')](_0x498006['query'][_0x487f('0x34')]));_0x105e74[_0x487f('0x32')]=_0x105e74[_0x487f('0x32')][_0x487f('0x35')]?_0x105e74[_0x487f('0x32')]:_0x3ab3cf[_0x487f('0x2d')];if(!_0x498006[_0x487f('0x2f')][_0x487f('0x36')](_0x487f('0x37'))){_0x105e74['limit']=qs['limit'](_0x498006[_0x487f('0x2f')][_0x487f('0x1c')]);_0x105e74[_0x487f('0x1b')]=qs[_0x487f('0x1b')](_0x498006['query']['offset']);}_0x105e74[_0x487f('0x38')]=qs['sort'](_0x498006[_0x487f('0x2f')]['sort']);_0x105e74[_0x487f('0x39')]=qs['filters'](_['pick'](_0x498006[_0x487f('0x2f')],_0x3ab3cf[_0x487f('0x31')]),_0x28f3ca);if(_0x498006[_0x487f('0x2f')][_0x487f('0x3a')]){_0x105e74['where']=_[_0x487f('0x3b')](_0x105e74[_0x487f('0x39')],{'$or':_[_0x487f('0x2e')](_0x28f3ca,function(_0x136108){if(_0x136108[_0x487f('0x2b')]!==_0x487f('0x3c')){var _0x32dec0={};_0x32dec0[_0x136108[_0x487f('0x28')]]={'$like':'%'+_0x498006['query'][_0x487f('0x3a')]+'%'};return _0x32dec0;}})});}_0x105e74=_[_0x487f('0x3b')]({},_0x105e74,_0x498006[_0x487f('0x3d')]);var _0x5a56ee={'where':_0x105e74['where']};return db[_0x487f('0x2a')][_0x487f('0x1a')](_0x5a56ee)[_0x487f('0x24')](function(_0x21533b){_0xece87a['count']=_0x21533b;if(_0x498006[_0x487f('0x2f')][_0x487f('0x3e')]){_0x105e74[_0x487f('0x3f')]=[{'all':!![]}];}return db[_0x487f('0x2a')]['findAll'](_0x105e74);})[_0x487f('0x24')](function(_0xa7ebfc){_0xece87a['rows']=_0xa7ebfc;return _0xece87a;})[_0x487f('0x24')](respondWithFilteredResult(_0x1e2f64,_0x105e74))[_0x487f('0x40')](handleError(_0x1e2f64,null));};exports[_0x487f('0x41')]=function(_0x28496a,_0x49d3ab){var _0x1a8689={'raw':!![],'where':{'id':_0x28496a['params']['id']}},_0x3ef12e={};_0x3ef12e[_0x487f('0x2d')]=_[_0x487f('0x30')](db[_0x487f('0x2a')][_0x487f('0x42')]);_0x3ef12e[_0x487f('0x2f')]=_[_0x487f('0x30')](_0x28496a[_0x487f('0x2f')]);_0x3ef12e[_0x487f('0x31')]=_['intersection'](_0x3ef12e[_0x487f('0x2d')],_0x3ef12e[_0x487f('0x2f')]);_0x1a8689[_0x487f('0x32')]=_[_0x487f('0x33')](_0x3ef12e['model'],qs[_0x487f('0x34')](_0x28496a[_0x487f('0x2f')][_0x487f('0x34')]));_0x1a8689[_0x487f('0x32')]=_0x1a8689['attributes']['length']?_0x1a8689['attributes']:_0x3ef12e[_0x487f('0x2d')];if(_0x28496a['query'][_0x487f('0x3e')]){_0x1a8689['include']=[{'all':!![]}];}_0x1a8689=_['merge']({},_0x1a8689,_0x28496a['options']);return db[_0x487f('0x2a')][_0x487f('0x43')](_0x1a8689)[_0x487f('0x24')](handleEntityNotFound(_0x49d3ab,null))[_0x487f('0x24')](respondWithResult(_0x49d3ab,null))[_0x487f('0x40')](handleError(_0x49d3ab,null));};exports['create']=function(_0x352c3c,_0x119525){return db['SmsQueueReport'][_0x487f('0x44')](_0x352c3c[_0x487f('0x45')],{})[_0x487f('0x24')](respondWithResult(_0x119525,0xc9))[_0x487f('0x40')](handleError(_0x119525,null));};exports[_0x487f('0x23')]=function(_0x2168e4,_0xb69f3a){if(_0x2168e4[_0x487f('0x45')]['id']){delete _0x2168e4[_0x487f('0x45')]['id'];}return db[_0x487f('0x2a')][_0x487f('0x43')]({'where':{'id':_0x2168e4[_0x487f('0x46')]['id']}})[_0x487f('0x24')](handleEntityNotFound(_0xb69f3a,null))[_0x487f('0x24')](saveUpdates(_0x2168e4[_0x487f('0x45')],null))[_0x487f('0x24')](respondWithResult(_0xb69f3a,null))[_0x487f('0x40')](handleError(_0xb69f3a,null));};exports[_0x487f('0x25')]=function(_0x5e276d,_0x3d31b3){return db[_0x487f('0x2a')]['find']({'where':{'id':_0x5e276d[_0x487f('0x46')]['id']}})[_0x487f('0x24')](handleEntityNotFound(_0x3d31b3,null))[_0x487f('0x24')](removeEntity(_0x3d31b3,null))[_0x487f('0x40')](handleError(_0x3d31b3,null));};exports[_0x487f('0x47')]=function(_0x156c6b,_0x232a29){return db[_0x487f('0x2a')][_0x487f('0x47')]()[_0x487f('0x24')](respondWithResult(_0x232a29,null))['catch'](handleError(_0x232a29,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