Built motion from commit (unavailable).|2.5.30
[motion2.git] / server / api / squareRecording / squareRecording.controller.js
index 90e73c8..3c46b83 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x84f7=['File:\x20\x22','unlinkSync','.cypher','isNil','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','eml-format','zip-dir','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','jsforce','desk.js','querystring','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','limit','count','set','Content-Range','json','save','update','then','destroy','error','stack','name','send','index','map','SquareRecording','rawAttributes','fieldName','type','model','keys','query','filters','intersection','attributes','fields','length','nolimit','order','sort','pick','filter','where','VIRTUAL','merge','options','findAll','rows','catch','show','params','includeAll','include','find','body','download','../../components/encryptor','uniqueid','savePath','format','%s.cypher','recording','existsSync','Sequelize','ValidationError','SquareRecording\x20not\x20found','filename','unlink','message','Not\x20found','Entity\x20not\x20found','cancellazione\x20fisica\x20documento\x20%s','info'];(function(_0x173441,_0x26b0d9){var _0x2423a8=function(_0x4d96c2){while(--_0x4d96c2){_0x173441['push'](_0x173441['shift']());}};_0x2423a8(++_0x26b0d9);}(_0x84f7,0x1e0));var _0x784f=function(_0x1e6e4e,_0x2b1b09){_0x1e6e4e=_0x1e6e4e-0x0;var _0x3d746b=_0x84f7[_0x1e6e4e];return _0x3d746b;};'use strict';var emlformat=require(_0x784f('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x784f('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x784f('0x2'));var moment=require('moment');var BPromise=require(_0x784f('0x3'));var Mustache=require(_0x784f('0x4'));var util=require(_0x784f('0x5'));var path=require(_0x784f('0x6'));var sox=require(_0x784f('0x7'));var csv=require(_0x784f('0x8'));var ejs=require(_0x784f('0x9'));var fs=require('fs');var fs_extra=require(_0x784f('0xa'));var _=require('lodash');var squel=require(_0x784f('0xb'));var crypto=require('crypto');var jsforce=require(_0x784f('0xc'));var deskjs=require(_0x784f('0xd'));var toCsv=require('to-csv');var querystring=require(_0x784f('0xe'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x784f('0xf'));var hardwareService=require(_0x784f('0x10'));var logger=require(_0x784f('0x11'))(_0x784f('0x12'));var utils=require(_0x784f('0x13'));var config=require(_0x784f('0x14'));var licenseUtil=require(_0x784f('0x15'));var db=require(_0x784f('0x16'))['db'];function respondWithStatusCode(_0x154c0a,_0x959a6a){_0x959a6a=_0x959a6a||0xcc;return function(_0x1c5322){if(_0x1c5322){return _0x154c0a[_0x784f('0x17')](_0x959a6a);}return _0x154c0a[_0x784f('0x18')](_0x959a6a)[_0x784f('0x19')]();};}function respondWithResult(_0x448f7e,_0x55072f){_0x55072f=_0x55072f||0xc8;return function(_0x2bcc40){if(_0x2bcc40){return _0x448f7e['status'](_0x55072f)['json'](_0x2bcc40);}};}function respondWithFilteredResult(_0x23db48,_0x3dcc60){return function(_0x437714){if(_0x437714){var _0x51fa00=typeof _0x3dcc60[_0x784f('0x1a')]==='undefined'&&typeof _0x3dcc60[_0x784f('0x1b')]==='undefined';var _0x2f0911=_0x437714[_0x784f('0x1c')];var _0xe81412=_0x51fa00?0x0:_0x3dcc60['offset'];var _0x2456c4=_0x51fa00?_0x437714[_0x784f('0x1c')]:_0x3dcc60[_0x784f('0x1a')]+_0x3dcc60[_0x784f('0x1b')];var _0xa48034;if(_0x2456c4>=_0x2f0911){_0x2456c4=_0x2f0911;_0xa48034=0xc8;}else{_0xa48034=0xce;}_0x23db48[_0x784f('0x18')](_0xa48034);return _0x23db48[_0x784f('0x1d')](_0x784f('0x1e'),_0xe81412+'-'+_0x2456c4+'/'+_0x2f0911)[_0x784f('0x1f')](_0x437714);}return null;};}function patchUpdates(_0x57634){return function(_0x417774){try{jsonpatch['apply'](_0x417774,_0x57634,!![]);}catch(_0x471e27){return BPromise['reject'](_0x471e27);}return _0x417774[_0x784f('0x20')]();};}function saveUpdates(_0x2b02ae,_0x5f454e){return function(_0x4f9cab){if(_0x4f9cab){return _0x4f9cab[_0x784f('0x21')](_0x2b02ae)[_0x784f('0x22')](function(_0x4c3738){return _0x4c3738;});}return null;};}function removeEntity(_0x1de511,_0x18afba){return function(_0x4dbeca){if(_0x4dbeca){return _0x4dbeca[_0x784f('0x23')]()[_0x784f('0x22')](function(){_0x1de511['status'](0xcc)[_0x784f('0x19')]();});}};}function handleEntityNotFound(_0x5315c5,_0x1b7ef5){return function(_0x16ee0f){if(!_0x16ee0f){_0x5315c5[_0x784f('0x17')](0x194);}return _0x16ee0f;};}function handleError(_0x2510f1,_0x43ece9){_0x43ece9=_0x43ece9||0x1f4;return function(_0x347518){logger[_0x784f('0x24')](_0x347518[_0x784f('0x25')]);if(_0x347518[_0x784f('0x26')]){delete _0x347518[_0x784f('0x26')];}_0x2510f1[_0x784f('0x18')](_0x43ece9)[_0x784f('0x27')](_0x347518);};}exports[_0x784f('0x28')]=function(_0x557b6f,_0x16d49c){var _0x5e0dcb={},_0x35afe1={},_0xa602e0={'count':0x0,'rows':[]};var _0x4b24c8=_[_0x784f('0x29')](db[_0x784f('0x2a')][_0x784f('0x2b')],function(_0x16f860){return{'name':_0x16f860[_0x784f('0x2c')],'type':_0x16f860[_0x784f('0x2d')]['key']};});_0x35afe1[_0x784f('0x2e')]=_[_0x784f('0x29')](_0x4b24c8,_0x784f('0x26'));_0x35afe1['query']=_[_0x784f('0x2f')](_0x557b6f[_0x784f('0x30')]);_0x35afe1[_0x784f('0x31')]=_[_0x784f('0x32')](_0x35afe1['model'],_0x35afe1[_0x784f('0x30')]);_0x5e0dcb[_0x784f('0x33')]=_[_0x784f('0x32')](_0x35afe1['model'],qs[_0x784f('0x34')](_0x557b6f[_0x784f('0x30')][_0x784f('0x34')]));_0x5e0dcb[_0x784f('0x33')]=_0x5e0dcb[_0x784f('0x33')][_0x784f('0x35')]?_0x5e0dcb[_0x784f('0x33')]:_0x35afe1[_0x784f('0x2e')];if(!_0x557b6f[_0x784f('0x30')]['hasOwnProperty'](_0x784f('0x36'))){_0x5e0dcb[_0x784f('0x1b')]=qs[_0x784f('0x1b')](_0x557b6f[_0x784f('0x30')][_0x784f('0x1b')]);_0x5e0dcb[_0x784f('0x1a')]=qs[_0x784f('0x1a')](_0x557b6f[_0x784f('0x30')][_0x784f('0x1a')]);}_0x5e0dcb[_0x784f('0x37')]=qs[_0x784f('0x38')](_0x557b6f['query']['sort']);_0x5e0dcb['where']=qs[_0x784f('0x31')](_[_0x784f('0x39')](_0x557b6f[_0x784f('0x30')],_0x35afe1[_0x784f('0x31')]),_0x4b24c8);if(_0x557b6f[_0x784f('0x30')][_0x784f('0x3a')]){_0x5e0dcb['where']=_['merge'](_0x5e0dcb[_0x784f('0x3b')],{'$or':_[_0x784f('0x29')](_0x4b24c8,function(_0x359864){if(_0x359864[_0x784f('0x2d')]!==_0x784f('0x3c')){var _0xe09205={};_0xe09205[_0x359864[_0x784f('0x26')]]={'$like':'%'+_0x557b6f['query']['filter']+'%'};return _0xe09205;}})});}_0x5e0dcb=_[_0x784f('0x3d')]({},_0x5e0dcb,_0x557b6f[_0x784f('0x3e')]);var _0x3c6124={'where':_0x5e0dcb[_0x784f('0x3b')]};return db['SquareRecording'][_0x784f('0x1c')](_0x3c6124)[_0x784f('0x22')](function(_0x41b88d){_0xa602e0[_0x784f('0x1c')]=_0x41b88d;if(_0x557b6f['query']['includeAll']){_0x5e0dcb['include']=[{'all':!![]}];}return db[_0x784f('0x2a')][_0x784f('0x3f')](_0x5e0dcb);})['then'](function(_0x30d423){_0xa602e0[_0x784f('0x40')]=_0x30d423;return _0xa602e0;})[_0x784f('0x22')](respondWithFilteredResult(_0x16d49c,_0x5e0dcb))[_0x784f('0x41')](handleError(_0x16d49c,null));};exports[_0x784f('0x42')]=function(_0x3813fb,_0x5eae4b){var _0x5a42d7={'raw':!![],'where':{'id':_0x3813fb[_0x784f('0x43')]['id']}},_0x6609d={};_0x6609d[_0x784f('0x2e')]=_[_0x784f('0x2f')](db[_0x784f('0x2a')][_0x784f('0x2b')]);_0x6609d[_0x784f('0x30')]=_[_0x784f('0x2f')](_0x3813fb[_0x784f('0x30')]);_0x6609d['filters']=_['intersection'](_0x6609d[_0x784f('0x2e')],_0x6609d[_0x784f('0x30')]);_0x5a42d7[_0x784f('0x33')]=_['intersection'](_0x6609d[_0x784f('0x2e')],qs[_0x784f('0x34')](_0x3813fb['query']['fields']));_0x5a42d7[_0x784f('0x33')]=_0x5a42d7['attributes'][_0x784f('0x35')]?_0x5a42d7[_0x784f('0x33')]:_0x6609d['model'];if(_0x3813fb['query'][_0x784f('0x44')]){_0x5a42d7[_0x784f('0x45')]=[{'all':!![]}];}_0x5a42d7=_[_0x784f('0x3d')]({},_0x5a42d7,_0x3813fb['options']);return db[_0x784f('0x2a')][_0x784f('0x46')](_0x5a42d7)[_0x784f('0x22')](handleEntityNotFound(_0x5eae4b,null))[_0x784f('0x22')](respondWithResult(_0x5eae4b,null))[_0x784f('0x41')](handleError(_0x5eae4b,null));};exports['create']=function(_0x1d930c,_0x26a18f){return db[_0x784f('0x2a')]['create'](_0x1d930c['body'],{})[_0x784f('0x22')](respondWithResult(_0x26a18f,0xc9))[_0x784f('0x41')](handleError(_0x26a18f,null));};exports[_0x784f('0x21')]=function(_0x26e1a6,_0xe9f109){if(_0x26e1a6[_0x784f('0x47')]['id']){delete _0x26e1a6[_0x784f('0x47')]['id'];}return db[_0x784f('0x2a')]['find']({'where':{'id':_0x26e1a6[_0x784f('0x43')]['id']}})[_0x784f('0x22')](handleEntityNotFound(_0xe9f109,null))[_0x784f('0x22')](saveUpdates(_0x26e1a6['body'],null))['then'](respondWithResult(_0xe9f109,null))[_0x784f('0x41')](handleError(_0xe9f109,null));};exports[_0x784f('0x48')]=function(_0x501be3,_0xccdf20,_0x1ca689){var _0x23c689=require(_0x784f('0x49'));var _0x14058d=![];var _0x51cbde={};if(_0x501be3[_0x784f('0x30')]['type']&&_0x501be3[_0x784f('0x30')][_0x784f('0x2d')]===_0x784f('0x4a')){_0x51cbde[_0x784f('0x4a')]=_0x501be3[_0x784f('0x43')]['id'];}else{_0x51cbde['id']=_0x501be3[_0x784f('0x43')]['id'];}return db['SquareRecording'][_0x784f('0x46')]({'where':_0x51cbde,'attributes':['id',_0x784f('0x4b'),'filename'],'raw':!![]})[_0x784f('0x22')](handleEntityNotFound(_0xccdf20,null))[_0x784f('0x22')](function(_0x48bf7b){if(_0x48bf7b){var _0x312735=_0x48bf7b[_0x784f('0x4b')];var _0x28253b=util[_0x784f('0x4c')](_0x784f('0x4d'),_0x312735);if(fs['existsSync'](_0x28253b)){_0x14058d=!![];return _0x23c689['decryptFile'](_0x28253b,_0x312735,config['secrets'][_0x784f('0x4e')])[_0x784f('0x22')](function(){return _0x48bf7b;});}return _0x48bf7b;}})[_0x784f('0x22')](function(_0x2fee7a){if(_0x2fee7a){var _0x26f6bf=_0x2fee7a['savePath'];if(!fs[_0x784f('0x4f')](_0x26f6bf)){throw new db[(_0x784f('0x50'))][(_0x784f('0x51'))](_0x784f('0x52'));}if(_0x2fee7a[_0x784f('0x53')]){return _0xccdf20[_0x784f('0x48')](_0x26f6bf,_0x2fee7a[_0x784f('0x53')]+path['extname'](_0x26f6bf),function(){if(_0x14058d){fs[_0x784f('0x54')](_0x26f6bf);}});}else{return _0xccdf20[_0x784f('0x48')](_0x26f6bf,function(_0x443d6b){if(_0x14058d){fs[_0x784f('0x54')](_0x26f6bf);}});}}})[_0x784f('0x41')](function(_0x52027f){if(_0x52027f[_0x784f('0x55')]===_0x784f('0x52')){_0xccdf20['status'](0x194)[_0x784f('0x27')](_0x784f('0x56'));}else{return handleError(_0xccdf20,null);}});};exports[_0x784f('0x23')]=function(_0x430773,_0x2e8c0d){return db[_0x784f('0x2a')]['find']({'where':{'id':_0x430773['params']['id']}})[_0x784f('0x22')](function(_0x3036d5){if(!_0x3036d5)throw new ReferenceError(_0x784f('0x57'));return _0x3036d5;})[_0x784f('0x22')](function(_0x334367){var _0x4077c2=_0x334367[_0x784f('0x4b')];logger['info'](_0x784f('0x58'),_0x4077c2);if(!_['isNil'](_0x334367[_0x784f('0x4b')])&&fs[_0x784f('0x4f')](_0x4077c2)){logger[_0x784f('0x59')](_0x784f('0x5a')+_0x4077c2+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione');fs[_0x784f('0x5b')](_0x4077c2);}_0x4077c2=_0x4077c2+_0x784f('0x5c');if(!_[_0x784f('0x5d')](_0x334367['savePath'])&&fs[_0x784f('0x4f')](_0x4077c2)){logger[_0x784f('0x59')](_0x784f('0x5a')+_0x4077c2+_0x784f('0x5e'));fs[_0x784f('0x5b')](_0x4077c2);}return _0x334367;})[_0x784f('0x22')](function(_0x2a15d7){if(!_0x2a15d7)throw new InternalError();return _0x2a15d7['destroy']();})[_0x784f('0x22')](function(){_0x2e8c0d['status'](0xcc)[_0x784f('0x19')]();})['catch'](handleError(_0x2e8c0d,null));};
\ No newline at end of file
+var _0xa9e0=['download','uniqueid','savePath','filename','format','existsSync','secrets','recording','Sequelize','ValidationError','unlink','message','SquareRecording\x20not\x20found','Not\x20found','isNil','Entity\x20not\x20found','info','File:\x20\x22','unlinkSync','.cypher','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','eml-format','rimraf','zip-dir','moment','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/license/util','../../mysqldb','sendStatus','end','status','json','undefined','limit','offset','count','set','Content-Range','apply','save','update','then','destroy','stack','name','send','index','SquareRecording','rawAttributes','fieldName','key','model','map','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','where','filter','merge','type','options','includeAll','include','findAll','catch','show','params','find','body'];(function(_0x478e78,_0x8b4bea){var _0x37a4f8=function(_0x271103){while(--_0x271103){_0x478e78['push'](_0x478e78['shift']());}};_0x37a4f8(++_0x8b4bea);}(_0xa9e0,0x123));var _0x0a9e=function(_0xbca1b1,_0x33f0ce){_0xbca1b1=_0xbca1b1-0x0;var _0x4e1686=_0xa9e0[_0xbca1b1];return _0x4e1686;};'use strict';var emlformat=require(_0x0a9e('0x0'));var rimraf=require(_0x0a9e('0x1'));var zipdir=require(_0x0a9e('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x0a9e('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x0a9e('0x4'));var util=require(_0x0a9e('0x5'));var path=require(_0x0a9e('0x6'));var sox=require(_0x0a9e('0x7'));var csv=require(_0x0a9e('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x0a9e('0x9'));var _=require(_0x0a9e('0xa'));var squel=require(_0x0a9e('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x0a9e('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x0a9e('0xd'));var Redis=require(_0x0a9e('0xe'));var authService=require(_0x0a9e('0xf'));var qs=require(_0x0a9e('0x10'));var as=require(_0x0a9e('0x11'));var hardwareService=require(_0x0a9e('0x12'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x0a9e('0x13'));var db=require(_0x0a9e('0x14'))['db'];function respondWithStatusCode(_0xd5b662,_0x26d672){_0x26d672=_0x26d672||0xcc;return function(_0x32d742){if(_0x32d742){return _0xd5b662[_0x0a9e('0x15')](_0x26d672);}return _0xd5b662['status'](_0x26d672)[_0x0a9e('0x16')]();};}function respondWithResult(_0x239b12,_0x2b4227){_0x2b4227=_0x2b4227||0xc8;return function(_0x281129){if(_0x281129){return _0x239b12[_0x0a9e('0x17')](_0x2b4227)[_0x0a9e('0x18')](_0x281129);}};}function respondWithFilteredResult(_0x52a03d,_0x22dccb){return function(_0x5d0880){if(_0x5d0880){var _0x1985b6=typeof _0x22dccb['offset']===_0x0a9e('0x19')&&typeof _0x22dccb[_0x0a9e('0x1a')]==='undefined';var _0x225616=_0x5d0880['count'];var _0x459eb1=_0x1985b6?0x0:_0x22dccb[_0x0a9e('0x1b')];var _0x106033=_0x1985b6?_0x5d0880[_0x0a9e('0x1c')]:_0x22dccb[_0x0a9e('0x1b')]+_0x22dccb[_0x0a9e('0x1a')];var _0x530eb7;if(_0x106033>=_0x225616){_0x106033=_0x225616;_0x530eb7=0xc8;}else{_0x530eb7=0xce;}_0x52a03d[_0x0a9e('0x17')](_0x530eb7);return _0x52a03d[_0x0a9e('0x1d')](_0x0a9e('0x1e'),_0x459eb1+'-'+_0x106033+'/'+_0x225616)[_0x0a9e('0x18')](_0x5d0880);}return null;};}function patchUpdates(_0x105080){return function(_0x4bb1e3){try{jsonpatch[_0x0a9e('0x1f')](_0x4bb1e3,_0x105080,!![]);}catch(_0x155cce){return BPromise['reject'](_0x155cce);}return _0x4bb1e3[_0x0a9e('0x20')]();};}function saveUpdates(_0x5a09ef,_0x588269){return function(_0x3a02e1){if(_0x3a02e1){return _0x3a02e1[_0x0a9e('0x21')](_0x5a09ef)[_0x0a9e('0x22')](function(_0x30bae6){return _0x30bae6;});}return null;};}function removeEntity(_0x4abc77,_0xfb6e48){return function(_0x2fb0e4){if(_0x2fb0e4){return _0x2fb0e4[_0x0a9e('0x23')]()[_0x0a9e('0x22')](function(){_0x4abc77[_0x0a9e('0x17')](0xcc)[_0x0a9e('0x16')]();});}};}function handleEntityNotFound(_0x16b1ca,_0x5ea472){return function(_0x59181e){if(!_0x59181e){_0x16b1ca[_0x0a9e('0x15')](0x194);}return _0x59181e;};}function handleError(_0x3a8e58,_0x40c424){_0x40c424=_0x40c424||0x1f4;return function(_0x33161b){logger['error'](_0x33161b[_0x0a9e('0x24')]);if(_0x33161b['name']){delete _0x33161b[_0x0a9e('0x25')];}_0x3a8e58['status'](_0x40c424)[_0x0a9e('0x26')](_0x33161b);};}exports[_0x0a9e('0x27')]=function(_0x25fba9,_0x14433c){var _0x140511={},_0x1538a4={},_0x11c3b6={'count':0x0,'rows':[]};var _0x14de77=_['map'](db[_0x0a9e('0x28')][_0x0a9e('0x29')],function(_0x2b1f27){return{'name':_0x2b1f27[_0x0a9e('0x2a')],'type':_0x2b1f27['type'][_0x0a9e('0x2b')]};});_0x1538a4[_0x0a9e('0x2c')]=_[_0x0a9e('0x2d')](_0x14de77,_0x0a9e('0x25'));_0x1538a4[_0x0a9e('0x2e')]=_[_0x0a9e('0x2f')](_0x25fba9[_0x0a9e('0x2e')]);_0x1538a4[_0x0a9e('0x30')]=_[_0x0a9e('0x31')](_0x1538a4['model'],_0x1538a4[_0x0a9e('0x2e')]);_0x140511['attributes']=_[_0x0a9e('0x31')](_0x1538a4[_0x0a9e('0x2c')],qs[_0x0a9e('0x32')](_0x25fba9[_0x0a9e('0x2e')][_0x0a9e('0x32')]));_0x140511['attributes']=_0x140511[_0x0a9e('0x33')][_0x0a9e('0x34')]?_0x140511[_0x0a9e('0x33')]:_0x1538a4[_0x0a9e('0x2c')];if(!_0x25fba9[_0x0a9e('0x2e')][_0x0a9e('0x35')](_0x0a9e('0x36'))){_0x140511[_0x0a9e('0x1a')]=qs['limit'](_0x25fba9[_0x0a9e('0x2e')]['limit']);_0x140511[_0x0a9e('0x1b')]=qs[_0x0a9e('0x1b')](_0x25fba9[_0x0a9e('0x2e')][_0x0a9e('0x1b')]);}_0x140511['order']=qs[_0x0a9e('0x37')](_0x25fba9[_0x0a9e('0x2e')][_0x0a9e('0x37')]);_0x140511[_0x0a9e('0x38')]=qs['filters'](_['pick'](_0x25fba9[_0x0a9e('0x2e')],_0x1538a4['filters']),_0x14de77);if(_0x25fba9[_0x0a9e('0x2e')][_0x0a9e('0x39')]){_0x140511[_0x0a9e('0x38')]=_[_0x0a9e('0x3a')](_0x140511['where'],{'$or':_[_0x0a9e('0x2d')](_0x14de77,function(_0x3bfce8){if(_0x3bfce8[_0x0a9e('0x3b')]!=='VIRTUAL'){var _0x1dbf74={};_0x1dbf74[_0x3bfce8[_0x0a9e('0x25')]]={'$like':'%'+_0x25fba9[_0x0a9e('0x2e')]['filter']+'%'};return _0x1dbf74;}})});}_0x140511=_['merge']({},_0x140511,_0x25fba9[_0x0a9e('0x3c')]);var _0x40d766={'where':_0x140511['where']};return db[_0x0a9e('0x28')][_0x0a9e('0x1c')](_0x40d766)[_0x0a9e('0x22')](function(_0x148f55){_0x11c3b6['count']=_0x148f55;if(_0x25fba9['query'][_0x0a9e('0x3d')]){_0x140511[_0x0a9e('0x3e')]=[{'all':!![]}];}return db['SquareRecording'][_0x0a9e('0x3f')](_0x140511);})[_0x0a9e('0x22')](function(_0x1459bb){_0x11c3b6['rows']=_0x1459bb;return _0x11c3b6;})[_0x0a9e('0x22')](respondWithFilteredResult(_0x14433c,_0x140511))[_0x0a9e('0x40')](handleError(_0x14433c,null));};exports[_0x0a9e('0x41')]=function(_0x43dd5b,_0x13cb1f){var _0xeaa5e5={'raw':!![],'where':{'id':_0x43dd5b[_0x0a9e('0x42')]['id']}},_0x2881b3={};_0x2881b3[_0x0a9e('0x2c')]=_[_0x0a9e('0x2f')](db[_0x0a9e('0x28')][_0x0a9e('0x29')]);_0x2881b3[_0x0a9e('0x2e')]=_[_0x0a9e('0x2f')](_0x43dd5b[_0x0a9e('0x2e')]);_0x2881b3['filters']=_['intersection'](_0x2881b3[_0x0a9e('0x2c')],_0x2881b3[_0x0a9e('0x2e')]);_0xeaa5e5[_0x0a9e('0x33')]=_[_0x0a9e('0x31')](_0x2881b3[_0x0a9e('0x2c')],qs[_0x0a9e('0x32')](_0x43dd5b[_0x0a9e('0x2e')][_0x0a9e('0x32')]));_0xeaa5e5[_0x0a9e('0x33')]=_0xeaa5e5[_0x0a9e('0x33')][_0x0a9e('0x34')]?_0xeaa5e5[_0x0a9e('0x33')]:_0x2881b3['model'];if(_0x43dd5b[_0x0a9e('0x2e')][_0x0a9e('0x3d')]){_0xeaa5e5[_0x0a9e('0x3e')]=[{'all':!![]}];}_0xeaa5e5=_[_0x0a9e('0x3a')]({},_0xeaa5e5,_0x43dd5b[_0x0a9e('0x3c')]);return db[_0x0a9e('0x28')][_0x0a9e('0x43')](_0xeaa5e5)[_0x0a9e('0x22')](handleEntityNotFound(_0x13cb1f,null))['then'](respondWithResult(_0x13cb1f,null))[_0x0a9e('0x40')](handleError(_0x13cb1f,null));};exports['create']=function(_0x473dc8,_0x476688){return db[_0x0a9e('0x28')]['create'](_0x473dc8[_0x0a9e('0x44')],{})[_0x0a9e('0x22')](respondWithResult(_0x476688,0xc9))[_0x0a9e('0x40')](handleError(_0x476688,null));};exports[_0x0a9e('0x21')]=function(_0x45c845,_0x37be73){if(_0x45c845[_0x0a9e('0x44')]['id']){delete _0x45c845['body']['id'];}return db[_0x0a9e('0x28')][_0x0a9e('0x43')]({'where':{'id':_0x45c845[_0x0a9e('0x42')]['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x37be73,null))[_0x0a9e('0x22')](saveUpdates(_0x45c845[_0x0a9e('0x44')],null))[_0x0a9e('0x22')](respondWithResult(_0x37be73,null))[_0x0a9e('0x40')](handleError(_0x37be73,null));};exports[_0x0a9e('0x45')]=function(_0x58a5c2,_0xe401a,_0x3fe430){var _0x4f7240=require('../../components/encryptor');var _0x5ddf84=![];var _0x1adfee={};if(_0x58a5c2[_0x0a9e('0x2e')][_0x0a9e('0x3b')]&&_0x58a5c2[_0x0a9e('0x2e')][_0x0a9e('0x3b')]===_0x0a9e('0x46')){_0x1adfee[_0x0a9e('0x46')]=_0x58a5c2[_0x0a9e('0x42')]['id'];}else{_0x1adfee['id']=_0x58a5c2['params']['id'];}return db['SquareRecording']['find']({'where':_0x1adfee,'attributes':['id',_0x0a9e('0x47'),_0x0a9e('0x48')],'raw':!![]})[_0x0a9e('0x22')](handleEntityNotFound(_0xe401a,null))['then'](function(_0x2b69d9){if(_0x2b69d9){var _0x161aa7=_0x2b69d9['savePath'];var _0x5a88da=util[_0x0a9e('0x49')]('%s.cypher',_0x161aa7);if(fs[_0x0a9e('0x4a')](_0x5a88da)){_0x5ddf84=!![];return _0x4f7240['decryptFile'](_0x5a88da,_0x161aa7,config[_0x0a9e('0x4b')][_0x0a9e('0x4c')])[_0x0a9e('0x22')](function(){return _0x2b69d9;});}return _0x2b69d9;}})['then'](function(_0x2f82da){if(_0x2f82da){var _0x1bf38a=_0x2f82da['savePath'];if(!fs['existsSync'](_0x1bf38a)){throw new db[(_0x0a9e('0x4d'))][(_0x0a9e('0x4e'))]('SquareRecording\x20not\x20found');}if(_0x2f82da[_0x0a9e('0x48')]){return _0xe401a['download'](_0x1bf38a,_0x2f82da[_0x0a9e('0x48')]+path['extname'](_0x1bf38a),function(){if(_0x5ddf84){fs[_0x0a9e('0x4f')](_0x1bf38a);}});}else{return _0xe401a['download'](_0x1bf38a,function(_0x5da27d){if(_0x5ddf84){fs['unlink'](_0x1bf38a);}});}}})[_0x0a9e('0x40')](function(_0x47de4c){if(_0x47de4c[_0x0a9e('0x50')]===_0x0a9e('0x51')){_0xe401a[_0x0a9e('0x17')](0x194)[_0x0a9e('0x26')](_0x0a9e('0x52'));}else{return handleError(_0xe401a,null);}});};exports[_0x0a9e('0x23')]=function(_0xd10662,_0x28d814){return db['SquareRecording'][_0x0a9e('0x43')]({'where':{'id':_0xd10662[_0x0a9e('0x42')]['id']}})[_0x0a9e('0x22')](function(_0x30c491){if(_[_0x0a9e('0x53')](_0x30c491)){throw new ReferenceError(_0x0a9e('0x54'));}return _0x30c491;})['then'](function(_0x956fbe){var _0x26bc80=_0x956fbe['savePath'];logger[_0x0a9e('0x55')]('cancellazione\x20fisica\x20documento\x20%s',_0x26bc80);if(!_[_0x0a9e('0x53')](_0x956fbe['savePath'])&&fs['existsSync'](_0x26bc80)){logger['info'](_0x0a9e('0x56')+_0x26bc80+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione');fs[_0x0a9e('0x57')](_0x26bc80);}_0x26bc80=_0x26bc80+_0x0a9e('0x58');if(!_[_0x0a9e('0x53')](_0x956fbe[_0x0a9e('0x47')])&&fs[_0x0a9e('0x4a')](_0x26bc80)){logger[_0x0a9e('0x55')]('File:\x20\x22'+_0x26bc80+_0x0a9e('0x59'));fs['unlinkSync'](_0x26bc80);}return _0x956fbe;})[_0x0a9e('0x22')](function(_0x1f07cb){if(!_0x1f07cb)throw new InternalError();return _0x1f07cb[_0x0a9e('0x23')]();})['then'](function(){_0x28d814[_0x0a9e('0x17')](0xcc)[_0x0a9e('0x16')]();})[_0x0a9e('0x40')](handleError(_0x28d814,null));};
\ No newline at end of file