Built motion from commit (unavailable).|2.5.6
[motion2.git] / server / api / memberReport / memberReport.controller.js
index 0f82690..fc25676 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x043f=['then','includeAll','include','findAll','rows','catch','show','params','keys','length','find','create','body','destroy','describe','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','ejs','crypto','desk.js','querystring','../../components/parsers/qs','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','offset','set','Content-Range','json','apply','reject','save','update','error','name','send','index','map','MemberReport','rawAttributes','fieldName','key','model','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','type','merge','options','count'];(function(_0x4e086a,_0x4a830d){var _0x2a9585=function(_0x3191e0){while(--_0x3191e0){_0x4e086a['push'](_0x4e086a['shift']());}};_0x2a9585(++_0x4a830d);}(_0x043f,0x1b9));var _0xf043=function(_0x34db21,_0x4256bb){_0x34db21=_0x34db21-0x0;var _0x5e7d82=_0x043f[_0x34db21];return _0x5e7d82;};'use strict';var pdf=require(_0xf043('0x0'));var emlformat=require(_0xf043('0x1'));var rimraf=require(_0xf043('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0xf043('0x3'));var rp=require(_0xf043('0x4'));var moment=require(_0xf043('0x5'));var BPromise=require(_0xf043('0x6'));var Mustache=require(_0xf043('0x7'));var util=require(_0xf043('0x8'));var path=require('path');var sox=require(_0xf043('0x9'));var csv=require('to-csv');var ejs=require(_0xf043('0xa'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0xf043('0xb'));var jsforce=require('jsforce');var deskjs=require(_0xf043('0xc'));var toCsv=require('to-csv');var querystring=require(_0xf043('0xd'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xf043('0xe'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0xf043('0xf'));var config=require(_0xf043('0x10'));var db=require(_0xf043('0x11'))['db'];function respondWithStatusCode(_0xec30fc,_0x1aa081){_0x1aa081=_0x1aa081||0xcc;return function(_0x4aa25d){if(_0x4aa25d){return _0xec30fc[_0xf043('0x12')](_0x1aa081);}return _0xec30fc[_0xf043('0x13')](_0x1aa081)[_0xf043('0x14')]();};}function respondWithResult(_0x3d8432,_0x43dc62){_0x43dc62=_0x43dc62||0xc8;return function(_0x2e3275){if(_0x2e3275){return _0x3d8432[_0xf043('0x13')](_0x43dc62)['json'](_0x2e3275);}};}function respondWithFilteredResult(_0x2c9a99,_0x15bed7){return function(_0x17dc8c){if(_0x17dc8c){var _0x26c7c3=_0x17dc8c['count'],_0x134a25=_0x15bed7[_0xf043('0x15')],_0x253ec5=_0x15bed7[_0xf043('0x15')]+_0x15bed7['limit'],_0x2c5ad7;if(_0x253ec5>=_0x26c7c3){_0x253ec5=_0x26c7c3;_0x2c5ad7=0xc8;}else{_0x2c5ad7=0xce;}_0x2c9a99[_0xf043('0x13')](_0x2c5ad7);return _0x2c9a99[_0xf043('0x16')](_0xf043('0x17'),_0x134a25+'-'+_0x253ec5+'/'+_0x26c7c3)[_0xf043('0x18')](_0x17dc8c);}return null;};}function patchUpdates(_0x11e395){return function(_0x4d7681){try{jsonpatch[_0xf043('0x19')](_0x4d7681,_0x11e395,!![]);}catch(_0x515c6a){return BPromise[_0xf043('0x1a')](_0x515c6a);}return _0x4d7681[_0xf043('0x1b')]();};}function saveUpdates(_0x12fd24,_0x236a78){return function(_0x532920){if(_0x532920){return _0x532920[_0xf043('0x1c')](_0x12fd24)['then'](function(_0x1f1ab2){return _0x1f1ab2;});}return null;};}function removeEntity(_0x3c1881,_0x3037ad){return function(_0x4efa12){if(_0x4efa12){return _0x4efa12['destroy']()['then'](function(){_0x3c1881[_0xf043('0x13')](0xcc)[_0xf043('0x14')]();});}};}function handleEntityNotFound(_0x48c3e4,_0x155031){return function(_0x355557){if(!_0x355557){_0x48c3e4[_0xf043('0x12')](0x194);}return _0x355557;};}function handleError(_0x643733,_0x5da5c9){_0x5da5c9=_0x5da5c9||0x1f4;return function(_0x31156a){logger[_0xf043('0x1d')](_0x31156a['stack']);if(_0x31156a[_0xf043('0x1e')]){delete _0x31156a[_0xf043('0x1e')];}_0x643733[_0xf043('0x13')](_0x5da5c9)[_0xf043('0x1f')](_0x31156a);};}exports[_0xf043('0x20')]=function(_0x3f2f09,_0x1cf0d5){var _0x5dd341={},_0x3b1da5={},_0x286d9a={'count':0x0,'rows':[]};var _0x28fa81=_[_0xf043('0x21')](db[_0xf043('0x22')][_0xf043('0x23')],function(_0x50bf33){return{'name':_0x50bf33[_0xf043('0x24')],'type':_0x50bf33['type'][_0xf043('0x25')]};});_0x3b1da5[_0xf043('0x26')]=_[_0xf043('0x21')](_0x28fa81,_0xf043('0x1e'));_0x3b1da5[_0xf043('0x27')]=_['keys'](_0x3f2f09[_0xf043('0x27')]);_0x3b1da5[_0xf043('0x28')]=_[_0xf043('0x29')](_0x3b1da5[_0xf043('0x26')],_0x3b1da5[_0xf043('0x27')]);_0x5dd341[_0xf043('0x2a')]=_[_0xf043('0x29')](_0x3b1da5[_0xf043('0x26')],qs['fields'](_0x3f2f09[_0xf043('0x27')][_0xf043('0x2b')]));_0x5dd341['attributes']=_0x5dd341[_0xf043('0x2a')]['length']?_0x5dd341[_0xf043('0x2a')]:_0x3b1da5[_0xf043('0x26')];if(!_0x3f2f09[_0xf043('0x27')][_0xf043('0x2c')](_0xf043('0x2d'))){_0x5dd341[_0xf043('0x2e')]=qs[_0xf043('0x2e')](_0x3f2f09[_0xf043('0x27')]['limit']);_0x5dd341[_0xf043('0x15')]=qs[_0xf043('0x15')](_0x3f2f09[_0xf043('0x27')][_0xf043('0x15')]);}_0x5dd341[_0xf043('0x2f')]=qs[_0xf043('0x30')](_0x3f2f09['query'][_0xf043('0x30')]);_0x5dd341[_0xf043('0x31')]=qs['filters'](_[_0xf043('0x32')](_0x3f2f09['query'],_0x3b1da5[_0xf043('0x28')]));if(_0x3f2f09[_0xf043('0x27')][_0xf043('0x33')]){_0x5dd341[_0xf043('0x31')]=_['merge'](_0x5dd341[_0xf043('0x31')],{'$or':_[_0xf043('0x21')](_0x28fa81,function(_0x47b29f){if(_0x47b29f[_0xf043('0x34')]!=='VIRTUAL'){var _0x5ea916={};_0x5ea916[_0x47b29f[_0xf043('0x1e')]]={'$like':'%'+_0x3f2f09[_0xf043('0x27')][_0xf043('0x33')]+'%'};return _0x5ea916;}})});}_0x5dd341=_[_0xf043('0x35')]({},_0x5dd341,_0x3f2f09[_0xf043('0x36')]);var _0x1c4429={'where':_0x5dd341[_0xf043('0x31')]};return db[_0xf043('0x22')][_0xf043('0x37')](_0x1c4429)[_0xf043('0x38')](function(_0x430608){_0x286d9a[_0xf043('0x37')]=_0x430608;if(_0x3f2f09[_0xf043('0x27')][_0xf043('0x39')]){_0x5dd341[_0xf043('0x3a')]=[{'all':!![]}];}return db[_0xf043('0x22')][_0xf043('0x3b')](_0x5dd341);})['then'](function(_0x271784){_0x286d9a[_0xf043('0x3c')]=_0x271784;return _0x286d9a;})[_0xf043('0x38')](respondWithFilteredResult(_0x1cf0d5,_0x5dd341))[_0xf043('0x3d')](handleError(_0x1cf0d5,null));};exports[_0xf043('0x3e')]=function(_0x3d81a1,_0x171480){var _0x2e2210={'raw':!![],'where':{'id':_0x3d81a1[_0xf043('0x3f')]['id']}},_0x1bde9d={};_0x1bde9d['model']=_[_0xf043('0x40')](db[_0xf043('0x22')][_0xf043('0x23')]);_0x1bde9d['query']=_['keys'](_0x3d81a1[_0xf043('0x27')]);_0x1bde9d[_0xf043('0x28')]=_['intersection'](_0x1bde9d[_0xf043('0x26')],_0x1bde9d[_0xf043('0x27')]);_0x2e2210[_0xf043('0x2a')]=_[_0xf043('0x29')](_0x1bde9d[_0xf043('0x26')],qs['fields'](_0x3d81a1[_0xf043('0x27')]['fields']));_0x2e2210[_0xf043('0x2a')]=_0x2e2210[_0xf043('0x2a')][_0xf043('0x41')]?_0x2e2210['attributes']:_0x1bde9d[_0xf043('0x26')];if(_0x3d81a1[_0xf043('0x27')]['includeAll']){_0x2e2210['include']=[{'all':!![]}];}_0x2e2210=_['merge']({},_0x2e2210,_0x3d81a1[_0xf043('0x36')]);return db[_0xf043('0x22')][_0xf043('0x42')](_0x2e2210)['then'](handleEntityNotFound(_0x171480,null))['then'](respondWithResult(_0x171480,null))[_0xf043('0x3d')](handleError(_0x171480,null));};exports['create']=function(_0x39d096,_0x2437cc){return db[_0xf043('0x22')][_0xf043('0x43')](_0x39d096[_0xf043('0x44')],{})[_0xf043('0x38')](respondWithResult(_0x2437cc,0xc9))['catch'](handleError(_0x2437cc,null));};exports[_0xf043('0x1c')]=function(_0x3ebfb8,_0x3ca3e5){if(_0x3ebfb8[_0xf043('0x44')]['id']){delete _0x3ebfb8['body']['id'];}return db[_0xf043('0x22')][_0xf043('0x42')]({'where':{'id':_0x3ebfb8[_0xf043('0x3f')]['id']}})[_0xf043('0x38')](handleEntityNotFound(_0x3ca3e5,null))[_0xf043('0x38')](saveUpdates(_0x3ebfb8[_0xf043('0x44')],null))[_0xf043('0x38')](respondWithResult(_0x3ca3e5,null))[_0xf043('0x3d')](handleError(_0x3ca3e5,null));};exports[_0xf043('0x45')]=function(_0x47a94a,_0x3d448f){return db[_0xf043('0x22')]['find']({'where':{'id':_0x47a94a[_0xf043('0x3f')]['id']}})['then'](handleEntityNotFound(_0x3d448f,null))['then'](removeEntity(_0x3d448f,null))['catch'](handleError(_0x3d448f,null));};exports[_0xf043('0x46')]=function(_0x22b20a,_0xbc65c2){return db[_0xf043('0x22')][_0xf043('0x46')]()[_0xf043('0x38')](respondWithResult(_0xbc65c2,null))[_0xf043('0x3d')](handleError(_0xbc65c2,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