Built motion from commit (unavailable).|2.5.6
[motion2.git] / server / api / memberReport / memberReport.controller.js
index ad29ee4..fc25676 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x31f5=['hasOwnProperty','nolimit','order','where','VIRTUAL','options','include','findAll','catch','params','keys','rawAttributes','fields','includeAll','merge','create','body','find','describe','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','status','json','count','offset','limit','set','Content-Range','apply','reject','update','then','destroy','end','sendStatus','stack','name','index','map','MemberReport','fieldName','type','key','model','query','filters','intersection','attributes','length'];(function(_0xbfe6b8,_0x3c62cb){var _0x87a60a=function(_0x69b502){while(--_0x69b502){_0xbfe6b8['push'](_0xbfe6b8['shift']());}};_0x87a60a(++_0x3c62cb);}(_0x31f5,0x180));var _0x531f=function(_0x1214a1,_0x3daca0){_0x1214a1=_0x1214a1-0x0;var _0x399681=_0x31f5[_0x1214a1];return _0x399681;};'use strict';var pdf=require(_0x531f('0x0'));var emlformat=require(_0x531f('0x1'));var rimraf=require(_0x531f('0x2'));var zipdir=require(_0x531f('0x3'));var jsonpatch=require(_0x531f('0x4'));var rp=require(_0x531f('0x5'));var moment=require('moment');var BPromise=require(_0x531f('0x6'));var Mustache=require(_0x531f('0x7'));var util=require(_0x531f('0x8'));var path=require(_0x531f('0x9'));var sox=require(_0x531f('0xa'));var csv=require(_0x531f('0xb'));var ejs=require(_0x531f('0xc'));var fs=require('fs');var _=require(_0x531f('0xd'));var squel=require(_0x531f('0xe'));var crypto=require(_0x531f('0xf'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x531f('0xb'));var querystring=require(_0x531f('0x10'));var Papa=require(_0x531f('0x11'));var Redis=require(_0x531f('0x12'));var authService=require(_0x531f('0x13'));var qs=require(_0x531f('0x14'));var as=require(_0x531f('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x531f('0x16'));var utils=require(_0x531f('0x17'));var config=require(_0x531f('0x18'));var licenseUtil=require(_0x531f('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3310f2,_0x26687f){_0x26687f=_0x26687f||0xcc;return function(_0x128300){if(_0x128300){return _0x3310f2['sendStatus'](_0x26687f);}return _0x3310f2[_0x531f('0x1a')](_0x26687f)['end']();};}function respondWithResult(_0x14f02f,_0x1ecff0){_0x1ecff0=_0x1ecff0||0xc8;return function(_0x5b790e){if(_0x5b790e){return _0x14f02f['status'](_0x1ecff0)[_0x531f('0x1b')](_0x5b790e);}};}function respondWithFilteredResult(_0x51d4f8,_0x4d660a){return function(_0x35ba9c){if(_0x35ba9c){var _0x45d08d=_0x35ba9c[_0x531f('0x1c')],_0x567e26=_0x4d660a['offset'],_0x4dd904=_0x4d660a[_0x531f('0x1d')]+_0x4d660a[_0x531f('0x1e')],_0x2a5b41;if(_0x4dd904>=_0x45d08d){_0x4dd904=_0x45d08d;_0x2a5b41=0xc8;}else{_0x2a5b41=0xce;}_0x51d4f8[_0x531f('0x1a')](_0x2a5b41);return _0x51d4f8[_0x531f('0x1f')](_0x531f('0x20'),_0x567e26+'-'+_0x4dd904+'/'+_0x45d08d)['json'](_0x35ba9c);}return null;};}function patchUpdates(_0x109c08){return function(_0x42419d){try{jsonpatch[_0x531f('0x21')](_0x42419d,_0x109c08,!![]);}catch(_0x309e6e){return BPromise[_0x531f('0x22')](_0x309e6e);}return _0x42419d['save']();};}function saveUpdates(_0x263866,_0x85d676){return function(_0x1e3c16){if(_0x1e3c16){return _0x1e3c16[_0x531f('0x23')](_0x263866)[_0x531f('0x24')](function(_0xe198c7){return _0xe198c7;});}return null;};}function removeEntity(_0x1b12be,_0xe08577){return function(_0x2f6492){if(_0x2f6492){return _0x2f6492[_0x531f('0x25')]()['then'](function(){_0x1b12be['status'](0xcc)[_0x531f('0x26')]();});}};}function handleEntityNotFound(_0x5d31fa,_0x3e8939){return function(_0x2628da){if(!_0x2628da){_0x5d31fa[_0x531f('0x27')](0x194);}return _0x2628da;};}function handleError(_0x47f01e,_0x26c694){_0x26c694=_0x26c694||0x1f4;return function(_0x2a5807){logger['error'](_0x2a5807[_0x531f('0x28')]);if(_0x2a5807[_0x531f('0x29')]){delete _0x2a5807[_0x531f('0x29')];}_0x47f01e['status'](_0x26c694)['send'](_0x2a5807);};}exports[_0x531f('0x2a')]=function(_0x31843f,_0x1ad967){var _0xb091fb={},_0x7dc969={},_0x147b0d={'count':0x0,'rows':[]};var _0x560f64=_[_0x531f('0x2b')](db[_0x531f('0x2c')]['rawAttributes'],function(_0x1599b0){return{'name':_0x1599b0[_0x531f('0x2d')],'type':_0x1599b0[_0x531f('0x2e')][_0x531f('0x2f')]};});_0x7dc969[_0x531f('0x30')]=_[_0x531f('0x2b')](_0x560f64,_0x531f('0x29'));_0x7dc969[_0x531f('0x31')]=_['keys'](_0x31843f['query']);_0x7dc969[_0x531f('0x32')]=_[_0x531f('0x33')](_0x7dc969['model'],_0x7dc969[_0x531f('0x31')]);_0xb091fb[_0x531f('0x34')]=_[_0x531f('0x33')](_0x7dc969[_0x531f('0x30')],qs['fields'](_0x31843f[_0x531f('0x31')]['fields']));_0xb091fb[_0x531f('0x34')]=_0xb091fb['attributes'][_0x531f('0x35')]?_0xb091fb['attributes']:_0x7dc969[_0x531f('0x30')];if(!_0x31843f['query'][_0x531f('0x36')](_0x531f('0x37'))){_0xb091fb[_0x531f('0x1e')]=qs[_0x531f('0x1e')](_0x31843f[_0x531f('0x31')][_0x531f('0x1e')]);_0xb091fb[_0x531f('0x1d')]=qs[_0x531f('0x1d')](_0x31843f[_0x531f('0x31')]['offset']);}_0xb091fb[_0x531f('0x38')]=qs['sort'](_0x31843f[_0x531f('0x31')]['sort']);_0xb091fb['where']=qs[_0x531f('0x32')](_['pick'](_0x31843f[_0x531f('0x31')],_0x7dc969[_0x531f('0x32')]),_0x560f64);if(_0x31843f[_0x531f('0x31')]['filter']){_0xb091fb[_0x531f('0x39')]=_['merge'](_0xb091fb['where'],{'$or':_[_0x531f('0x2b')](_0x560f64,function(_0x4d9251){if(_0x4d9251['type']!==_0x531f('0x3a')){var _0x2cafa3={};_0x2cafa3[_0x4d9251['name']]={'$like':'%'+_0x31843f[_0x531f('0x31')]['filter']+'%'};return _0x2cafa3;}})});}_0xb091fb=_['merge']({},_0xb091fb,_0x31843f[_0x531f('0x3b')]);var _0x259de6={'where':_0xb091fb['where']};return db[_0x531f('0x2c')][_0x531f('0x1c')](_0x259de6)['then'](function(_0x526edb){_0x147b0d[_0x531f('0x1c')]=_0x526edb;if(_0x31843f[_0x531f('0x31')]['includeAll']){_0xb091fb[_0x531f('0x3c')]=[{'all':!![]}];}return db[_0x531f('0x2c')][_0x531f('0x3d')](_0xb091fb);})[_0x531f('0x24')](function(_0x12b4a2){_0x147b0d['rows']=_0x12b4a2;return _0x147b0d;})[_0x531f('0x24')](respondWithFilteredResult(_0x1ad967,_0xb091fb))[_0x531f('0x3e')](handleError(_0x1ad967,null));};exports['show']=function(_0xf95b0,_0x4ef0ee){var _0x5d843b={'raw':!![],'where':{'id':_0xf95b0[_0x531f('0x3f')]['id']}},_0x88f9b2={};_0x88f9b2[_0x531f('0x30')]=_[_0x531f('0x40')](db[_0x531f('0x2c')][_0x531f('0x41')]);_0x88f9b2['query']=_[_0x531f('0x40')](_0xf95b0['query']);_0x88f9b2[_0x531f('0x32')]=_[_0x531f('0x33')](_0x88f9b2[_0x531f('0x30')],_0x88f9b2[_0x531f('0x31')]);_0x5d843b[_0x531f('0x34')]=_[_0x531f('0x33')](_0x88f9b2[_0x531f('0x30')],qs[_0x531f('0x42')](_0xf95b0[_0x531f('0x31')][_0x531f('0x42')]));_0x5d843b['attributes']=_0x5d843b['attributes'][_0x531f('0x35')]?_0x5d843b[_0x531f('0x34')]:_0x88f9b2['model'];if(_0xf95b0['query'][_0x531f('0x43')]){_0x5d843b[_0x531f('0x3c')]=[{'all':!![]}];}_0x5d843b=_[_0x531f('0x44')]({},_0x5d843b,_0xf95b0[_0x531f('0x3b')]);return db['MemberReport']['find'](_0x5d843b)['then'](handleEntityNotFound(_0x4ef0ee,null))[_0x531f('0x24')](respondWithResult(_0x4ef0ee,null))[_0x531f('0x3e')](handleError(_0x4ef0ee,null));};exports[_0x531f('0x45')]=function(_0x238e7c,_0x2c2865){return db['MemberReport']['create'](_0x238e7c[_0x531f('0x46')],{})[_0x531f('0x24')](respondWithResult(_0x2c2865,0xc9))['catch'](handleError(_0x2c2865,null));};exports[_0x531f('0x23')]=function(_0x51888d,_0x4d1621){if(_0x51888d['body']['id']){delete _0x51888d[_0x531f('0x46')]['id'];}return db[_0x531f('0x2c')][_0x531f('0x47')]({'where':{'id':_0x51888d['params']['id']}})['then'](handleEntityNotFound(_0x4d1621,null))[_0x531f('0x24')](saveUpdates(_0x51888d['body'],null))[_0x531f('0x24')](respondWithResult(_0x4d1621,null))[_0x531f('0x3e')](handleError(_0x4d1621,null));};exports['destroy']=function(_0x859c1f,_0x191705){return db['MemberReport'][_0x531f('0x47')]({'where':{'id':_0x859c1f[_0x531f('0x3f')]['id']}})[_0x531f('0x24')](handleEntityNotFound(_0x191705,null))[_0x531f('0x24')](removeEntity(_0x191705,null))[_0x531f('0x3e')](handleError(_0x191705,null));};exports[_0x531f('0x48')]=function(_0x1761c9,_0x2ce3ab){return db[_0x531f('0x2c')]['describe']()[_0x531f('0x24')](respondWithResult(_0x2ce3ab,null))[_0x531f('0x3e')](handleError(_0x2ce3ab,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