Built motion from commit da617fac.|2.6.6
[motion2.git] / server / api / attachment / attachment.controller.js
index 45ba3b7..291e96d 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xa0b0=['find','clone','get','createdAt','updatedAt','body','omit','create','destroy','file','originalname','basename','filename','mimetype','download','findOne','ChatOfflineMessageId','join','root','server/files/attachments/','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','jsforce','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status','offset','undefined','count','limit','set','Content-Range','reject','save','update','then','error','stack','name','send','index','map','Attachment','rawAttributes','fieldName','type','model','keys','query','filters','intersection','fields','attributes','length','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','findAll','rows','catch','show','params'];(function(_0x5892ec,_0x375667){var _0xd798e2=function(_0x5202bb){while(--_0x5202bb){_0x5892ec['push'](_0x5892ec['shift']());}};_0xd798e2(++_0x375667);}(_0xa0b0,0x11c));var _0x0a0b=function(_0x3dba1b,_0x335265){_0x3dba1b=_0x3dba1b-0x0;var _0x4c75e7=_0xa0b0[_0x3dba1b];return _0x4c75e7;};'use strict';var emlformat=require(_0x0a0b('0x0'));var rimraf=require(_0x0a0b('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x0a0b('0x2'));var rp=require(_0x0a0b('0x3'));var moment=require('moment');var BPromise=require(_0x0a0b('0x4'));var Mustache=require(_0x0a0b('0x5'));var util=require(_0x0a0b('0x6'));var path=require(_0x0a0b('0x7'));var sox=require(_0x0a0b('0x8'));var csv=require(_0x0a0b('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x0a0b('0xa'));var _=require(_0x0a0b('0xb'));var squel=require(_0x0a0b('0xc'));var crypto=require('crypto');var jsforce=require(_0x0a0b('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x0a0b('0x9'));var querystring=require(_0x0a0b('0xe'));var Papa=require(_0x0a0b('0xf'));var Redis=require(_0x0a0b('0x10'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x0a0b('0x11'));var hardwareService=require(_0x0a0b('0x12'));var logger=require(_0x0a0b('0x13'))(_0x0a0b('0x14'));var utils=require('../../config/utils');var config=require(_0x0a0b('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x0a0b('0x16'))['db'];function respondWithStatusCode(_0x9c867c,_0x77a8c4){_0x77a8c4=_0x77a8c4||0xcc;return function(_0x454ace){if(_0x454ace){return _0x9c867c[_0x0a0b('0x17')](_0x77a8c4);}return _0x9c867c[_0x0a0b('0x18')](_0x77a8c4)['end']();};}function respondWithResult(_0x2a07b3,_0x4e19e0){_0x4e19e0=_0x4e19e0||0xc8;return function(_0x71c4c9){if(_0x71c4c9){return _0x2a07b3[_0x0a0b('0x18')](_0x4e19e0)['json'](_0x71c4c9);}};}function respondWithFilteredResult(_0x23556c,_0xef33e7){return function(_0x41d439){if(_0x41d439){var _0x54edcd=typeof _0xef33e7[_0x0a0b('0x19')]===_0x0a0b('0x1a')&&typeof _0xef33e7['limit']===_0x0a0b('0x1a');var _0x5b2e34=_0x41d439[_0x0a0b('0x1b')];var _0x4f3b90=_0x54edcd?0x0:_0xef33e7[_0x0a0b('0x19')];var _0x37b549=_0x54edcd?_0x41d439[_0x0a0b('0x1b')]:_0xef33e7[_0x0a0b('0x19')]+_0xef33e7[_0x0a0b('0x1c')];var _0xdebf8b;if(_0x37b549>=_0x5b2e34){_0x37b549=_0x5b2e34;_0xdebf8b=0xc8;}else{_0xdebf8b=0xce;}_0x23556c[_0x0a0b('0x18')](_0xdebf8b);return _0x23556c[_0x0a0b('0x1d')](_0x0a0b('0x1e'),_0x4f3b90+'-'+_0x37b549+'/'+_0x5b2e34)['json'](_0x41d439);}return null;};}function patchUpdates(_0x16c137){return function(_0x1d1cc2){try{jsonpatch['apply'](_0x1d1cc2,_0x16c137,!![]);}catch(_0x453d5f){return BPromise[_0x0a0b('0x1f')](_0x453d5f);}return _0x1d1cc2[_0x0a0b('0x20')]();};}function saveUpdates(_0x3399b6,_0x1c2e48){return function(_0x15a89c){if(_0x15a89c){return _0x15a89c[_0x0a0b('0x21')](_0x3399b6)[_0x0a0b('0x22')](function(_0x4c5235){return _0x4c5235;});}return null;};}function removeEntity(_0x52b276,_0x31e2ab){return function(_0x15afba){if(_0x15afba){return _0x15afba['destroy']()[_0x0a0b('0x22')](function(){_0x52b276[_0x0a0b('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x33fce5,_0x375baf){return function(_0x35b5e1){if(!_0x35b5e1){_0x33fce5[_0x0a0b('0x17')](0x194);}return _0x35b5e1;};}function handleError(_0x256c6a,_0x29f482){_0x29f482=_0x29f482||0x1f4;return function(_0x1acde3){logger[_0x0a0b('0x23')](_0x1acde3[_0x0a0b('0x24')]);if(_0x1acde3[_0x0a0b('0x25')]){delete _0x1acde3[_0x0a0b('0x25')];}_0x256c6a[_0x0a0b('0x18')](_0x29f482)[_0x0a0b('0x26')](_0x1acde3);};}exports[_0x0a0b('0x27')]=function(_0x5531f1,_0x4153f8){var _0x4f38e5={},_0x3ba869={},_0x5f1a3b={'count':0x0,'rows':[]};var _0x3edb14=_[_0x0a0b('0x28')](db[_0x0a0b('0x29')][_0x0a0b('0x2a')],function(_0x1400a3){return{'name':_0x1400a3[_0x0a0b('0x2b')],'type':_0x1400a3[_0x0a0b('0x2c')]['key']};});_0x3ba869[_0x0a0b('0x2d')]=_['map'](_0x3edb14,_0x0a0b('0x25'));_0x3ba869['query']=_[_0x0a0b('0x2e')](_0x5531f1[_0x0a0b('0x2f')]);_0x3ba869[_0x0a0b('0x30')]=_[_0x0a0b('0x31')](_0x3ba869[_0x0a0b('0x2d')],_0x3ba869[_0x0a0b('0x2f')]);_0x4f38e5['attributes']=_['intersection'](_0x3ba869[_0x0a0b('0x2d')],qs[_0x0a0b('0x32')](_0x5531f1['query'][_0x0a0b('0x32')]));_0x4f38e5[_0x0a0b('0x33')]=_0x4f38e5['attributes'][_0x0a0b('0x34')]?_0x4f38e5[_0x0a0b('0x33')]:_0x3ba869[_0x0a0b('0x2d')];if(!_0x5531f1[_0x0a0b('0x2f')][_0x0a0b('0x35')]('nolimit')){_0x4f38e5[_0x0a0b('0x1c')]=qs['limit'](_0x5531f1[_0x0a0b('0x2f')][_0x0a0b('0x1c')]);_0x4f38e5['offset']=qs[_0x0a0b('0x19')](_0x5531f1[_0x0a0b('0x2f')][_0x0a0b('0x19')]);}_0x4f38e5[_0x0a0b('0x36')]=qs['sort'](_0x5531f1[_0x0a0b('0x2f')][_0x0a0b('0x37')]);_0x4f38e5[_0x0a0b('0x38')]=qs[_0x0a0b('0x30')](_[_0x0a0b('0x39')](_0x5531f1[_0x0a0b('0x2f')],_0x3ba869[_0x0a0b('0x30')]),_0x3edb14);if(_0x5531f1['query'][_0x0a0b('0x3a')]){_0x4f38e5[_0x0a0b('0x38')]=_[_0x0a0b('0x3b')](_0x4f38e5[_0x0a0b('0x38')],{'$or':_[_0x0a0b('0x28')](_0x3edb14,function(_0xd56ab6){if(_0xd56ab6[_0x0a0b('0x2c')]!==_0x0a0b('0x3c')){var _0x35ebf1={};_0x35ebf1[_0xd56ab6[_0x0a0b('0x25')]]={'$like':'%'+_0x5531f1[_0x0a0b('0x2f')][_0x0a0b('0x3a')]+'%'};return _0x35ebf1;}})});}_0x4f38e5=_[_0x0a0b('0x3b')]({},_0x4f38e5,_0x5531f1[_0x0a0b('0x3d')]);var _0x4efc9f={'where':_0x4f38e5[_0x0a0b('0x38')]};return db[_0x0a0b('0x29')][_0x0a0b('0x1b')](_0x4efc9f)[_0x0a0b('0x22')](function(_0x1ab828){_0x5f1a3b[_0x0a0b('0x1b')]=_0x1ab828;if(_0x5531f1[_0x0a0b('0x2f')][_0x0a0b('0x3e')]){_0x4f38e5['include']=[{'all':!![]}];}return db[_0x0a0b('0x29')][_0x0a0b('0x3f')](_0x4f38e5);})['then'](function(_0x736531){_0x5f1a3b[_0x0a0b('0x40')]=_0x736531;return _0x5f1a3b;})[_0x0a0b('0x22')](respondWithFilteredResult(_0x4153f8,_0x4f38e5))[_0x0a0b('0x41')](handleError(_0x4153f8,null));};exports[_0x0a0b('0x42')]=function(_0x127539,_0x1acb4c){var _0x117bc3={'raw':!![],'where':{'id':_0x127539[_0x0a0b('0x43')]['id']}},_0xcbe302={};_0xcbe302[_0x0a0b('0x2d')]=_[_0x0a0b('0x2e')](db[_0x0a0b('0x29')][_0x0a0b('0x2a')]);_0xcbe302['query']=_[_0x0a0b('0x2e')](_0x127539['query']);_0xcbe302[_0x0a0b('0x30')]=_[_0x0a0b('0x31')](_0xcbe302[_0x0a0b('0x2d')],_0xcbe302['query']);_0x117bc3[_0x0a0b('0x33')]=_['intersection'](_0xcbe302['model'],qs[_0x0a0b('0x32')](_0x127539[_0x0a0b('0x2f')][_0x0a0b('0x32')]));_0x117bc3[_0x0a0b('0x33')]=_0x117bc3[_0x0a0b('0x33')]['length']?_0x117bc3[_0x0a0b('0x33')]:_0xcbe302[_0x0a0b('0x2d')];if(_0x127539[_0x0a0b('0x2f')][_0x0a0b('0x3e')]){_0x117bc3['include']=[{'all':!![]}];}_0x117bc3=_[_0x0a0b('0x3b')]({},_0x117bc3,_0x127539['options']);return db[_0x0a0b('0x29')][_0x0a0b('0x44')](_0x117bc3)[_0x0a0b('0x22')](handleEntityNotFound(_0x1acb4c,null))[_0x0a0b('0x22')](respondWithResult(_0x1acb4c,null))['catch'](handleError(_0x1acb4c,null));};exports[_0x0a0b('0x45')]=function(_0x499601,_0x134d27){var _0x5c8ffd={'where':{'id':_0x499601['params']['id']}},_0x3ad1e0={};_0x3ad1e0[_0x0a0b('0x2d')]=_[_0x0a0b('0x2e')](db[_0x0a0b('0x29')][_0x0a0b('0x2a')]);_0x5c8ffd[_0x0a0b('0x33')]=_['intersection'](_0x3ad1e0['model'],qs[_0x0a0b('0x32')](_0x499601[_0x0a0b('0x2f')][_0x0a0b('0x32')]));_0x5c8ffd[_0x0a0b('0x33')]=_0x5c8ffd[_0x0a0b('0x33')][_0x0a0b('0x34')]?_0x5c8ffd[_0x0a0b('0x33')]:_0x3ad1e0['model'];if(_0x499601[_0x0a0b('0x2f')][_0x0a0b('0x3e')]){_0x5c8ffd['include']=[{'all':!![]}];}_0x5c8ffd=_['merge']({},_0x5c8ffd,_0x499601['options']);return db['Attachment'][_0x0a0b('0x44')](_0x5c8ffd)['then'](handleEntityNotFound(_0x134d27,null))[_0x0a0b('0x22')](function(_0x151846){if(_0x151846){var _0x403146=_0x151846[_0x0a0b('0x46')]({'plain':!![]});_0x403146=qs['omit'](_0x403146,['id',_0x0a0b('0x47'),_0x0a0b('0x48')]);_0x499601[_0x0a0b('0x49')]=_[_0x0a0b('0x4a')](_0x499601[_0x0a0b('0x49')],['id',_0x0a0b('0x47'),_0x0a0b('0x48')]);return db[_0x0a0b('0x29')][_0x0a0b('0x4b')](_[_0x0a0b('0x3b')](_0x403146,_0x499601['body']),{'include':_0x499601[_0x0a0b('0x2f')][_0x0a0b('0x3e')]?[{'all':!![]}]:undefined});}})['then'](respondWithResult(_0x134d27,0xc9))[_0x0a0b('0x41')](handleError(_0x134d27,null));};exports[_0x0a0b('0x21')]=function(_0xc168b,_0x3c50c8){if(_0xc168b['body']['id']){delete _0xc168b['body']['id'];}return db[_0x0a0b('0x29')][_0x0a0b('0x44')]({'where':{'id':_0xc168b[_0x0a0b('0x43')]['id']}})['then'](handleEntityNotFound(_0x3c50c8,null))[_0x0a0b('0x22')](saveUpdates(_0xc168b[_0x0a0b('0x49')],null))[_0x0a0b('0x22')](respondWithResult(_0x3c50c8,null))[_0x0a0b('0x41')](handleError(_0x3c50c8,null));};exports[_0x0a0b('0x4c')]=function(_0x4149c7,_0x13615d){return db['Attachment'][_0x0a0b('0x44')]({'where':{'id':_0x4149c7[_0x0a0b('0x43')]['id']}})[_0x0a0b('0x22')](handleEntityNotFound(_0x13615d,null))[_0x0a0b('0x22')](removeEntity(_0x13615d,null))['catch'](handleError(_0x13615d,null));};exports[_0x0a0b('0x4b')]=function(_0x1f66c9,_0x2b16d5,_0x11703d){_0x1f66c9['body'][_0x0a0b('0x25')]=_0x1f66c9[_0x0a0b('0x4d')][_0x0a0b('0x4e')];_0x1f66c9['body'][_0x0a0b('0x4f')]=_0x1f66c9[_0x0a0b('0x4d')][_0x0a0b('0x50')];_0x1f66c9['body'][_0x0a0b('0x2c')]=_0x1f66c9[_0x0a0b('0x4d')][_0x0a0b('0x51')];return db[_0x0a0b('0x29')][_0x0a0b('0x4b')](_0x1f66c9['body'])[_0x0a0b('0x22')](respondWithResult(_0x2b16d5,0xc9))[_0x0a0b('0x41')](handleError(_0x2b16d5,null));};exports[_0x0a0b('0x52')]=function(_0x3d6759,_0x1a21a6,_0x4c96e4){return db['Attachment'][_0x0a0b('0x53')]({'where':{'id':_0x3d6759[_0x0a0b('0x43')]['id']},'raw':!![]})[_0x0a0b('0x22')](handleEntityNotFound(_0x1a21a6,null))[_0x0a0b('0x22')](function(_0x55c40e){if(_0x55c40e){var _0x576288=_0x55c40e[_0x0a0b('0x54')]!==null;var _0x1a1c9d=path[_0x0a0b('0x55')](config[_0x0a0b('0x56')],_0x0a0b('0x57'));if(_0x576288){_0x1a1c9d=path[_0x0a0b('0x55')](_0x1a1c9d,'offline-chat/');}var _0x1b6c37=path['join'](_0x1a1c9d,_0x55c40e[_0x0a0b('0x4f')]);return _0x1a21a6[_0x0a0b('0x52')](_0x1b6c37);}})[_0x0a0b('0x41')](handleError(_0x1a21a6,null));};
\ No newline at end of file
+var _0x2f31=['../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','offset','undefined','count','limit','set','Content-Range','apply','reject','then','end','error','stack','name','send','index','Attachment','rawAttributes','fieldName','key','model','map','keys','filters','intersection','query','fields','attributes','length','hasOwnProperty','order','sort','where','merge','type','VIRTUAL','filter','includeAll','include','rows','catch','show','options','get','updatedAt','omit','body','createdAt','update','find','params','create','file','originalname','basename','findOne','ChatOfflineMessageId','join','root','server/files/attachments/','offline-chat/','download','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch'];(function(_0x1780f8,_0x11ba93){var _0x33a410=function(_0x2a015f){while(--_0x2a015f){_0x1780f8['push'](_0x1780f8['shift']());}};_0x33a410(++_0x11ba93);}(_0x2f31,0x100));var _0x12f3=function(_0x58404e,_0x179d39){_0x58404e=_0x58404e-0x0;var _0x436571=_0x2f31[_0x58404e];return _0x436571;};'use strict';var emlformat=require(_0x12f3('0x0'));var rimraf=require(_0x12f3('0x1'));var zipdir=require(_0x12f3('0x2'));var jsonpatch=require(_0x12f3('0x3'));var rp=require(_0x12f3('0x4'));var moment=require(_0x12f3('0x5'));var BPromise=require(_0x12f3('0x6'));var Mustache=require(_0x12f3('0x7'));var util=require('util');var path=require(_0x12f3('0x8'));var sox=require(_0x12f3('0x9'));var csv=require(_0x12f3('0xa'));var ejs=require(_0x12f3('0xb'));var fs=require('fs');var fs_extra=require(_0x12f3('0xc'));var _=require(_0x12f3('0xd'));var squel=require('squel');var crypto=require(_0x12f3('0xe'));var jsforce=require(_0x12f3('0xf'));var deskjs=require(_0x12f3('0x10'));var toCsv=require(_0x12f3('0xa'));var querystring=require(_0x12f3('0x11'));var Papa=require(_0x12f3('0x12'));var Redis=require(_0x12f3('0x13'));var authService=require(_0x12f3('0x14'));var qs=require(_0x12f3('0x15'));var as=require(_0x12f3('0x16'));var hardwareService=require(_0x12f3('0x17'));var logger=require(_0x12f3('0x18'))(_0x12f3('0x19'));var utils=require(_0x12f3('0x1a'));var config=require(_0x12f3('0x1b'));var licenseUtil=require(_0x12f3('0x1c'));var db=require(_0x12f3('0x1d'))['db'];function respondWithStatusCode(_0x486961,_0x193461){_0x193461=_0x193461||0xcc;return function(_0x1e5f63){if(_0x1e5f63){return _0x486961[_0x12f3('0x1e')](_0x193461);}return _0x486961[_0x12f3('0x1f')](_0x193461)['end']();};}function respondWithResult(_0x2685d6,_0x2d5722){_0x2d5722=_0x2d5722||0xc8;return function(_0x582b8e){if(_0x582b8e){return _0x2685d6[_0x12f3('0x1f')](_0x2d5722)['json'](_0x582b8e);}};}function respondWithFilteredResult(_0x1e6788,_0x2fd376){return function(_0x431806){if(_0x431806){var _0x5aba51=typeof _0x2fd376[_0x12f3('0x20')]==='undefined'&&typeof _0x2fd376['limit']===_0x12f3('0x21');var _0x2a6aef=_0x431806[_0x12f3('0x22')];var _0x1a7ab0=_0x5aba51?0x0:_0x2fd376[_0x12f3('0x20')];var _0x253ab8=_0x5aba51?_0x431806[_0x12f3('0x22')]:_0x2fd376[_0x12f3('0x20')]+_0x2fd376[_0x12f3('0x23')];var _0x1dfd79;if(_0x253ab8>=_0x2a6aef){_0x253ab8=_0x2a6aef;_0x1dfd79=0xc8;}else{_0x1dfd79=0xce;}_0x1e6788[_0x12f3('0x1f')](_0x1dfd79);return _0x1e6788[_0x12f3('0x24')](_0x12f3('0x25'),_0x1a7ab0+'-'+_0x253ab8+'/'+_0x2a6aef)['json'](_0x431806);}return null;};}function patchUpdates(_0x56f3ae){return function(_0x4b7df3){try{jsonpatch[_0x12f3('0x26')](_0x4b7df3,_0x56f3ae,!![]);}catch(_0x20b50b){return BPromise[_0x12f3('0x27')](_0x20b50b);}return _0x4b7df3['save']();};}function saveUpdates(_0x14d297,_0x17fadc){return function(_0x3b378a){if(_0x3b378a){return _0x3b378a['update'](_0x14d297)['then'](function(_0x5ed878){return _0x5ed878;});}return null;};}function removeEntity(_0x5ca832,_0x28a13b){return function(_0x3ef402){if(_0x3ef402){return _0x3ef402['destroy']()[_0x12f3('0x28')](function(){_0x5ca832['status'](0xcc)[_0x12f3('0x29')]();});}};}function handleEntityNotFound(_0x465e9d,_0x1ade23){return function(_0x18807b){if(!_0x18807b){_0x465e9d['sendStatus'](0x194);}return _0x18807b;};}function handleError(_0x4c11fb,_0x21bc2e){_0x21bc2e=_0x21bc2e||0x1f4;return function(_0x1c73b8){logger[_0x12f3('0x2a')](_0x1c73b8[_0x12f3('0x2b')]);if(_0x1c73b8[_0x12f3('0x2c')]){delete _0x1c73b8[_0x12f3('0x2c')];}_0x4c11fb[_0x12f3('0x1f')](_0x21bc2e)[_0x12f3('0x2d')](_0x1c73b8);};}exports[_0x12f3('0x2e')]=function(_0x115e98,_0x3cbee1){var _0xcf00f5={},_0x231e33={},_0x352f77={'count':0x0,'rows':[]};var _0x156fb4=_['map'](db[_0x12f3('0x2f')][_0x12f3('0x30')],function(_0x3a8d68){return{'name':_0x3a8d68[_0x12f3('0x31')],'type':_0x3a8d68['type'][_0x12f3('0x32')]};});_0x231e33[_0x12f3('0x33')]=_[_0x12f3('0x34')](_0x156fb4,_0x12f3('0x2c'));_0x231e33['query']=_[_0x12f3('0x35')](_0x115e98['query']);_0x231e33[_0x12f3('0x36')]=_[_0x12f3('0x37')](_0x231e33['model'],_0x231e33[_0x12f3('0x38')]);_0xcf00f5['attributes']=_[_0x12f3('0x37')](_0x231e33[_0x12f3('0x33')],qs[_0x12f3('0x39')](_0x115e98[_0x12f3('0x38')][_0x12f3('0x39')]));_0xcf00f5[_0x12f3('0x3a')]=_0xcf00f5['attributes'][_0x12f3('0x3b')]?_0xcf00f5[_0x12f3('0x3a')]:_0x231e33[_0x12f3('0x33')];if(!_0x115e98[_0x12f3('0x38')][_0x12f3('0x3c')]('nolimit')){_0xcf00f5[_0x12f3('0x23')]=qs[_0x12f3('0x23')](_0x115e98[_0x12f3('0x38')][_0x12f3('0x23')]);_0xcf00f5['offset']=qs[_0x12f3('0x20')](_0x115e98[_0x12f3('0x38')][_0x12f3('0x20')]);}_0xcf00f5[_0x12f3('0x3d')]=qs[_0x12f3('0x3e')](_0x115e98[_0x12f3('0x38')][_0x12f3('0x3e')]);_0xcf00f5[_0x12f3('0x3f')]=qs['filters'](_['pick'](_0x115e98[_0x12f3('0x38')],_0x231e33[_0x12f3('0x36')]),_0x156fb4);if(_0x115e98[_0x12f3('0x38')]['filter']){_0xcf00f5[_0x12f3('0x3f')]=_[_0x12f3('0x40')](_0xcf00f5[_0x12f3('0x3f')],{'$or':_[_0x12f3('0x34')](_0x156fb4,function(_0x41cc9d){if(_0x41cc9d[_0x12f3('0x41')]!==_0x12f3('0x42')){var _0xefa749={};_0xefa749[_0x41cc9d['name']]={'$like':'%'+_0x115e98[_0x12f3('0x38')][_0x12f3('0x43')]+'%'};return _0xefa749;}})});}_0xcf00f5=_['merge']({},_0xcf00f5,_0x115e98['options']);var _0x28e32a={'where':_0xcf00f5[_0x12f3('0x3f')]};return db[_0x12f3('0x2f')][_0x12f3('0x22')](_0x28e32a)[_0x12f3('0x28')](function(_0x388fad){_0x352f77[_0x12f3('0x22')]=_0x388fad;if(_0x115e98[_0x12f3('0x38')][_0x12f3('0x44')]){_0xcf00f5[_0x12f3('0x45')]=[{'all':!![]}];}return db[_0x12f3('0x2f')]['findAll'](_0xcf00f5);})[_0x12f3('0x28')](function(_0x5d0867){_0x352f77[_0x12f3('0x46')]=_0x5d0867;return _0x352f77;})[_0x12f3('0x28')](respondWithFilteredResult(_0x3cbee1,_0xcf00f5))[_0x12f3('0x47')](handleError(_0x3cbee1,null));};exports[_0x12f3('0x48')]=function(_0xd5dea7,_0x400fcb){var _0x498ac2={'raw':!![],'where':{'id':_0xd5dea7['params']['id']}},_0x57cfcb={};_0x57cfcb['model']=_[_0x12f3('0x35')](db['Attachment'][_0x12f3('0x30')]);_0x57cfcb['query']=_[_0x12f3('0x35')](_0xd5dea7[_0x12f3('0x38')]);_0x57cfcb[_0x12f3('0x36')]=_[_0x12f3('0x37')](_0x57cfcb[_0x12f3('0x33')],_0x57cfcb[_0x12f3('0x38')]);_0x498ac2[_0x12f3('0x3a')]=_[_0x12f3('0x37')](_0x57cfcb['model'],qs['fields'](_0xd5dea7[_0x12f3('0x38')][_0x12f3('0x39')]));_0x498ac2['attributes']=_0x498ac2[_0x12f3('0x3a')]['length']?_0x498ac2[_0x12f3('0x3a')]:_0x57cfcb['model'];if(_0xd5dea7[_0x12f3('0x38')][_0x12f3('0x44')]){_0x498ac2[_0x12f3('0x45')]=[{'all':!![]}];}_0x498ac2=_[_0x12f3('0x40')]({},_0x498ac2,_0xd5dea7['options']);return db['Attachment']['find'](_0x498ac2)[_0x12f3('0x28')](handleEntityNotFound(_0x400fcb,null))[_0x12f3('0x28')](respondWithResult(_0x400fcb,null))[_0x12f3('0x47')](handleError(_0x400fcb,null));};exports['clone']=function(_0x278cc8,_0x590753){var _0x1ad71b={'where':{'id':_0x278cc8['params']['id']}},_0x16d31b={};_0x16d31b[_0x12f3('0x33')]=_[_0x12f3('0x35')](db['Attachment']['rawAttributes']);_0x1ad71b[_0x12f3('0x3a')]=_[_0x12f3('0x37')](_0x16d31b['model'],qs[_0x12f3('0x39')](_0x278cc8['query'][_0x12f3('0x39')]));_0x1ad71b[_0x12f3('0x3a')]=_0x1ad71b[_0x12f3('0x3a')][_0x12f3('0x3b')]?_0x1ad71b['attributes']:_0x16d31b[_0x12f3('0x33')];if(_0x278cc8[_0x12f3('0x38')][_0x12f3('0x44')]){_0x1ad71b[_0x12f3('0x45')]=[{'all':!![]}];}_0x1ad71b=_['merge']({},_0x1ad71b,_0x278cc8[_0x12f3('0x49')]);return db[_0x12f3('0x2f')]['find'](_0x1ad71b)[_0x12f3('0x28')](handleEntityNotFound(_0x590753,null))['then'](function(_0xc44fd1){if(_0xc44fd1){var _0x307f4c=_0xc44fd1[_0x12f3('0x4a')]({'plain':!![]});_0x307f4c=qs['omit'](_0x307f4c,['id','createdAt',_0x12f3('0x4b')]);_0x278cc8['body']=_[_0x12f3('0x4c')](_0x278cc8[_0x12f3('0x4d')],['id',_0x12f3('0x4e'),_0x12f3('0x4b')]);return db[_0x12f3('0x2f')]['create'](_[_0x12f3('0x40')](_0x307f4c,_0x278cc8[_0x12f3('0x4d')]),{'include':_0x278cc8[_0x12f3('0x38')][_0x12f3('0x44')]?[{'all':!![]}]:undefined});}})[_0x12f3('0x28')](respondWithResult(_0x590753,0xc9))[_0x12f3('0x47')](handleError(_0x590753,null));};exports[_0x12f3('0x4f')]=function(_0x21b1ab,_0x17c04b){if(_0x21b1ab['body']['id']){delete _0x21b1ab[_0x12f3('0x4d')]['id'];}return db[_0x12f3('0x2f')][_0x12f3('0x50')]({'where':{'id':_0x21b1ab[_0x12f3('0x51')]['id']}})['then'](handleEntityNotFound(_0x17c04b,null))[_0x12f3('0x28')](saveUpdates(_0x21b1ab['body'],null))['then'](respondWithResult(_0x17c04b,null))[_0x12f3('0x47')](handleError(_0x17c04b,null));};exports['destroy']=function(_0x2162b3,_0x521a75){return db['Attachment']['find']({'where':{'id':_0x2162b3[_0x12f3('0x51')]['id']}})[_0x12f3('0x28')](handleEntityNotFound(_0x521a75,null))[_0x12f3('0x28')](removeEntity(_0x521a75,null))[_0x12f3('0x47')](handleError(_0x521a75,null));};exports[_0x12f3('0x52')]=function(_0x5c24c3,_0x301e35,_0x520990){_0x5c24c3[_0x12f3('0x4d')][_0x12f3('0x2c')]=_0x5c24c3[_0x12f3('0x53')][_0x12f3('0x54')];_0x5c24c3[_0x12f3('0x4d')][_0x12f3('0x55')]=_0x5c24c3[_0x12f3('0x53')]['filename'];_0x5c24c3[_0x12f3('0x4d')][_0x12f3('0x41')]=_0x5c24c3['file']['mimetype'];return db[_0x12f3('0x2f')][_0x12f3('0x52')](_0x5c24c3[_0x12f3('0x4d')])[_0x12f3('0x28')](respondWithResult(_0x301e35,0xc9))[_0x12f3('0x47')](handleError(_0x301e35,null));};exports['download']=function(_0x58ca65,_0x5ecda0,_0x261fb8){return db[_0x12f3('0x2f')][_0x12f3('0x56')]({'where':{'id':_0x58ca65[_0x12f3('0x51')]['id']},'raw':!![]})[_0x12f3('0x28')](handleEntityNotFound(_0x5ecda0,null))['then'](function(_0xf1e178){if(_0xf1e178){var _0x20f6e4=_0xf1e178[_0x12f3('0x57')]!==null;var _0x5cdf26=path[_0x12f3('0x58')](config[_0x12f3('0x59')],_0x12f3('0x5a'));if(_0x20f6e4){_0x5cdf26=path['join'](_0x5cdf26,_0x12f3('0x5b'));}var _0x192603=path[_0x12f3('0x58')](_0x5cdf26,_0xf1e178['basename']);return _0x5ecda0[_0x12f3('0x5c')](_0x192603);}})[_0x12f3('0x47')](handleError(_0x5ecda0,null));};
\ No newline at end of file