Built motion from commit 3e059bc2.|2.5.32
[motion2.git] / server / api / jscriptyQuestionReport / jscriptyQuestionReport.controller.js
index 914c563..19d4fa4 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xa26a=['update','then','destroy','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','merge','VIRTUAL','filter','options','includeAll','include','JscriptyQuestionReport','findAll','catch','keys','create','body','find','params','describe','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','mustache','util','path','to-csv','ejs','crypto','jsforce','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/license/util','../../mysqldb','sendStatus','status','end','json','count','offset','limit','Content-Range','reject','save'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xa26a,0x72));var _0xaa26=function(_0x2bee2a,_0x3218e8){_0x2bee2a=_0x2bee2a-0x0;var _0x4407ce=_0xa26a[_0x2bee2a];return _0x4407ce;};'use strict';var pdf=require(_0xaa26('0x0'));var emlformat=require(_0xaa26('0x1'));var rimraf=require(_0xaa26('0x2'));var zipdir=require(_0xaa26('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0xaa26('0x4'));var moment=require(_0xaa26('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xaa26('0x6'));var util=require(_0xaa26('0x7'));var path=require(_0xaa26('0x8'));var sox=require('sox');var csv=require(_0xaa26('0x9'));var ejs=require(_0xaa26('0xa'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0xaa26('0xb'));var jsforce=require(_0xaa26('0xc'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xaa26('0xd'));var Papa=require(_0xaa26('0xe'));var Redis=require(_0xaa26('0xf'));var authService=require('../../components/auth/service');var qs=require(_0xaa26('0x10'));var as=require(_0xaa26('0x11'));var hardwareService=require(_0xaa26('0x12'));var logger=require(_0xaa26('0x13'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xaa26('0x14'));var db=require(_0xaa26('0x15'))['db'];function respondWithStatusCode(_0x2eb4f2,_0x13fcd3){_0x13fcd3=_0x13fcd3||0xcc;return function(_0x1b72fc){if(_0x1b72fc){return _0x2eb4f2[_0xaa26('0x16')](_0x13fcd3);}return _0x2eb4f2[_0xaa26('0x17')](_0x13fcd3)[_0xaa26('0x18')]();};}function respondWithResult(_0x2dc724,_0x4d9bf6){_0x4d9bf6=_0x4d9bf6||0xc8;return function(_0x5dfc2c){if(_0x5dfc2c){return _0x2dc724[_0xaa26('0x17')](_0x4d9bf6)[_0xaa26('0x19')](_0x5dfc2c);}};}function respondWithFilteredResult(_0x3849bc,_0x1098c4){return function(_0x1c0dba){if(_0x1c0dba){var _0x3edd50=_0x1c0dba[_0xaa26('0x1a')],_0x4202cf=_0x1098c4['offset'],_0x271e0d=_0x1098c4[_0xaa26('0x1b')]+_0x1098c4[_0xaa26('0x1c')],_0x14e7cb;if(_0x271e0d>=_0x3edd50){_0x271e0d=_0x3edd50;_0x14e7cb=0xc8;}else{_0x14e7cb=0xce;}_0x3849bc[_0xaa26('0x17')](_0x14e7cb);return _0x3849bc['set'](_0xaa26('0x1d'),_0x4202cf+'-'+_0x271e0d+'/'+_0x3edd50)[_0xaa26('0x19')](_0x1c0dba);}return null;};}function patchUpdates(_0x24f86a){return function(_0x514ee0){try{jsonpatch['apply'](_0x514ee0,_0x24f86a,!![]);}catch(_0x10436d){return BPromise[_0xaa26('0x1e')](_0x10436d);}return _0x514ee0[_0xaa26('0x1f')]();};}function saveUpdates(_0x33c75a,_0x36cc87){return function(_0x473f66){if(_0x473f66){return _0x473f66[_0xaa26('0x20')](_0x33c75a)[_0xaa26('0x21')](function(_0xdaac88){return _0xdaac88;});}return null;};}function removeEntity(_0x2222a1,_0x2e40d9){return function(_0x12bdab){if(_0x12bdab){return _0x12bdab[_0xaa26('0x22')]()[_0xaa26('0x21')](function(){_0x2222a1[_0xaa26('0x17')](0xcc)[_0xaa26('0x18')]();});}};}function handleEntityNotFound(_0x3ade96,_0x5520e4){return function(_0x4e045c){if(!_0x4e045c){_0x3ade96[_0xaa26('0x16')](0x194);}return _0x4e045c;};}function handleError(_0x597191,_0x1342be){_0x1342be=_0x1342be||0x1f4;return function(_0x2be137){logger[_0xaa26('0x23')](_0x2be137[_0xaa26('0x24')]);if(_0x2be137[_0xaa26('0x25')]){delete _0x2be137['name'];}_0x597191[_0xaa26('0x17')](_0x1342be)[_0xaa26('0x26')](_0x2be137);};}exports[_0xaa26('0x27')]=function(_0x24042d,_0x5d8e59){var _0x2c850a={},_0x17b476={},_0xd3664b={'count':0x0,'rows':[]};var _0x455d3e=_[_0xaa26('0x28')](db['JscriptyQuestionReport'][_0xaa26('0x29')],function(_0x5f5049){return{'name':_0x5f5049[_0xaa26('0x2a')],'type':_0x5f5049[_0xaa26('0x2b')][_0xaa26('0x2c')]};});_0x17b476[_0xaa26('0x2d')]=_[_0xaa26('0x28')](_0x455d3e,'name');_0x17b476['query']=_['keys'](_0x24042d[_0xaa26('0x2e')]);_0x17b476['filters']=_[_0xaa26('0x2f')](_0x17b476['model'],_0x17b476[_0xaa26('0x2e')]);_0x2c850a[_0xaa26('0x30')]=_['intersection'](_0x17b476[_0xaa26('0x2d')],qs[_0xaa26('0x31')](_0x24042d[_0xaa26('0x2e')][_0xaa26('0x31')]));_0x2c850a[_0xaa26('0x30')]=_0x2c850a[_0xaa26('0x30')][_0xaa26('0x32')]?_0x2c850a[_0xaa26('0x30')]:_0x17b476[_0xaa26('0x2d')];if(!_0x24042d[_0xaa26('0x2e')][_0xaa26('0x33')](_0xaa26('0x34'))){_0x2c850a[_0xaa26('0x1c')]=qs[_0xaa26('0x1c')](_0x24042d[_0xaa26('0x2e')][_0xaa26('0x1c')]);_0x2c850a['offset']=qs[_0xaa26('0x1b')](_0x24042d[_0xaa26('0x2e')]['offset']);}_0x2c850a[_0xaa26('0x35')]=qs[_0xaa26('0x36')](_0x24042d[_0xaa26('0x2e')]['sort']);_0x2c850a[_0xaa26('0x37')]=qs[_0xaa26('0x38')](_[_0xaa26('0x39')](_0x24042d[_0xaa26('0x2e')],_0x17b476['filters']),_0x455d3e);if(_0x24042d['query']['filter']){_0x2c850a[_0xaa26('0x37')]=_[_0xaa26('0x3a')](_0x2c850a[_0xaa26('0x37')],{'$or':_['map'](_0x455d3e,function(_0x57f832){if(_0x57f832[_0xaa26('0x2b')]!==_0xaa26('0x3b')){var _0x334c91={};_0x334c91[_0x57f832[_0xaa26('0x25')]]={'$like':'%'+_0x24042d[_0xaa26('0x2e')][_0xaa26('0x3c')]+'%'};return _0x334c91;}})});}_0x2c850a=_[_0xaa26('0x3a')]({},_0x2c850a,_0x24042d[_0xaa26('0x3d')]);var _0x1495e1={'where':_0x2c850a[_0xaa26('0x37')]};return db['JscriptyQuestionReport'][_0xaa26('0x1a')](_0x1495e1)[_0xaa26('0x21')](function(_0x2ce07f){_0xd3664b['count']=_0x2ce07f;if(_0x24042d[_0xaa26('0x2e')][_0xaa26('0x3e')]){_0x2c850a[_0xaa26('0x3f')]=[{'all':!![]}];}return db[_0xaa26('0x40')][_0xaa26('0x41')](_0x2c850a);})[_0xaa26('0x21')](function(_0x36b11c){_0xd3664b['rows']=_0x36b11c;return _0xd3664b;})[_0xaa26('0x21')](respondWithFilteredResult(_0x5d8e59,_0x2c850a))[_0xaa26('0x42')](handleError(_0x5d8e59,null));};exports['show']=function(_0x394c7a,_0x5693c9){var _0x4e2293={'raw':!![],'where':{'id':_0x394c7a['params']['id']}},_0x1369df={};_0x1369df[_0xaa26('0x2d')]=_[_0xaa26('0x43')](db[_0xaa26('0x40')][_0xaa26('0x29')]);_0x1369df[_0xaa26('0x2e')]=_[_0xaa26('0x43')](_0x394c7a['query']);_0x1369df[_0xaa26('0x38')]=_['intersection'](_0x1369df['model'],_0x1369df[_0xaa26('0x2e')]);_0x4e2293[_0xaa26('0x30')]=_['intersection'](_0x1369df[_0xaa26('0x2d')],qs[_0xaa26('0x31')](_0x394c7a[_0xaa26('0x2e')]['fields']));_0x4e2293['attributes']=_0x4e2293[_0xaa26('0x30')][_0xaa26('0x32')]?_0x4e2293['attributes']:_0x1369df['model'];if(_0x394c7a[_0xaa26('0x2e')][_0xaa26('0x3e')]){_0x4e2293[_0xaa26('0x3f')]=[{'all':!![]}];}_0x4e2293=_['merge']({},_0x4e2293,_0x394c7a[_0xaa26('0x3d')]);return db[_0xaa26('0x40')]['find'](_0x4e2293)[_0xaa26('0x21')](handleEntityNotFound(_0x5693c9,null))[_0xaa26('0x21')](respondWithResult(_0x5693c9,null))['catch'](handleError(_0x5693c9,null));};exports[_0xaa26('0x44')]=function(_0x13c99a,_0x2a56d8){return db[_0xaa26('0x40')][_0xaa26('0x44')](_0x13c99a['body'],{})['then'](respondWithResult(_0x2a56d8,0xc9))[_0xaa26('0x42')](handleError(_0x2a56d8,null));};exports['update']=function(_0x15ae79,_0x10f01d){if(_0x15ae79[_0xaa26('0x45')]['id']){delete _0x15ae79[_0xaa26('0x45')]['id'];}return db['JscriptyQuestionReport'][_0xaa26('0x46')]({'where':{'id':_0x15ae79['params']['id']}})[_0xaa26('0x21')](handleEntityNotFound(_0x10f01d,null))[_0xaa26('0x21')](saveUpdates(_0x15ae79[_0xaa26('0x45')],null))[_0xaa26('0x21')](respondWithResult(_0x10f01d,null))[_0xaa26('0x42')](handleError(_0x10f01d,null));};exports[_0xaa26('0x22')]=function(_0x429b92,_0x1212d4){return db[_0xaa26('0x40')][_0xaa26('0x46')]({'where':{'id':_0x429b92[_0xaa26('0x47')]['id']}})[_0xaa26('0x21')](handleEntityNotFound(_0x1212d4,null))['then'](removeEntity(_0x1212d4,null))['catch'](handleError(_0x1212d4,null));};exports[_0xaa26('0x48')]=function(_0x32b9d0,_0x43b006){return db['JscriptyQuestionReport'][_0xaa26('0x48')]()[_0xaa26('0x21')](respondWithResult(_0x43b006,null))[_0xaa26('0x42')](handleError(_0x43b006,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