Built motion from commit (unavailable).|2.5.6
[motion2.git] / server / api / memberReport / memberReport.controller.js
index 2a3d3e0..fc25676 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x8f26=['where','filters','filter','merge','map','VIRTUAL','includeAll','include','findAll','rows','catch','show','params','find','create','body','describe','html-pdf','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','status','json','count','offset','set','Content-Range','apply','save','then','error','stack','send','index','MemberReport','rawAttributes','fieldName','type','model','name','query','keys','attributes','intersection','fields','length','hasOwnProperty','nolimit','limit','sort'];(function(_0x4e4798,_0x565daf){var _0x217662=function(_0x386bb3){while(--_0x386bb3){_0x4e4798['push'](_0x4e4798['shift']());}};_0x217662(++_0x565daf);}(_0x8f26,0xa1));var _0x68f2=function(_0xe1a616,_0x1dd04c){_0xe1a616=_0xe1a616-0x0;var _0x4052be=_0x8f26[_0xe1a616];return _0x4052be;};'use strict';var pdf=require(_0x68f2('0x0'));var emlformat=require(_0x68f2('0x1'));var rimraf=require(_0x68f2('0x2'));var zipdir=require(_0x68f2('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x68f2('0x4'));var moment=require('moment');var BPromise=require(_0x68f2('0x5'));var Mustache=require(_0x68f2('0x6'));var util=require(_0x68f2('0x7'));var path=require(_0x68f2('0x8'));var sox=require(_0x68f2('0x9'));var csv=require(_0x68f2('0xa'));var ejs=require(_0x68f2('0xb'));var fs=require('fs');var _=require(_0x68f2('0xc'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x68f2('0xd'));var deskjs=require(_0x68f2('0xe'));var toCsv=require('to-csv');var querystring=require(_0x68f2('0xf'));var Papa=require(_0x68f2('0x10'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x68f2('0x11'));var as=require(_0x68f2('0x12'));var hardwareService=require(_0x68f2('0x13'));var logger=require('../../config/logger')(_0x68f2('0x14'));var utils=require(_0x68f2('0x15'));var config=require(_0x68f2('0x16'));var db=require(_0x68f2('0x17'))['db'];function respondWithStatusCode(_0x58917c,_0x1e99ba){_0x1e99ba=_0x1e99ba||0xcc;return function(_0x212dcb){if(_0x212dcb){return _0x58917c[_0x68f2('0x18')](_0x1e99ba);}return _0x58917c['status'](_0x1e99ba)[_0x68f2('0x19')]();};}function respondWithResult(_0x4b1e08,_0x56deba){_0x56deba=_0x56deba||0xc8;return function(_0xfd8d2a){if(_0xfd8d2a){return _0x4b1e08[_0x68f2('0x1a')](_0x56deba)[_0x68f2('0x1b')](_0xfd8d2a);}};}function respondWithFilteredResult(_0x4dc449,_0x46a8bf){return function(_0x1f09f7){if(_0x1f09f7){var _0x4cca28=_0x1f09f7[_0x68f2('0x1c')],_0xa72a76=_0x46a8bf[_0x68f2('0x1d')],_0x2df19e=_0x46a8bf['offset']+_0x46a8bf['limit'],_0x10a21c;if(_0x2df19e>=_0x4cca28){_0x2df19e=_0x4cca28;_0x10a21c=0xc8;}else{_0x10a21c=0xce;}_0x4dc449[_0x68f2('0x1a')](_0x10a21c);return _0x4dc449[_0x68f2('0x1e')](_0x68f2('0x1f'),_0xa72a76+'-'+_0x2df19e+'/'+_0x4cca28)[_0x68f2('0x1b')](_0x1f09f7);}return null;};}function patchUpdates(_0x38def3){return function(_0x1b2105){try{jsonpatch[_0x68f2('0x20')](_0x1b2105,_0x38def3,!![]);}catch(_0x5f2be2){return BPromise['reject'](_0x5f2be2);}return _0x1b2105[_0x68f2('0x21')]();};}function saveUpdates(_0x253abe,_0x3290ee){return function(_0x1d0dfa){if(_0x1d0dfa){return _0x1d0dfa['update'](_0x253abe)[_0x68f2('0x22')](function(_0x36bedf){return _0x36bedf;});}return null;};}function removeEntity(_0xf789a2,_0xcc785c){return function(_0x4cd4e3){if(_0x4cd4e3){return _0x4cd4e3['destroy']()[_0x68f2('0x22')](function(){_0xf789a2['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x1f8205,_0x2088fa){return function(_0x9df170){if(!_0x9df170){_0x1f8205[_0x68f2('0x18')](0x194);}return _0x9df170;};}function handleError(_0x2ec1c1,_0x3669a5){_0x3669a5=_0x3669a5||0x1f4;return function(_0x5690e0){logger[_0x68f2('0x23')](_0x5690e0[_0x68f2('0x24')]);if(_0x5690e0['name']){delete _0x5690e0['name'];}_0x2ec1c1[_0x68f2('0x1a')](_0x3669a5)[_0x68f2('0x25')](_0x5690e0);};}exports[_0x68f2('0x26')]=function(_0x1fc576,_0x4b2895){var _0x28461f={},_0x18fc4d={},_0x5db8e6={'count':0x0,'rows':[]};var _0x27fa2b=_['map'](db[_0x68f2('0x27')][_0x68f2('0x28')],function(_0x530210){return{'name':_0x530210[_0x68f2('0x29')],'type':_0x530210[_0x68f2('0x2a')]['key']};});_0x18fc4d[_0x68f2('0x2b')]=_['map'](_0x27fa2b,_0x68f2('0x2c'));_0x18fc4d[_0x68f2('0x2d')]=_[_0x68f2('0x2e')](_0x1fc576[_0x68f2('0x2d')]);_0x18fc4d['filters']=_['intersection'](_0x18fc4d['model'],_0x18fc4d[_0x68f2('0x2d')]);_0x28461f[_0x68f2('0x2f')]=_[_0x68f2('0x30')](_0x18fc4d[_0x68f2('0x2b')],qs[_0x68f2('0x31')](_0x1fc576[_0x68f2('0x2d')][_0x68f2('0x31')]));_0x28461f['attributes']=_0x28461f[_0x68f2('0x2f')][_0x68f2('0x32')]?_0x28461f[_0x68f2('0x2f')]:_0x18fc4d['model'];if(!_0x1fc576['query'][_0x68f2('0x33')](_0x68f2('0x34'))){_0x28461f[_0x68f2('0x35')]=qs[_0x68f2('0x35')](_0x1fc576[_0x68f2('0x2d')][_0x68f2('0x35')]);_0x28461f[_0x68f2('0x1d')]=qs[_0x68f2('0x1d')](_0x1fc576[_0x68f2('0x2d')][_0x68f2('0x1d')]);}_0x28461f['order']=qs[_0x68f2('0x36')](_0x1fc576[_0x68f2('0x2d')][_0x68f2('0x36')]);_0x28461f[_0x68f2('0x37')]=qs[_0x68f2('0x38')](_['pick'](_0x1fc576['query'],_0x18fc4d[_0x68f2('0x38')]),_0x27fa2b);if(_0x1fc576['query'][_0x68f2('0x39')]){_0x28461f['where']=_[_0x68f2('0x3a')](_0x28461f[_0x68f2('0x37')],{'$or':_[_0x68f2('0x3b')](_0x27fa2b,function(_0x26ccd8){if(_0x26ccd8[_0x68f2('0x2a')]!==_0x68f2('0x3c')){var _0x10ac0d={};_0x10ac0d[_0x26ccd8[_0x68f2('0x2c')]]={'$like':'%'+_0x1fc576['query'][_0x68f2('0x39')]+'%'};return _0x10ac0d;}})});}_0x28461f=_[_0x68f2('0x3a')]({},_0x28461f,_0x1fc576['options']);var _0xd2d2a1={'where':_0x28461f[_0x68f2('0x37')]};return db[_0x68f2('0x27')][_0x68f2('0x1c')](_0xd2d2a1)[_0x68f2('0x22')](function(_0x4e4fcb){_0x5db8e6[_0x68f2('0x1c')]=_0x4e4fcb;if(_0x1fc576[_0x68f2('0x2d')][_0x68f2('0x3d')]){_0x28461f[_0x68f2('0x3e')]=[{'all':!![]}];}return db[_0x68f2('0x27')][_0x68f2('0x3f')](_0x28461f);})[_0x68f2('0x22')](function(_0x47bce5){_0x5db8e6[_0x68f2('0x40')]=_0x47bce5;return _0x5db8e6;})['then'](respondWithFilteredResult(_0x4b2895,_0x28461f))[_0x68f2('0x41')](handleError(_0x4b2895,null));};exports[_0x68f2('0x42')]=function(_0x17f06b,_0x192a2e){var _0x23ceb5={'raw':!![],'where':{'id':_0x17f06b[_0x68f2('0x43')]['id']}},_0x28f949={};_0x28f949[_0x68f2('0x2b')]=_['keys'](db[_0x68f2('0x27')][_0x68f2('0x28')]);_0x28f949['query']=_['keys'](_0x17f06b[_0x68f2('0x2d')]);_0x28f949[_0x68f2('0x38')]=_['intersection'](_0x28f949[_0x68f2('0x2b')],_0x28f949[_0x68f2('0x2d')]);_0x23ceb5['attributes']=_[_0x68f2('0x30')](_0x28f949[_0x68f2('0x2b')],qs['fields'](_0x17f06b['query'][_0x68f2('0x31')]));_0x23ceb5[_0x68f2('0x2f')]=_0x23ceb5[_0x68f2('0x2f')][_0x68f2('0x32')]?_0x23ceb5['attributes']:_0x28f949['model'];if(_0x17f06b[_0x68f2('0x2d')][_0x68f2('0x3d')]){_0x23ceb5[_0x68f2('0x3e')]=[{'all':!![]}];}_0x23ceb5=_[_0x68f2('0x3a')]({},_0x23ceb5,_0x17f06b['options']);return db[_0x68f2('0x27')][_0x68f2('0x44')](_0x23ceb5)[_0x68f2('0x22')](handleEntityNotFound(_0x192a2e,null))[_0x68f2('0x22')](respondWithResult(_0x192a2e,null))[_0x68f2('0x41')](handleError(_0x192a2e,null));};exports[_0x68f2('0x45')]=function(_0x490b16,_0x516ab0){return db[_0x68f2('0x27')][_0x68f2('0x45')](_0x490b16[_0x68f2('0x46')],{})[_0x68f2('0x22')](respondWithResult(_0x516ab0,0xc9))['catch'](handleError(_0x516ab0,null));};exports['update']=function(_0x5967fb,_0x355a22){if(_0x5967fb[_0x68f2('0x46')]['id']){delete _0x5967fb[_0x68f2('0x46')]['id'];}return db[_0x68f2('0x27')][_0x68f2('0x44')]({'where':{'id':_0x5967fb['params']['id']}})[_0x68f2('0x22')](handleEntityNotFound(_0x355a22,null))['then'](saveUpdates(_0x5967fb[_0x68f2('0x46')],null))['then'](respondWithResult(_0x355a22,null))[_0x68f2('0x41')](handleError(_0x355a22,null));};exports['destroy']=function(_0xbca0e7,_0x439286){return db[_0x68f2('0x27')]['find']({'where':{'id':_0xbca0e7[_0x68f2('0x43')]['id']}})[_0x68f2('0x22')](handleEntityNotFound(_0x439286,null))['then'](removeEntity(_0x439286,null))['catch'](handleError(_0x439286,null));};exports['describe']=function(_0x2dc8af,_0x2c9e80){return db[_0x68f2('0x27')][_0x68f2('0x47')]()['then'](respondWithResult(_0x2c9e80,null))[_0x68f2('0x41')](handleError(_0x2c9e80,null));};
\ No newline at end of file
+var _0x531b=['where','filters','pick','filter','merge','VIRTUAL','options','count','includeAll','include','findAll','rows','catch','show','params','create','body','find','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','path','sox','to-csv','ejs','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','status','json','offset','limit','set','Content-Range','apply','save','then','destroy','end','sendStatus','error','send','index','map','MemberReport','rawAttributes','fieldName','type','key','keys','query','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','order','sort'];(function(_0x2b4f44,_0x1b3ec8){var _0x416641=function(_0x2c1d6c){while(--_0x2c1d6c){_0x2b4f44['push'](_0x2b4f44['shift']());}};_0x416641(++_0x1b3ec8);}(_0x531b,0xf7));var _0xb531=function(_0x11babf,_0x2a02bb){_0x11babf=_0x11babf-0x0;var _0x3bcc27=_0x531b[_0x11babf];return _0x3bcc27;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xb531('0x0'));var rimraf=require(_0xb531('0x1'));var zipdir=require(_0xb531('0x2'));var jsonpatch=require(_0xb531('0x3'));var rp=require(_0xb531('0x4'));var moment=require('moment');var BPromise=require(_0xb531('0x5'));var Mustache=require(_0xb531('0x6'));var util=require('util');var path=require(_0xb531('0x7'));var sox=require(_0xb531('0x8'));var csv=require(_0xb531('0x9'));var ejs=require(_0xb531('0xa'));var fs=require('fs');var _=require('lodash');var squel=require(_0xb531('0xb'));var crypto=require(_0xb531('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xb531('0xd'));var toCsv=require('to-csv');var querystring=require(_0xb531('0xe'));var Papa=require(_0xb531('0xf'));var Redis=require(_0xb531('0x10'));var authService=require(_0xb531('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xb531('0x12'));var hardwareService=require(_0xb531('0x13'));var logger=require(_0xb531('0x14'))(_0xb531('0x15'));var utils=require(_0xb531('0x16'));var config=require(_0xb531('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0xb531('0x18'))['db'];function respondWithStatusCode(_0x46989a,_0x27fd89){_0x27fd89=_0x27fd89||0xcc;return function(_0x102781){if(_0x102781){return _0x46989a['sendStatus'](_0x27fd89);}return _0x46989a[_0xb531('0x19')](_0x27fd89)['end']();};}function respondWithResult(_0x294524,_0x4d83a6){_0x4d83a6=_0x4d83a6||0xc8;return function(_0x296f81){if(_0x296f81){return _0x294524[_0xb531('0x19')](_0x4d83a6)[_0xb531('0x1a')](_0x296f81);}};}function respondWithFilteredResult(_0x6c73e2,_0x453eba){return function(_0x3f2525){if(_0x3f2525){var _0x5b3341=_0x3f2525['count'],_0x1809d1=_0x453eba[_0xb531('0x1b')],_0x106833=_0x453eba[_0xb531('0x1b')]+_0x453eba[_0xb531('0x1c')],_0x2d5f41;if(_0x106833>=_0x5b3341){_0x106833=_0x5b3341;_0x2d5f41=0xc8;}else{_0x2d5f41=0xce;}_0x6c73e2[_0xb531('0x19')](_0x2d5f41);return _0x6c73e2[_0xb531('0x1d')](_0xb531('0x1e'),_0x1809d1+'-'+_0x106833+'/'+_0x5b3341)[_0xb531('0x1a')](_0x3f2525);}return null;};}function patchUpdates(_0x607ea1){return function(_0x34394e){try{jsonpatch[_0xb531('0x1f')](_0x34394e,_0x607ea1,!![]);}catch(_0x2ad59b){return BPromise['reject'](_0x2ad59b);}return _0x34394e[_0xb531('0x20')]();};}function saveUpdates(_0x289a3d,_0x557409){return function(_0x21ee0f){if(_0x21ee0f){return _0x21ee0f['update'](_0x289a3d)[_0xb531('0x21')](function(_0x327cdd){return _0x327cdd;});}return null;};}function removeEntity(_0x288926,_0xce19c9){return function(_0x2d658d){if(_0x2d658d){return _0x2d658d[_0xb531('0x22')]()['then'](function(){_0x288926[_0xb531('0x19')](0xcc)[_0xb531('0x23')]();});}};}function handleEntityNotFound(_0x33672e,_0x1bceb6){return function(_0x4c0b92){if(!_0x4c0b92){_0x33672e[_0xb531('0x24')](0x194);}return _0x4c0b92;};}function handleError(_0x3ac65f,_0x3144c3){_0x3144c3=_0x3144c3||0x1f4;return function(_0x573c7d){logger[_0xb531('0x25')](_0x573c7d['stack']);if(_0x573c7d['name']){delete _0x573c7d['name'];}_0x3ac65f[_0xb531('0x19')](_0x3144c3)[_0xb531('0x26')](_0x573c7d);};}exports[_0xb531('0x27')]=function(_0x4747a8,_0x13361c){var _0x1728b7={},_0x1f9f01={},_0x323677={'count':0x0,'rows':[]};var _0x4ff16d=_[_0xb531('0x28')](db[_0xb531('0x29')][_0xb531('0x2a')],function(_0x338d22){return{'name':_0x338d22[_0xb531('0x2b')],'type':_0x338d22[_0xb531('0x2c')][_0xb531('0x2d')]};});_0x1f9f01['model']=_[_0xb531('0x28')](_0x4ff16d,'name');_0x1f9f01['query']=_[_0xb531('0x2e')](_0x4747a8[_0xb531('0x2f')]);_0x1f9f01['filters']=_[_0xb531('0x30')](_0x1f9f01[_0xb531('0x31')],_0x1f9f01[_0xb531('0x2f')]);_0x1728b7['attributes']=_['intersection'](_0x1f9f01['model'],qs['fields'](_0x4747a8[_0xb531('0x2f')][_0xb531('0x32')]));_0x1728b7[_0xb531('0x33')]=_0x1728b7[_0xb531('0x33')][_0xb531('0x34')]?_0x1728b7['attributes']:_0x1f9f01[_0xb531('0x31')];if(!_0x4747a8['query'][_0xb531('0x35')](_0xb531('0x36'))){_0x1728b7[_0xb531('0x1c')]=qs['limit'](_0x4747a8['query'][_0xb531('0x1c')]);_0x1728b7[_0xb531('0x1b')]=qs[_0xb531('0x1b')](_0x4747a8[_0xb531('0x2f')][_0xb531('0x1b')]);}_0x1728b7[_0xb531('0x37')]=qs[_0xb531('0x38')](_0x4747a8[_0xb531('0x2f')][_0xb531('0x38')]);_0x1728b7[_0xb531('0x39')]=qs[_0xb531('0x3a')](_[_0xb531('0x3b')](_0x4747a8[_0xb531('0x2f')],_0x1f9f01[_0xb531('0x3a')]),_0x4ff16d);if(_0x4747a8[_0xb531('0x2f')][_0xb531('0x3c')]){_0x1728b7[_0xb531('0x39')]=_[_0xb531('0x3d')](_0x1728b7['where'],{'$or':_['map'](_0x4ff16d,function(_0x2dafdc){if(_0x2dafdc[_0xb531('0x2c')]!==_0xb531('0x3e')){var _0x33ba90={};_0x33ba90[_0x2dafdc['name']]={'$like':'%'+_0x4747a8[_0xb531('0x2f')][_0xb531('0x3c')]+'%'};return _0x33ba90;}})});}_0x1728b7=_[_0xb531('0x3d')]({},_0x1728b7,_0x4747a8[_0xb531('0x3f')]);var _0x40176e={'where':_0x1728b7[_0xb531('0x39')]};return db['MemberReport']['count'](_0x40176e)[_0xb531('0x21')](function(_0x20fbf9){_0x323677[_0xb531('0x40')]=_0x20fbf9;if(_0x4747a8[_0xb531('0x2f')][_0xb531('0x41')]){_0x1728b7[_0xb531('0x42')]=[{'all':!![]}];}return db[_0xb531('0x29')][_0xb531('0x43')](_0x1728b7);})[_0xb531('0x21')](function(_0x1f362d){_0x323677[_0xb531('0x44')]=_0x1f362d;return _0x323677;})['then'](respondWithFilteredResult(_0x13361c,_0x1728b7))[_0xb531('0x45')](handleError(_0x13361c,null));};exports[_0xb531('0x46')]=function(_0x2838e6,_0xe719f){var _0x1c31f8={'raw':!![],'where':{'id':_0x2838e6[_0xb531('0x47')]['id']}},_0x50945d={};_0x50945d['model']=_[_0xb531('0x2e')](db[_0xb531('0x29')]['rawAttributes']);_0x50945d[_0xb531('0x2f')]=_[_0xb531('0x2e')](_0x2838e6[_0xb531('0x2f')]);_0x50945d[_0xb531('0x3a')]=_[_0xb531('0x30')](_0x50945d[_0xb531('0x31')],_0x50945d[_0xb531('0x2f')]);_0x1c31f8['attributes']=_['intersection'](_0x50945d[_0xb531('0x31')],qs['fields'](_0x2838e6[_0xb531('0x2f')][_0xb531('0x32')]));_0x1c31f8[_0xb531('0x33')]=_0x1c31f8[_0xb531('0x33')][_0xb531('0x34')]?_0x1c31f8[_0xb531('0x33')]:_0x50945d[_0xb531('0x31')];if(_0x2838e6[_0xb531('0x2f')]['includeAll']){_0x1c31f8['include']=[{'all':!![]}];}_0x1c31f8=_[_0xb531('0x3d')]({},_0x1c31f8,_0x2838e6[_0xb531('0x3f')]);return db[_0xb531('0x29')]['find'](_0x1c31f8)['then'](handleEntityNotFound(_0xe719f,null))[_0xb531('0x21')](respondWithResult(_0xe719f,null))[_0xb531('0x45')](handleError(_0xe719f,null));};exports['create']=function(_0x4811ca,_0x4103e4){return db[_0xb531('0x29')][_0xb531('0x48')](_0x4811ca['body'],{})['then'](respondWithResult(_0x4103e4,0xc9))[_0xb531('0x45')](handleError(_0x4103e4,null));};exports['update']=function(_0xf383d5,_0x9b3f22){if(_0xf383d5[_0xb531('0x49')]['id']){delete _0xf383d5['body']['id'];}return db[_0xb531('0x29')]['find']({'where':{'id':_0xf383d5[_0xb531('0x47')]['id']}})[_0xb531('0x21')](handleEntityNotFound(_0x9b3f22,null))[_0xb531('0x21')](saveUpdates(_0xf383d5['body'],null))['then'](respondWithResult(_0x9b3f22,null))[_0xb531('0x45')](handleError(_0x9b3f22,null));};exports[_0xb531('0x22')]=function(_0x4e0b17,_0x1ab356){return db['MemberReport'][_0xb531('0x4a')]({'where':{'id':_0x4e0b17[_0xb531('0x47')]['id']}})['then'](handleEntityNotFound(_0x1ab356,null))[_0xb531('0x21')](removeEntity(_0x1ab356,null))[_0xb531('0x45')](handleError(_0x1ab356,null));};exports['describe']=function(_0x145c31,_0x2f0a6c){return db['MemberReport'][_0xb531('0x4b')]()[_0xb531('0x21')](respondWithResult(_0x2f0a6c,null))[_0xb531('0x45')](handleError(_0x2f0a6c,null));};
\ No newline at end of file