Built motion from commit 3e059bc2.|2.5.32
[motion2.git] / server / api / jscriptyQuestionReport / jscriptyQuestionReport.controller.js
index 8c74966..19d4fa4 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x91a7=['options','findAll','rows','catch','rawAttributes','includeAll','include','find','create','body','params','describe','rimraf','zip-dir','fast-json-patch','moment','mustache','sox','to-csv','fs-extra','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined','count','set','Content-Range','apply','save','update','then','destroy','error','stack','name','send','index','map','JscriptyQuestionReport','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','limit','order','sort','filter','merge','where','VIRTUAL'];(function(_0x5d425c,_0x1acb5c){var _0x4b01c3=function(_0x18388b){while(--_0x18388b){_0x5d425c['push'](_0x5d425c['shift']());}};_0x4b01c3(++_0x1acb5c);}(_0x91a7,0xe7));var _0x791a=function(_0x6816dc,_0x1359f6){_0x6816dc=_0x6816dc-0x0;var _0x183599=_0x91a7[_0x6816dc];return _0x183599;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x791a('0x0'));var zipdir=require(_0x791a('0x1'));var jsonpatch=require(_0x791a('0x2'));var rp=require('request-promise');var moment=require(_0x791a('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x791a('0x4'));var util=require('util');var path=require('path');var sox=require(_0x791a('0x5'));var csv=require(_0x791a('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x791a('0x7'));var _=require('lodash');var squel=require(_0x791a('0x8'));var crypto=require(_0x791a('0x9'));var jsforce=require('jsforce');var deskjs=require(_0x791a('0xa'));var toCsv=require(_0x791a('0x6'));var querystring=require(_0x791a('0xb'));var Papa=require(_0x791a('0xc'));var Redis=require(_0x791a('0xd'));var authService=require('../../components/auth/service');var qs=require(_0x791a('0xe'));var as=require(_0x791a('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x791a('0x10'))(_0x791a('0x11'));var utils=require(_0x791a('0x12'));var config=require(_0x791a('0x13'));var licenseUtil=require(_0x791a('0x14'));var db=require(_0x791a('0x15'))['db'];function respondWithStatusCode(_0x53dc41,_0x5daecd){_0x5daecd=_0x5daecd||0xcc;return function(_0xc92016){if(_0xc92016){return _0x53dc41[_0x791a('0x16')](_0x5daecd);}return _0x53dc41['status'](_0x5daecd)[_0x791a('0x17')]();};}function respondWithResult(_0x3a2ec6,_0x5d5b11){_0x5d5b11=_0x5d5b11||0xc8;return function(_0x2887f0){if(_0x2887f0){return _0x3a2ec6[_0x791a('0x18')](_0x5d5b11)[_0x791a('0x19')](_0x2887f0);}};}function respondWithFilteredResult(_0x5cdf2,_0x55e845){return function(_0x2ce2e0){if(_0x2ce2e0){var _0x575d11=typeof _0x55e845[_0x791a('0x1a')]===_0x791a('0x1b')&&typeof _0x55e845['limit']===_0x791a('0x1b');var _0x5bea2e=_0x2ce2e0[_0x791a('0x1c')];var _0x52941d=_0x575d11?0x0:_0x55e845['offset'];var _0x588d00=_0x575d11?_0x2ce2e0[_0x791a('0x1c')]:_0x55e845['offset']+_0x55e845['limit'];var _0x39c60b;if(_0x588d00>=_0x5bea2e){_0x588d00=_0x5bea2e;_0x39c60b=0xc8;}else{_0x39c60b=0xce;}_0x5cdf2[_0x791a('0x18')](_0x39c60b);return _0x5cdf2[_0x791a('0x1d')](_0x791a('0x1e'),_0x52941d+'-'+_0x588d00+'/'+_0x5bea2e)['json'](_0x2ce2e0);}return null;};}function patchUpdates(_0x189c0d){return function(_0xcb5e66){try{jsonpatch[_0x791a('0x1f')](_0xcb5e66,_0x189c0d,!![]);}catch(_0x280f1e){return BPromise['reject'](_0x280f1e);}return _0xcb5e66[_0x791a('0x20')]();};}function saveUpdates(_0x2054c6,_0x25bae5){return function(_0x9e17b5){if(_0x9e17b5){return _0x9e17b5[_0x791a('0x21')](_0x2054c6)[_0x791a('0x22')](function(_0x2241a0){return _0x2241a0;});}return null;};}function removeEntity(_0x45a67d,_0x323c6a){return function(_0xe8e452){if(_0xe8e452){return _0xe8e452[_0x791a('0x23')]()['then'](function(){_0x45a67d[_0x791a('0x18')](0xcc)[_0x791a('0x17')]();});}};}function handleEntityNotFound(_0x380329,_0x2966b8){return function(_0x4d748a){if(!_0x4d748a){_0x380329[_0x791a('0x16')](0x194);}return _0x4d748a;};}function handleError(_0x2db3f7,_0x51dcca){_0x51dcca=_0x51dcca||0x1f4;return function(_0xdfa84f){logger[_0x791a('0x24')](_0xdfa84f[_0x791a('0x25')]);if(_0xdfa84f['name']){delete _0xdfa84f[_0x791a('0x26')];}_0x2db3f7[_0x791a('0x18')](_0x51dcca)[_0x791a('0x27')](_0xdfa84f);};}exports[_0x791a('0x28')]=function(_0x4f423,_0x1a9c6b){var _0x628816={},_0x889534={},_0x58bbc0={'count':0x0,'rows':[]};var _0xbc3436=_[_0x791a('0x29')](db[_0x791a('0x2a')]['rawAttributes'],function(_0x1cdda9){return{'name':_0x1cdda9['fieldName'],'type':_0x1cdda9[_0x791a('0x2b')][_0x791a('0x2c')]};});_0x889534[_0x791a('0x2d')]=_[_0x791a('0x29')](_0xbc3436,_0x791a('0x26'));_0x889534[_0x791a('0x2e')]=_[_0x791a('0x2f')](_0x4f423['query']);_0x889534[_0x791a('0x30')]=_[_0x791a('0x31')](_0x889534[_0x791a('0x2d')],_0x889534[_0x791a('0x2e')]);_0x628816[_0x791a('0x32')]=_['intersection'](_0x889534[_0x791a('0x2d')],qs[_0x791a('0x33')](_0x4f423[_0x791a('0x2e')][_0x791a('0x33')]));_0x628816[_0x791a('0x32')]=_0x628816['attributes'][_0x791a('0x34')]?_0x628816[_0x791a('0x32')]:_0x889534[_0x791a('0x2d')];if(!_0x4f423[_0x791a('0x2e')][_0x791a('0x35')]('nolimit')){_0x628816[_0x791a('0x36')]=qs['limit'](_0x4f423[_0x791a('0x2e')]['limit']);_0x628816['offset']=qs[_0x791a('0x1a')](_0x4f423[_0x791a('0x2e')][_0x791a('0x1a')]);}_0x628816[_0x791a('0x37')]=qs[_0x791a('0x38')](_0x4f423[_0x791a('0x2e')][_0x791a('0x38')]);_0x628816['where']=qs[_0x791a('0x30')](_['pick'](_0x4f423[_0x791a('0x2e')],_0x889534['filters']),_0xbc3436);if(_0x4f423[_0x791a('0x2e')][_0x791a('0x39')]){_0x628816['where']=_[_0x791a('0x3a')](_0x628816[_0x791a('0x3b')],{'$or':_['map'](_0xbc3436,function(_0x45fbfa){if(_0x45fbfa[_0x791a('0x2b')]!==_0x791a('0x3c')){var _0x23db7d={};_0x23db7d[_0x45fbfa[_0x791a('0x26')]]={'$like':'%'+_0x4f423[_0x791a('0x2e')][_0x791a('0x39')]+'%'};return _0x23db7d;}})});}_0x628816=_[_0x791a('0x3a')]({},_0x628816,_0x4f423[_0x791a('0x3d')]);var _0xeafbb5={'where':_0x628816['where']};return db[_0x791a('0x2a')][_0x791a('0x1c')](_0xeafbb5)[_0x791a('0x22')](function(_0x4efbf6){_0x58bbc0[_0x791a('0x1c')]=_0x4efbf6;if(_0x4f423['query']['includeAll']){_0x628816['include']=[{'all':!![]}];}return db[_0x791a('0x2a')][_0x791a('0x3e')](_0x628816);})['then'](function(_0x415c44){_0x58bbc0[_0x791a('0x3f')]=_0x415c44;return _0x58bbc0;})[_0x791a('0x22')](respondWithFilteredResult(_0x1a9c6b,_0x628816))[_0x791a('0x40')](handleError(_0x1a9c6b,null));};exports['show']=function(_0x483336,_0x57b9ba){var _0x2f0395={'raw':!![],'where':{'id':_0x483336['params']['id']}},_0x216dd3={};_0x216dd3[_0x791a('0x2d')]=_[_0x791a('0x2f')](db[_0x791a('0x2a')][_0x791a('0x41')]);_0x216dd3['query']=_[_0x791a('0x2f')](_0x483336['query']);_0x216dd3[_0x791a('0x30')]=_[_0x791a('0x31')](_0x216dd3[_0x791a('0x2d')],_0x216dd3[_0x791a('0x2e')]);_0x2f0395[_0x791a('0x32')]=_['intersection'](_0x216dd3[_0x791a('0x2d')],qs[_0x791a('0x33')](_0x483336[_0x791a('0x2e')][_0x791a('0x33')]));_0x2f0395[_0x791a('0x32')]=_0x2f0395['attributes'][_0x791a('0x34')]?_0x2f0395[_0x791a('0x32')]:_0x216dd3['model'];if(_0x483336['query'][_0x791a('0x42')]){_0x2f0395[_0x791a('0x43')]=[{'all':!![]}];}_0x2f0395=_[_0x791a('0x3a')]({},_0x2f0395,_0x483336['options']);return db['JscriptyQuestionReport'][_0x791a('0x44')](_0x2f0395)[_0x791a('0x22')](handleEntityNotFound(_0x57b9ba,null))['then'](respondWithResult(_0x57b9ba,null))[_0x791a('0x40')](handleError(_0x57b9ba,null));};exports[_0x791a('0x45')]=function(_0x3eac77,_0x549980){return db['JscriptyQuestionReport'][_0x791a('0x45')](_0x3eac77[_0x791a('0x46')],{})[_0x791a('0x22')](respondWithResult(_0x549980,0xc9))[_0x791a('0x40')](handleError(_0x549980,null));};exports['update']=function(_0x2d7c7d,_0x9f768a){if(_0x2d7c7d[_0x791a('0x46')]['id']){delete _0x2d7c7d[_0x791a('0x46')]['id'];}return db['JscriptyQuestionReport'][_0x791a('0x44')]({'where':{'id':_0x2d7c7d[_0x791a('0x47')]['id']}})[_0x791a('0x22')](handleEntityNotFound(_0x9f768a,null))[_0x791a('0x22')](saveUpdates(_0x2d7c7d[_0x791a('0x46')],null))[_0x791a('0x22')](respondWithResult(_0x9f768a,null))[_0x791a('0x40')](handleError(_0x9f768a,null));};exports['destroy']=function(_0xdcb1b,_0x1fd826){return db['JscriptyQuestionReport'][_0x791a('0x44')]({'where':{'id':_0xdcb1b[_0x791a('0x47')]['id']}})['then'](handleEntityNotFound(_0x1fd826,null))[_0x791a('0x22')](removeEntity(_0x1fd826,null))[_0x791a('0x40')](handleError(_0x1fd826,null));};exports[_0x791a('0x48')]=function(_0x2e357c,_0xd5ec90){return db['JscriptyQuestionReport']['describe']()['then'](respondWithResult(_0xd5ec90,null))[_0x791a('0x40')](handleError(_0xd5ec90,null));};
\ No newline at end of file
+var _0x741f=['map','JscriptyQuestionReport','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','catch','params','rawAttributes','find','create','body','destroy','eml-format','zip-dir','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','then','end','stack','name','send','index'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x741f,0x100));var _0xf741=function(_0x2dd8de,_0x1c354a){_0x2dd8de=_0x2dd8de-0x0;var _0x3987ba=_0x741f[_0x2dd8de];return _0x3987ba;};'use strict';var emlformat=require(_0xf741('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xf741('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xf741('0x2'));var BPromise=require(_0xf741('0x3'));var Mustache=require(_0xf741('0x4'));var util=require(_0xf741('0x5'));var path=require(_0xf741('0x6'));var sox=require(_0xf741('0x7'));var csv=require(_0xf741('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xf741('0x9'));var _=require(_0xf741('0xa'));var squel=require(_0xf741('0xb'));var crypto=require(_0xf741('0xc'));var jsforce=require(_0xf741('0xd'));var deskjs=require(_0xf741('0xe'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xf741('0xf'));var Redis=require(_0xf741('0x10'));var authService=require(_0xf741('0x11'));var qs=require(_0xf741('0x12'));var as=require(_0xf741('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xf741('0x14'))(_0xf741('0x15'));var utils=require(_0xf741('0x16'));var config=require(_0xf741('0x17'));var licenseUtil=require(_0xf741('0x18'));var db=require(_0xf741('0x19'))['db'];function respondWithStatusCode(_0x34242f,_0x507975){_0x507975=_0x507975||0xcc;return function(_0x30c90c){if(_0x30c90c){return _0x34242f[_0xf741('0x1a')](_0x507975);}return _0x34242f[_0xf741('0x1b')](_0x507975)['end']();};}function respondWithResult(_0x3fa277,_0x326080){_0x326080=_0x326080||0xc8;return function(_0x213525){if(_0x213525){return _0x3fa277[_0xf741('0x1b')](_0x326080)[_0xf741('0x1c')](_0x213525);}};}function respondWithFilteredResult(_0x111ebf,_0x3670e3){return function(_0x47c7e7){if(_0x47c7e7){var _0x5c3b0b=typeof _0x3670e3[_0xf741('0x1d')]===_0xf741('0x1e')&&typeof _0x3670e3[_0xf741('0x1f')]===_0xf741('0x1e');var _0x2eb920=_0x47c7e7[_0xf741('0x20')];var _0x36a896=_0x5c3b0b?0x0:_0x3670e3[_0xf741('0x1d')];var _0x1253f1=_0x5c3b0b?_0x47c7e7['count']:_0x3670e3['offset']+_0x3670e3[_0xf741('0x1f')];var _0x57664c;if(_0x1253f1>=_0x2eb920){_0x1253f1=_0x2eb920;_0x57664c=0xc8;}else{_0x57664c=0xce;}_0x111ebf[_0xf741('0x1b')](_0x57664c);return _0x111ebf[_0xf741('0x21')](_0xf741('0x22'),_0x36a896+'-'+_0x1253f1+'/'+_0x2eb920)[_0xf741('0x1c')](_0x47c7e7);}return null;};}function patchUpdates(_0x5a7ff4){return function(_0x54da51){try{jsonpatch['apply'](_0x54da51,_0x5a7ff4,!![]);}catch(_0x5c05d1){return BPromise[_0xf741('0x23')](_0x5c05d1);}return _0x54da51[_0xf741('0x24')]();};}function saveUpdates(_0x227cc4,_0x4317dd){return function(_0x2fd965){if(_0x2fd965){return _0x2fd965[_0xf741('0x25')](_0x227cc4)['then'](function(_0x12f77d){return _0x12f77d;});}return null;};}function removeEntity(_0x2676a9,_0x4a680a){return function(_0x466a02){if(_0x466a02){return _0x466a02['destroy']()[_0xf741('0x26')](function(){_0x2676a9[_0xf741('0x1b')](0xcc)[_0xf741('0x27')]();});}};}function handleEntityNotFound(_0x1445a5,_0x4c3271){return function(_0x1c9a21){if(!_0x1c9a21){_0x1445a5[_0xf741('0x1a')](0x194);}return _0x1c9a21;};}function handleError(_0x150bdb,_0x438120){_0x438120=_0x438120||0x1f4;return function(_0x146a3f){logger['error'](_0x146a3f[_0xf741('0x28')]);if(_0x146a3f[_0xf741('0x29')]){delete _0x146a3f[_0xf741('0x29')];}_0x150bdb[_0xf741('0x1b')](_0x438120)[_0xf741('0x2a')](_0x146a3f);};}exports[_0xf741('0x2b')]=function(_0x322a6b,_0x768c25){var _0x4af590={},_0x145d67={},_0x23133a={'count':0x0,'rows':[]};var _0x4c99cb=_[_0xf741('0x2c')](db[_0xf741('0x2d')]['rawAttributes'],function(_0x3c6e40){return{'name':_0x3c6e40[_0xf741('0x2e')],'type':_0x3c6e40[_0xf741('0x2f')][_0xf741('0x30')]};});_0x145d67[_0xf741('0x31')]=_['map'](_0x4c99cb,'name');_0x145d67[_0xf741('0x32')]=_[_0xf741('0x33')](_0x322a6b[_0xf741('0x32')]);_0x145d67[_0xf741('0x34')]=_[_0xf741('0x35')](_0x145d67[_0xf741('0x31')],_0x145d67['query']);_0x4af590[_0xf741('0x36')]=_[_0xf741('0x35')](_0x145d67['model'],qs[_0xf741('0x37')](_0x322a6b['query'][_0xf741('0x37')]));_0x4af590['attributes']=_0x4af590[_0xf741('0x36')][_0xf741('0x38')]?_0x4af590[_0xf741('0x36')]:_0x145d67[_0xf741('0x31')];if(!_0x322a6b[_0xf741('0x32')][_0xf741('0x39')](_0xf741('0x3a'))){_0x4af590['limit']=qs[_0xf741('0x1f')](_0x322a6b[_0xf741('0x32')][_0xf741('0x1f')]);_0x4af590[_0xf741('0x1d')]=qs[_0xf741('0x1d')](_0x322a6b[_0xf741('0x32')]['offset']);}_0x4af590[_0xf741('0x3b')]=qs[_0xf741('0x3c')](_0x322a6b[_0xf741('0x32')][_0xf741('0x3c')]);_0x4af590[_0xf741('0x3d')]=qs['filters'](_[_0xf741('0x3e')](_0x322a6b[_0xf741('0x32')],_0x145d67[_0xf741('0x34')]),_0x4c99cb);if(_0x322a6b[_0xf741('0x32')][_0xf741('0x3f')]){_0x4af590[_0xf741('0x3d')]=_[_0xf741('0x40')](_0x4af590['where'],{'$or':_[_0xf741('0x2c')](_0x4c99cb,function(_0x5cd923){if(_0x5cd923['type']!==_0xf741('0x41')){var _0x125fc6={};_0x125fc6[_0x5cd923[_0xf741('0x29')]]={'$like':'%'+_0x322a6b['query']['filter']+'%'};return _0x125fc6;}})});}_0x4af590=_[_0xf741('0x40')]({},_0x4af590,_0x322a6b[_0xf741('0x42')]);var _0x4f3bfe={'where':_0x4af590[_0xf741('0x3d')]};return db[_0xf741('0x2d')][_0xf741('0x20')](_0x4f3bfe)[_0xf741('0x26')](function(_0x1cdabc){_0x23133a[_0xf741('0x20')]=_0x1cdabc;if(_0x322a6b[_0xf741('0x32')][_0xf741('0x43')]){_0x4af590['include']=[{'all':!![]}];}return db[_0xf741('0x2d')]['findAll'](_0x4af590);})[_0xf741('0x26')](function(_0x2cf8de){_0x23133a['rows']=_0x2cf8de;return _0x23133a;})['then'](respondWithFilteredResult(_0x768c25,_0x4af590))[_0xf741('0x44')](handleError(_0x768c25,null));};exports['show']=function(_0x4cd731,_0x3ecc91){var _0x545509={'raw':!![],'where':{'id':_0x4cd731[_0xf741('0x45')]['id']}},_0x438a26={};_0x438a26['model']=_['keys'](db[_0xf741('0x2d')][_0xf741('0x46')]);_0x438a26[_0xf741('0x32')]=_[_0xf741('0x33')](_0x4cd731['query']);_0x438a26[_0xf741('0x34')]=_['intersection'](_0x438a26[_0xf741('0x31')],_0x438a26['query']);_0x545509['attributes']=_['intersection'](_0x438a26[_0xf741('0x31')],qs[_0xf741('0x37')](_0x4cd731['query']['fields']));_0x545509[_0xf741('0x36')]=_0x545509[_0xf741('0x36')][_0xf741('0x38')]?_0x545509[_0xf741('0x36')]:_0x438a26[_0xf741('0x31')];if(_0x4cd731['query'][_0xf741('0x43')]){_0x545509['include']=[{'all':!![]}];}_0x545509=_[_0xf741('0x40')]({},_0x545509,_0x4cd731[_0xf741('0x42')]);return db[_0xf741('0x2d')][_0xf741('0x47')](_0x545509)[_0xf741('0x26')](handleEntityNotFound(_0x3ecc91,null))[_0xf741('0x26')](respondWithResult(_0x3ecc91,null))[_0xf741('0x44')](handleError(_0x3ecc91,null));};exports[_0xf741('0x48')]=function(_0x45b5cc,_0x2029a9){return db['JscriptyQuestionReport'][_0xf741('0x48')](_0x45b5cc['body'],{})[_0xf741('0x26')](respondWithResult(_0x2029a9,0xc9))[_0xf741('0x44')](handleError(_0x2029a9,null));};exports[_0xf741('0x25')]=function(_0x300ef7,_0x24eefd){if(_0x300ef7[_0xf741('0x49')]['id']){delete _0x300ef7[_0xf741('0x49')]['id'];}return db[_0xf741('0x2d')]['find']({'where':{'id':_0x300ef7[_0xf741('0x45')]['id']}})[_0xf741('0x26')](handleEntityNotFound(_0x24eefd,null))[_0xf741('0x26')](saveUpdates(_0x300ef7[_0xf741('0x49')],null))[_0xf741('0x26')](respondWithResult(_0x24eefd,null))[_0xf741('0x44')](handleError(_0x24eefd,null));};exports[_0xf741('0x4a')]=function(_0x4ce820,_0x859039){return db[_0xf741('0x2d')][_0xf741('0x47')]({'where':{'id':_0x4ce820[_0xf741('0x45')]['id']}})[_0xf741('0x26')](handleEntityNotFound(_0x859039,null))['then'](removeEntity(_0x859039,null))[_0xf741('0x44')](handleError(_0x859039,null));};exports['describe']=function(_0x46a901,_0x5914eb){return db[_0xf741('0x2d')]['describe']()[_0xf741('0x26')](respondWithResult(_0x5914eb,null))['catch'](handleError(_0x5914eb,null));};
\ No newline at end of file