Built motion from commit 616d3211.|2.6.4
[motion2.git] / server / api / squareRecording / squareRecording.controller.js
index 4ccb00a..f3eb713 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x12ef=['ValidationError','SquareRecording\x20not\x20found','download','unlink','message','destroy','isNil','Entity\x20not\x20found','info','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','.cypher','unlinkSync','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','count','Content-Range','reject','update','error','stack','name','send','index','map','SquareRecording','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','where','VIRTUAL','filter','merge','options','then','includeAll','include','findAll','show','find','create','body','catch','params','../../components/encryptor','uniqueid','savePath','filename','%s.cypher','existsSync','secrets','recording','Sequelize'];(function(_0x27bdbc,_0x2e9d9d){var _0x3c9a90=function(_0xfa170b){while(--_0xfa170b){_0x27bdbc['push'](_0x27bdbc['shift']());}};_0x3c9a90(++_0x2e9d9d);}(_0x12ef,0x69));var _0xf12e=function(_0xbd08b4,_0x4790ed){_0xbd08b4=_0xbd08b4-0x0;var _0x314f1e=_0x12ef[_0xbd08b4];return _0x314f1e;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xf12e('0x0'));var zipdir=require(_0xf12e('0x1'));var jsonpatch=require(_0xf12e('0x2'));var rp=require(_0xf12e('0x3'));var moment=require('moment');var BPromise=require(_0xf12e('0x4'));var Mustache=require(_0xf12e('0x5'));var util=require(_0xf12e('0x6'));var path=require(_0xf12e('0x7'));var sox=require('sox');var csv=require(_0xf12e('0x8'));var ejs=require(_0xf12e('0x9'));var fs=require('fs');var fs_extra=require(_0xf12e('0xa'));var _=require(_0xf12e('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xf12e('0xc'));var toCsv=require(_0xf12e('0x8'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xf12e('0xd'));var authService=require(_0xf12e('0xe'));var qs=require(_0xf12e('0xf'));var as=require(_0xf12e('0x10'));var hardwareService=require(_0xf12e('0x11'));var logger=require('../../config/logger')('api');var utils=require(_0xf12e('0x12'));var config=require('../../config/environment');var licenseUtil=require(_0xf12e('0x13'));var db=require(_0xf12e('0x14'))['db'];function respondWithStatusCode(_0x5ebe26,_0x4b9fab){_0x4b9fab=_0x4b9fab||0xcc;return function(_0x578439){if(_0x578439){return _0x5ebe26[_0xf12e('0x15')](_0x4b9fab);}return _0x5ebe26[_0xf12e('0x16')](_0x4b9fab)[_0xf12e('0x17')]();};}function respondWithResult(_0x43c624,_0x2b70c9){_0x2b70c9=_0x2b70c9||0xc8;return function(_0x4d3352){if(_0x4d3352){return _0x43c624[_0xf12e('0x16')](_0x2b70c9)[_0xf12e('0x18')](_0x4d3352);}};}function respondWithFilteredResult(_0xfeb3d2,_0x463a64){return function(_0x8e2afb){if(_0x8e2afb){var _0x155158=typeof _0x463a64[_0xf12e('0x19')]==='undefined'&&typeof _0x463a64[_0xf12e('0x1a')]===_0xf12e('0x1b');var _0x2e7e95=_0x8e2afb[_0xf12e('0x1c')];var _0x5bf665=_0x155158?0x0:_0x463a64[_0xf12e('0x19')];var _0x3dda8f=_0x155158?_0x8e2afb[_0xf12e('0x1c')]:_0x463a64[_0xf12e('0x19')]+_0x463a64[_0xf12e('0x1a')];var _0x2e2a29;if(_0x3dda8f>=_0x2e7e95){_0x3dda8f=_0x2e7e95;_0x2e2a29=0xc8;}else{_0x2e2a29=0xce;}_0xfeb3d2['status'](_0x2e2a29);return _0xfeb3d2['set'](_0xf12e('0x1d'),_0x5bf665+'-'+_0x3dda8f+'/'+_0x2e7e95)['json'](_0x8e2afb);}return null;};}function patchUpdates(_0x31e087){return function(_0x2e205b){try{jsonpatch['apply'](_0x2e205b,_0x31e087,!![]);}catch(_0x2ee991){return BPromise[_0xf12e('0x1e')](_0x2ee991);}return _0x2e205b['save']();};}function saveUpdates(_0x103d28,_0x5521a9){return function(_0x430e7c){if(_0x430e7c){return _0x430e7c[_0xf12e('0x1f')](_0x103d28)['then'](function(_0x11bf8c){return _0x11bf8c;});}return null;};}function removeEntity(_0x686ef8,_0x372862){return function(_0xfe32d7){if(_0xfe32d7){return _0xfe32d7['destroy']()['then'](function(){_0x686ef8[_0xf12e('0x16')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1d1d50,_0xcb0da0){return function(_0x2ed52e){if(!_0x2ed52e){_0x1d1d50[_0xf12e('0x15')](0x194);}return _0x2ed52e;};}function handleError(_0x13c0b8,_0x5ec764){_0x5ec764=_0x5ec764||0x1f4;return function(_0x219226){logger[_0xf12e('0x20')](_0x219226[_0xf12e('0x21')]);if(_0x219226['name']){delete _0x219226[_0xf12e('0x22')];}_0x13c0b8[_0xf12e('0x16')](_0x5ec764)[_0xf12e('0x23')](_0x219226);};}exports[_0xf12e('0x24')]=function(_0x566d3d,_0xdd719f){var _0x3ccef6={},_0x3d0256={},_0x58b747={'count':0x0,'rows':[]};var _0x35d7fc=_[_0xf12e('0x25')](db[_0xf12e('0x26')][_0xf12e('0x27')],function(_0x12a323){return{'name':_0x12a323['fieldName'],'type':_0x12a323[_0xf12e('0x28')][_0xf12e('0x29')]};});_0x3d0256[_0xf12e('0x2a')]=_['map'](_0x35d7fc,_0xf12e('0x22'));_0x3d0256[_0xf12e('0x2b')]=_[_0xf12e('0x2c')](_0x566d3d['query']);_0x3d0256[_0xf12e('0x2d')]=_[_0xf12e('0x2e')](_0x3d0256[_0xf12e('0x2a')],_0x3d0256[_0xf12e('0x2b')]);_0x3ccef6[_0xf12e('0x2f')]=_['intersection'](_0x3d0256[_0xf12e('0x2a')],qs[_0xf12e('0x30')](_0x566d3d[_0xf12e('0x2b')][_0xf12e('0x30')]));_0x3ccef6[_0xf12e('0x2f')]=_0x3ccef6['attributes'][_0xf12e('0x31')]?_0x3ccef6[_0xf12e('0x2f')]:_0x3d0256[_0xf12e('0x2a')];if(!_0x566d3d['query'][_0xf12e('0x32')](_0xf12e('0x33'))){_0x3ccef6[_0xf12e('0x1a')]=qs[_0xf12e('0x1a')](_0x566d3d[_0xf12e('0x2b')][_0xf12e('0x1a')]);_0x3ccef6[_0xf12e('0x19')]=qs[_0xf12e('0x19')](_0x566d3d['query'][_0xf12e('0x19')]);}_0x3ccef6[_0xf12e('0x34')]=qs[_0xf12e('0x35')](_0x566d3d[_0xf12e('0x2b')]['sort']);_0x3ccef6['where']=qs['filters'](_[_0xf12e('0x36')](_0x566d3d[_0xf12e('0x2b')],_0x3d0256[_0xf12e('0x2d')]),_0x35d7fc);if(_0x566d3d[_0xf12e('0x2b')]['filter']){_0x3ccef6[_0xf12e('0x37')]=_['merge'](_0x3ccef6[_0xf12e('0x37')],{'$or':_[_0xf12e('0x25')](_0x35d7fc,function(_0x383a43){if(_0x383a43['type']!==_0xf12e('0x38')){var _0x3f5b8c={};_0x3f5b8c[_0x383a43[_0xf12e('0x22')]]={'$like':'%'+_0x566d3d['query'][_0xf12e('0x39')]+'%'};return _0x3f5b8c;}})});}_0x3ccef6=_[_0xf12e('0x3a')]({},_0x3ccef6,_0x566d3d[_0xf12e('0x3b')]);var _0x42efe2={'where':_0x3ccef6[_0xf12e('0x37')]};return db[_0xf12e('0x26')][_0xf12e('0x1c')](_0x42efe2)[_0xf12e('0x3c')](function(_0x2542ec){_0x58b747['count']=_0x2542ec;if(_0x566d3d[_0xf12e('0x2b')][_0xf12e('0x3d')]){_0x3ccef6[_0xf12e('0x3e')]=[{'all':!![]}];}return db['SquareRecording'][_0xf12e('0x3f')](_0x3ccef6);})['then'](function(_0x48070f){_0x58b747['rows']=_0x48070f;return _0x58b747;})[_0xf12e('0x3c')](respondWithFilteredResult(_0xdd719f,_0x3ccef6))['catch'](handleError(_0xdd719f,null));};exports[_0xf12e('0x40')]=function(_0xd13b2c,_0x517bf5){var _0x47d223={'raw':!![],'where':{'id':_0xd13b2c['params']['id']}},_0x3535fc={};_0x3535fc['model']=_[_0xf12e('0x2c')](db[_0xf12e('0x26')][_0xf12e('0x27')]);_0x3535fc['query']=_[_0xf12e('0x2c')](_0xd13b2c[_0xf12e('0x2b')]);_0x3535fc[_0xf12e('0x2d')]=_[_0xf12e('0x2e')](_0x3535fc['model'],_0x3535fc[_0xf12e('0x2b')]);_0x47d223[_0xf12e('0x2f')]=_[_0xf12e('0x2e')](_0x3535fc['model'],qs['fields'](_0xd13b2c[_0xf12e('0x2b')][_0xf12e('0x30')]));_0x47d223[_0xf12e('0x2f')]=_0x47d223[_0xf12e('0x2f')][_0xf12e('0x31')]?_0x47d223['attributes']:_0x3535fc[_0xf12e('0x2a')];if(_0xd13b2c['query'][_0xf12e('0x3d')]){_0x47d223[_0xf12e('0x3e')]=[{'all':!![]}];}_0x47d223=_[_0xf12e('0x3a')]({},_0x47d223,_0xd13b2c[_0xf12e('0x3b')]);return db[_0xf12e('0x26')][_0xf12e('0x41')](_0x47d223)[_0xf12e('0x3c')](handleEntityNotFound(_0x517bf5,null))['then'](respondWithResult(_0x517bf5,null))['catch'](handleError(_0x517bf5,null));};exports[_0xf12e('0x42')]=function(_0x3addb5,_0x43961e){return db[_0xf12e('0x26')][_0xf12e('0x42')](_0x3addb5[_0xf12e('0x43')],{})[_0xf12e('0x3c')](respondWithResult(_0x43961e,0xc9))[_0xf12e('0x44')](handleError(_0x43961e,null));};exports[_0xf12e('0x1f')]=function(_0x3a0f49,_0x403f0d){if(_0x3a0f49[_0xf12e('0x43')]['id']){delete _0x3a0f49[_0xf12e('0x43')]['id'];}return db[_0xf12e('0x26')][_0xf12e('0x41')]({'where':{'id':_0x3a0f49[_0xf12e('0x45')]['id']}})['then'](handleEntityNotFound(_0x403f0d,null))['then'](saveUpdates(_0x3a0f49['body'],null))[_0xf12e('0x3c')](respondWithResult(_0x403f0d,null))[_0xf12e('0x44')](handleError(_0x403f0d,null));};exports['download']=function(_0x5c0e0a,_0x3da9f6,_0x421ff4){var _0x38e90a=require(_0xf12e('0x46'));var _0x2d6cd5=![];var _0x595057={};if(_0x5c0e0a['query'][_0xf12e('0x28')]&&_0x5c0e0a['query'][_0xf12e('0x28')]===_0xf12e('0x47')){_0x595057[_0xf12e('0x47')]=_0x5c0e0a[_0xf12e('0x45')]['id'];}else{_0x595057['id']=_0x5c0e0a[_0xf12e('0x45')]['id'];}return db['SquareRecording'][_0xf12e('0x41')]({'where':_0x595057,'attributes':['id',_0xf12e('0x48'),_0xf12e('0x49')],'raw':!![]})[_0xf12e('0x3c')](handleEntityNotFound(_0x3da9f6,null))[_0xf12e('0x3c')](function(_0x3609df){if(_0x3609df){var _0x526a5a=_0x3609df[_0xf12e('0x48')];var _0x384da9=util['format'](_0xf12e('0x4a'),_0x526a5a);if(fs[_0xf12e('0x4b')](_0x384da9)){_0x2d6cd5=!![];return _0x38e90a['decryptFile'](_0x384da9,_0x526a5a,config[_0xf12e('0x4c')][_0xf12e('0x4d')])['then'](function(){return _0x3609df;});}return _0x3609df;}})[_0xf12e('0x3c')](function(_0xbd2ff){if(_0xbd2ff){var _0x174cc7=_0xbd2ff[_0xf12e('0x48')];if(!fs[_0xf12e('0x4b')](_0x174cc7)){throw new db[(_0xf12e('0x4e'))][(_0xf12e('0x4f'))](_0xf12e('0x50'));}if(_0xbd2ff['filename']){return _0x3da9f6['download'](_0x174cc7,_0xbd2ff[_0xf12e('0x49')]+path['extname'](_0x174cc7),function(){if(_0x2d6cd5){fs['unlink'](_0x174cc7);}});}else{return _0x3da9f6[_0xf12e('0x51')](_0x174cc7,function(_0x3b12c5){if(_0x2d6cd5){fs[_0xf12e('0x52')](_0x174cc7);}});}}})[_0xf12e('0x44')](function(_0x132a0c){if(_0x132a0c[_0xf12e('0x53')]===_0xf12e('0x50')){_0x3da9f6[_0xf12e('0x16')](0x194)[_0xf12e('0x23')]('Not\x20found');}else{return handleError(_0x3da9f6,null);}});};exports[_0xf12e('0x54')]=function(_0x34f476,_0x241f42){return db[_0xf12e('0x26')][_0xf12e('0x41')]({'where':{'id':_0x34f476[_0xf12e('0x45')]['id']}})[_0xf12e('0x3c')](function(_0x4f8619){if(_[_0xf12e('0x55')](_0x4f8619)){throw new ReferenceError(_0xf12e('0x56'));}return _0x4f8619;})[_0xf12e('0x3c')](function(_0x13bd8b){var _0x3da32c=_0x13bd8b[_0xf12e('0x48')];logger[_0xf12e('0x57')]('cancellazione\x20fisica\x20documento\x20%s',_0x3da32c);if(!_['isNil'](_0x13bd8b[_0xf12e('0x48')])&&fs['existsSync'](_0x3da32c)){logger[_0xf12e('0x57')](_0xf12e('0x58')+_0x3da32c+_0xf12e('0x59'));fs['unlinkSync'](_0x3da32c);}_0x3da32c=_0x3da32c+_0xf12e('0x5a');if(!_[_0xf12e('0x55')](_0x13bd8b[_0xf12e('0x48')])&&fs[_0xf12e('0x4b')](_0x3da32c)){logger['info'](_0xf12e('0x58')+_0x3da32c+_0xf12e('0x59'));fs[_0xf12e('0x5b')](_0x3da32c);}return _0x13bd8b;})[_0xf12e('0x3c')](function(_0x3eb6d2){if(!_0x3eb6d2)throw new InternalError();return _0x3eb6d2[_0xf12e('0x54')]();})[_0xf12e('0x3c')](function(){_0x241f42[_0xf12e('0x16')](0xcc)[_0xf12e('0x17')]();})['catch'](handleError(_0x241f42,null));};
\ No newline at end of file
+var _0x4b63=['body','params','download','../../components/encryptor','uniqueid','savePath','filename','%s.cypher','existsSync','decryptFile','secrets','recording','Sequelize','ValidationError','SquareRecording\x20not\x20found','unlink','send','Not\x20found','isNil','info','cancellazione\x20fisica\x20documento\x20%s','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','path','to-csv','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','then','destroy','error','stack','name','index','map','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','VIRTUAL','filter','options','SquareRecording','includeAll','include','rows','show','find','catch','create','update'];(function(_0x38d39a,_0x593a06){var _0x7ac00d=function(_0x9fe1ac){while(--_0x9fe1ac){_0x38d39a['push'](_0x38d39a['shift']());}};_0x7ac00d(++_0x593a06);}(_0x4b63,0x76));var _0x34b6=function(_0x449286,_0x38c70e){_0x449286=_0x449286-0x0;var _0x1f19c2=_0x4b63[_0x449286];return _0x1f19c2;};'use strict';var emlformat=require(_0x34b6('0x0'));var rimraf=require(_0x34b6('0x1'));var zipdir=require(_0x34b6('0x2'));var jsonpatch=require(_0x34b6('0x3'));var rp=require(_0x34b6('0x4'));var moment=require(_0x34b6('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0x34b6('0x6'));var sox=require('sox');var csv=require(_0x34b6('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x34b6('0x8'));var crypto=require(_0x34b6('0x9'));var jsforce=require('jsforce');var deskjs=require(_0x34b6('0xa'));var toCsv=require(_0x34b6('0x7'));var querystring=require(_0x34b6('0xb'));var Papa=require(_0x34b6('0xc'));var Redis=require(_0x34b6('0xd'));var authService=require(_0x34b6('0xe'));var qs=require(_0x34b6('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x34b6('0x10'));var logger=require('../../config/logger')('api');var utils=require(_0x34b6('0x11'));var config=require(_0x34b6('0x12'));var licenseUtil=require(_0x34b6('0x13'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x46384a,_0x555079){_0x555079=_0x555079||0xcc;return function(_0x30959b){if(_0x30959b){return _0x46384a[_0x34b6('0x14')](_0x555079);}return _0x46384a[_0x34b6('0x15')](_0x555079)[_0x34b6('0x16')]();};}function respondWithResult(_0xa05aad,_0x909a9b){_0x909a9b=_0x909a9b||0xc8;return function(_0x242f99){if(_0x242f99){return _0xa05aad[_0x34b6('0x15')](_0x909a9b)[_0x34b6('0x17')](_0x242f99);}};}function respondWithFilteredResult(_0x3b28ee,_0x441b38){return function(_0x439d7d){if(_0x439d7d){var _0x5f4649=typeof _0x441b38[_0x34b6('0x18')]===_0x34b6('0x19')&&typeof _0x441b38[_0x34b6('0x1a')]==='undefined';var _0x5a85b2=_0x439d7d[_0x34b6('0x1b')];var _0x4b18a7=_0x5f4649?0x0:_0x441b38[_0x34b6('0x18')];var _0x2a3d82=_0x5f4649?_0x439d7d[_0x34b6('0x1b')]:_0x441b38[_0x34b6('0x18')]+_0x441b38[_0x34b6('0x1a')];var _0x14ab1e;if(_0x2a3d82>=_0x5a85b2){_0x2a3d82=_0x5a85b2;_0x14ab1e=0xc8;}else{_0x14ab1e=0xce;}_0x3b28ee[_0x34b6('0x15')](_0x14ab1e);return _0x3b28ee[_0x34b6('0x1c')](_0x34b6('0x1d'),_0x4b18a7+'-'+_0x2a3d82+'/'+_0x5a85b2)[_0x34b6('0x17')](_0x439d7d);}return null;};}function patchUpdates(_0x6ac988){return function(_0x450c48){try{jsonpatch[_0x34b6('0x1e')](_0x450c48,_0x6ac988,!![]);}catch(_0x679db5){return BPromise[_0x34b6('0x1f')](_0x679db5);}return _0x450c48[_0x34b6('0x20')]();};}function saveUpdates(_0x1bda40,_0x4f72ca){return function(_0x1c665e){if(_0x1c665e){return _0x1c665e['update'](_0x1bda40)[_0x34b6('0x21')](function(_0x187542){return _0x187542;});}return null;};}function removeEntity(_0x1f7b05,_0x4c862d){return function(_0x3aa864){if(_0x3aa864){return _0x3aa864[_0x34b6('0x22')]()['then'](function(){_0x1f7b05[_0x34b6('0x15')](0xcc)['end']();});}};}function handleEntityNotFound(_0x974d6,_0x26fc40){return function(_0x3e6f6e){if(!_0x3e6f6e){_0x974d6[_0x34b6('0x14')](0x194);}return _0x3e6f6e;};}function handleError(_0x54d69f,_0x23bfc0){_0x23bfc0=_0x23bfc0||0x1f4;return function(_0x5356d4){logger[_0x34b6('0x23')](_0x5356d4[_0x34b6('0x24')]);if(_0x5356d4[_0x34b6('0x25')]){delete _0x5356d4[_0x34b6('0x25')];}_0x54d69f['status'](_0x23bfc0)['send'](_0x5356d4);};}exports[_0x34b6('0x26')]=function(_0x9fd46,_0x4fa609){var _0x268111={},_0x428401={},_0x1a3593={'count':0x0,'rows':[]};var _0x53993f=_[_0x34b6('0x27')](db['SquareRecording'][_0x34b6('0x28')],function(_0x256c0d){return{'name':_0x256c0d[_0x34b6('0x29')],'type':_0x256c0d[_0x34b6('0x2a')][_0x34b6('0x2b')]};});_0x428401[_0x34b6('0x2c')]=_[_0x34b6('0x27')](_0x53993f,'name');_0x428401[_0x34b6('0x2d')]=_[_0x34b6('0x2e')](_0x9fd46[_0x34b6('0x2d')]);_0x428401[_0x34b6('0x2f')]=_['intersection'](_0x428401[_0x34b6('0x2c')],_0x428401['query']);_0x268111[_0x34b6('0x30')]=_[_0x34b6('0x31')](_0x428401[_0x34b6('0x2c')],qs[_0x34b6('0x32')](_0x9fd46[_0x34b6('0x2d')][_0x34b6('0x32')]));_0x268111[_0x34b6('0x30')]=_0x268111[_0x34b6('0x30')][_0x34b6('0x33')]?_0x268111[_0x34b6('0x30')]:_0x428401[_0x34b6('0x2c')];if(!_0x9fd46[_0x34b6('0x2d')][_0x34b6('0x34')](_0x34b6('0x35'))){_0x268111[_0x34b6('0x1a')]=qs[_0x34b6('0x1a')](_0x9fd46['query'][_0x34b6('0x1a')]);_0x268111[_0x34b6('0x18')]=qs[_0x34b6('0x18')](_0x9fd46[_0x34b6('0x2d')][_0x34b6('0x18')]);}_0x268111[_0x34b6('0x36')]=qs[_0x34b6('0x37')](_0x9fd46['query'][_0x34b6('0x37')]);_0x268111[_0x34b6('0x38')]=qs[_0x34b6('0x2f')](_[_0x34b6('0x39')](_0x9fd46[_0x34b6('0x2d')],_0x428401['filters']),_0x53993f);if(_0x9fd46['query']['filter']){_0x268111[_0x34b6('0x38')]=_['merge'](_0x268111[_0x34b6('0x38')],{'$or':_[_0x34b6('0x27')](_0x53993f,function(_0x56f972){if(_0x56f972[_0x34b6('0x2a')]!==_0x34b6('0x3a')){var _0x5edf2e={};_0x5edf2e[_0x56f972['name']]={'$like':'%'+_0x9fd46[_0x34b6('0x2d')][_0x34b6('0x3b')]+'%'};return _0x5edf2e;}})});}_0x268111=_['merge']({},_0x268111,_0x9fd46[_0x34b6('0x3c')]);var _0xd5b521={'where':_0x268111[_0x34b6('0x38')]};return db[_0x34b6('0x3d')][_0x34b6('0x1b')](_0xd5b521)['then'](function(_0x5053cb){_0x1a3593[_0x34b6('0x1b')]=_0x5053cb;if(_0x9fd46[_0x34b6('0x2d')][_0x34b6('0x3e')]){_0x268111[_0x34b6('0x3f')]=[{'all':!![]}];}return db['SquareRecording']['findAll'](_0x268111);})[_0x34b6('0x21')](function(_0x4a7ccb){_0x1a3593[_0x34b6('0x40')]=_0x4a7ccb;return _0x1a3593;})[_0x34b6('0x21')](respondWithFilteredResult(_0x4fa609,_0x268111))['catch'](handleError(_0x4fa609,null));};exports[_0x34b6('0x41')]=function(_0x65b6d5,_0x1b2714){var _0x24904d={'raw':!![],'where':{'id':_0x65b6d5['params']['id']}},_0xeab595={};_0xeab595[_0x34b6('0x2c')]=_[_0x34b6('0x2e')](db[_0x34b6('0x3d')][_0x34b6('0x28')]);_0xeab595[_0x34b6('0x2d')]=_[_0x34b6('0x2e')](_0x65b6d5['query']);_0xeab595['filters']=_[_0x34b6('0x31')](_0xeab595['model'],_0xeab595[_0x34b6('0x2d')]);_0x24904d[_0x34b6('0x30')]=_['intersection'](_0xeab595[_0x34b6('0x2c')],qs[_0x34b6('0x32')](_0x65b6d5['query'][_0x34b6('0x32')]));_0x24904d['attributes']=_0x24904d['attributes'][_0x34b6('0x33')]?_0x24904d['attributes']:_0xeab595['model'];if(_0x65b6d5[_0x34b6('0x2d')]['includeAll']){_0x24904d['include']=[{'all':!![]}];}_0x24904d=_['merge']({},_0x24904d,_0x65b6d5[_0x34b6('0x3c')]);return db['SquareRecording'][_0x34b6('0x42')](_0x24904d)[_0x34b6('0x21')](handleEntityNotFound(_0x1b2714,null))[_0x34b6('0x21')](respondWithResult(_0x1b2714,null))[_0x34b6('0x43')](handleError(_0x1b2714,null));};exports['create']=function(_0x29dbf9,_0x114737){return db[_0x34b6('0x3d')][_0x34b6('0x44')](_0x29dbf9['body'],{})['then'](respondWithResult(_0x114737,0xc9))[_0x34b6('0x43')](handleError(_0x114737,null));};exports[_0x34b6('0x45')]=function(_0x3cc1ea,_0x384c2e){if(_0x3cc1ea[_0x34b6('0x46')]['id']){delete _0x3cc1ea[_0x34b6('0x46')]['id'];}return db[_0x34b6('0x3d')][_0x34b6('0x42')]({'where':{'id':_0x3cc1ea[_0x34b6('0x47')]['id']}})['then'](handleEntityNotFound(_0x384c2e,null))[_0x34b6('0x21')](saveUpdates(_0x3cc1ea[_0x34b6('0x46')],null))[_0x34b6('0x21')](respondWithResult(_0x384c2e,null))[_0x34b6('0x43')](handleError(_0x384c2e,null));};exports[_0x34b6('0x48')]=function(_0x224d14,_0x5814f0,_0x34e6e0){var _0xd5da8a=require(_0x34b6('0x49'));var _0x344f51=![];var _0x113e82={};if(_0x224d14[_0x34b6('0x2d')]['type']&&_0x224d14[_0x34b6('0x2d')][_0x34b6('0x2a')]==='uniqueid'){_0x113e82[_0x34b6('0x4a')]=_0x224d14['params']['id'];}else{_0x113e82['id']=_0x224d14[_0x34b6('0x47')]['id'];}return db[_0x34b6('0x3d')][_0x34b6('0x42')]({'where':_0x113e82,'attributes':['id',_0x34b6('0x4b'),_0x34b6('0x4c')],'raw':!![]})[_0x34b6('0x21')](handleEntityNotFound(_0x5814f0,null))[_0x34b6('0x21')](function(_0x4df42a){if(_0x4df42a){var _0x2a0c4a=_0x4df42a[_0x34b6('0x4b')];var _0x4ee081=util['format'](_0x34b6('0x4d'),_0x2a0c4a);if(fs[_0x34b6('0x4e')](_0x4ee081)){_0x344f51=!![];return _0xd5da8a[_0x34b6('0x4f')](_0x4ee081,_0x2a0c4a,config[_0x34b6('0x50')][_0x34b6('0x51')])[_0x34b6('0x21')](function(){return _0x4df42a;});}return _0x4df42a;}})['then'](function(_0x82b902){if(_0x82b902){var _0x130729=_0x82b902['savePath'];if(!fs[_0x34b6('0x4e')](_0x130729)){throw new db[(_0x34b6('0x52'))][(_0x34b6('0x53'))](_0x34b6('0x54'));}if(_0x82b902['filename']){return _0x5814f0[_0x34b6('0x48')](_0x130729,_0x82b902[_0x34b6('0x4c')]+path['extname'](_0x130729),function(){if(_0x344f51){fs[_0x34b6('0x55')](_0x130729);}});}else{return _0x5814f0[_0x34b6('0x48')](_0x130729,function(_0x4fd71e){if(_0x344f51){fs[_0x34b6('0x55')](_0x130729);}});}}})[_0x34b6('0x43')](function(_0x2a5cf0){if(_0x2a5cf0['message']===_0x34b6('0x54')){_0x5814f0[_0x34b6('0x15')](0x194)[_0x34b6('0x56')](_0x34b6('0x57'));}else{return handleError(_0x5814f0,null);}});};exports[_0x34b6('0x22')]=function(_0xcb8598,_0x3d082c){return db[_0x34b6('0x3d')]['find']({'where':{'id':_0xcb8598[_0x34b6('0x47')]['id']}})[_0x34b6('0x21')](function(_0xa592a6){if(_[_0x34b6('0x58')](_0xa592a6)){throw new ReferenceError('Entity\x20not\x20found');}return _0xa592a6;})[_0x34b6('0x21')](function(_0x258253){var _0x28acb9=_0x258253[_0x34b6('0x4b')];logger[_0x34b6('0x59')](_0x34b6('0x5a'),_0x28acb9);if(!_[_0x34b6('0x58')](_0x258253[_0x34b6('0x4b')])&&fs[_0x34b6('0x4e')](_0x28acb9)){logger['info'](_0x34b6('0x5b')+_0x28acb9+_0x34b6('0x5c'));fs['unlinkSync'](_0x28acb9);}_0x28acb9=_0x28acb9+'.cypher';if(!_[_0x34b6('0x58')](_0x258253['savePath'])&&fs[_0x34b6('0x4e')](_0x28acb9)){logger[_0x34b6('0x59')](_0x34b6('0x5b')+_0x28acb9+_0x34b6('0x5c'));fs[_0x34b6('0x5d')](_0x28acb9);}return _0x258253;})[_0x34b6('0x21')](function(_0x31c4ef){if(!_0x31c4ef)throw new InternalError();return _0x31c4ef[_0x34b6('0x22')]();})[_0x34b6('0x21')](function(){_0x3d082c[_0x34b6('0x15')](0xcc)[_0x34b6('0x16')]();})[_0x34b6('0x43')](handleError(_0x3d082c,null));};
\ No newline at end of file