Built motion from commit e0fa946e.|2.6.5
[motion2.git] / server / api / attachment / attachment.controller.js
index 4160156..844878d 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x59ce=['type','key','model','map','keys','query','filters','intersection','fields','length','hasOwnProperty','offset','order','sort','where','filter','merge','options','includeAll','findAll','rows','catch','show','params','attributes','include','find','updatedAt','body','omit','createdAt','file','originalname','basename','filename','mimetype','download','root','server/files/attachments/','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','lodash','squel','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','limit','set','json','apply','update','then','destroy','stack','name','send','index','Attachment','rawAttributes','fieldName'];(function(_0x31b31b,_0x5f044e){var _0x2c8fc2=function(_0x5438aa){while(--_0x5438aa){_0x31b31b['push'](_0x31b31b['shift']());}};_0x2c8fc2(++_0x5f044e);}(_0x59ce,0x7a));var _0xe59c=function(_0xb138f6,_0x2caa4a){_0xb138f6=_0xb138f6-0x0;var _0x1f931b=_0x59ce[_0xb138f6];return _0x1f931b;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xe59c('0x0'));var rimraf=require(_0xe59c('0x1'));var zipdir=require(_0xe59c('0x2'));var jsonpatch=require(_0xe59c('0x3'));var rp=require(_0xe59c('0x4'));var moment=require(_0xe59c('0x5'));var BPromise=require(_0xe59c('0x6'));var Mustache=require(_0xe59c('0x7'));var util=require(_0xe59c('0x8'));var path=require(_0xe59c('0x9'));var sox=require(_0xe59c('0xa'));var csv=require('to-csv');var ejs=require(_0xe59c('0xb'));var fs=require('fs');var _=require(_0xe59c('0xc'));var squel=require(_0xe59c('0xd'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xe59c('0xe'));var querystring=require(_0xe59c('0xf'));var Papa=require(_0xe59c('0x10'));var Redis=require(_0xe59c('0x11'));var authService=require(_0xe59c('0x12'));var qs=require(_0xe59c('0x13'));var as=require(_0xe59c('0x14'));var hardwareService=require(_0xe59c('0x15'));var logger=require('../../config/logger')(_0xe59c('0x16'));var utils=require(_0xe59c('0x17'));var config=require(_0xe59c('0x18'));var licenseUtil=require(_0xe59c('0x19'));var db=require(_0xe59c('0x1a'))['db'];function respondWithStatusCode(_0x10f973,_0x4317d3){_0x4317d3=_0x4317d3||0xcc;return function(_0x447a9d){if(_0x447a9d){return _0x10f973[_0xe59c('0x1b')](_0x4317d3);}return _0x10f973[_0xe59c('0x1c')](_0x4317d3)[_0xe59c('0x1d')]();};}function respondWithResult(_0x40d075,_0x1f4dcb){_0x1f4dcb=_0x1f4dcb||0xc8;return function(_0x55a3fc){if(_0x55a3fc){return _0x40d075[_0xe59c('0x1c')](_0x1f4dcb)['json'](_0x55a3fc);}};}function respondWithFilteredResult(_0x156324,_0x12c842){return function(_0x12dd26){if(_0x12dd26){var _0x416a7e=_0x12dd26['count'],_0x2581ab=_0x12c842['offset'],_0x692bb4=_0x12c842['offset']+_0x12c842[_0xe59c('0x1e')],_0x326cd3;if(_0x692bb4>=_0x416a7e){_0x692bb4=_0x416a7e;_0x326cd3=0xc8;}else{_0x326cd3=0xce;}_0x156324[_0xe59c('0x1c')](_0x326cd3);return _0x156324[_0xe59c('0x1f')]('Content-Range',_0x2581ab+'-'+_0x692bb4+'/'+_0x416a7e)[_0xe59c('0x20')](_0x12dd26);}return null;};}function patchUpdates(_0x384336){return function(_0x5e30a8){try{jsonpatch[_0xe59c('0x21')](_0x5e30a8,_0x384336,!![]);}catch(_0x5b995c){return BPromise['reject'](_0x5b995c);}return _0x5e30a8['save']();};}function saveUpdates(_0x169b08,_0x21be1d){return function(_0x4c8b29){if(_0x4c8b29){return _0x4c8b29[_0xe59c('0x22')](_0x169b08)[_0xe59c('0x23')](function(_0x9fbcd2){return _0x9fbcd2;});}return null;};}function removeEntity(_0x384da5,_0x505b4b){return function(_0x4c4abe){if(_0x4c4abe){return _0x4c4abe[_0xe59c('0x24')]()[_0xe59c('0x23')](function(){_0x384da5['status'](0xcc)[_0xe59c('0x1d')]();});}};}function handleEntityNotFound(_0x497411,_0x167cfb){return function(_0x44900b){if(!_0x44900b){_0x497411[_0xe59c('0x1b')](0x194);}return _0x44900b;};}function handleError(_0x54170f,_0x233dc6){_0x233dc6=_0x233dc6||0x1f4;return function(_0x39ebed){logger['error'](_0x39ebed[_0xe59c('0x25')]);if(_0x39ebed[_0xe59c('0x26')]){delete _0x39ebed[_0xe59c('0x26')];}_0x54170f['status'](_0x233dc6)[_0xe59c('0x27')](_0x39ebed);};}exports[_0xe59c('0x28')]=function(_0x17e0bd,_0x3970ce){var _0x49c051={},_0xba5bc6={},_0x74657d={'count':0x0,'rows':[]};var _0x23a781=_['map'](db[_0xe59c('0x29')][_0xe59c('0x2a')],function(_0x1156ca){return{'name':_0x1156ca[_0xe59c('0x2b')],'type':_0x1156ca[_0xe59c('0x2c')][_0xe59c('0x2d')]};});_0xba5bc6[_0xe59c('0x2e')]=_[_0xe59c('0x2f')](_0x23a781,_0xe59c('0x26'));_0xba5bc6['query']=_[_0xe59c('0x30')](_0x17e0bd[_0xe59c('0x31')]);_0xba5bc6[_0xe59c('0x32')]=_[_0xe59c('0x33')](_0xba5bc6[_0xe59c('0x2e')],_0xba5bc6[_0xe59c('0x31')]);_0x49c051['attributes']=_[_0xe59c('0x33')](_0xba5bc6['model'],qs[_0xe59c('0x34')](_0x17e0bd['query'][_0xe59c('0x34')]));_0x49c051['attributes']=_0x49c051['attributes'][_0xe59c('0x35')]?_0x49c051['attributes']:_0xba5bc6[_0xe59c('0x2e')];if(!_0x17e0bd['query'][_0xe59c('0x36')]('nolimit')){_0x49c051['limit']=qs['limit'](_0x17e0bd[_0xe59c('0x31')][_0xe59c('0x1e')]);_0x49c051['offset']=qs[_0xe59c('0x37')](_0x17e0bd[_0xe59c('0x31')]['offset']);}_0x49c051[_0xe59c('0x38')]=qs[_0xe59c('0x39')](_0x17e0bd[_0xe59c('0x31')][_0xe59c('0x39')]);_0x49c051[_0xe59c('0x3a')]=qs[_0xe59c('0x32')](_['pick'](_0x17e0bd[_0xe59c('0x31')],_0xba5bc6[_0xe59c('0x32')]),_0x23a781);if(_0x17e0bd[_0xe59c('0x31')][_0xe59c('0x3b')]){_0x49c051[_0xe59c('0x3a')]=_[_0xe59c('0x3c')](_0x49c051[_0xe59c('0x3a')],{'$or':_[_0xe59c('0x2f')](_0x23a781,function(_0x1eaa3f){if(_0x1eaa3f[_0xe59c('0x2c')]!=='VIRTUAL'){var _0x204560={};_0x204560[_0x1eaa3f['name']]={'$like':'%'+_0x17e0bd[_0xe59c('0x31')][_0xe59c('0x3b')]+'%'};return _0x204560;}})});}_0x49c051=_['merge']({},_0x49c051,_0x17e0bd[_0xe59c('0x3d')]);var _0x34156f={'where':_0x49c051[_0xe59c('0x3a')]};return db[_0xe59c('0x29')]['count'](_0x34156f)[_0xe59c('0x23')](function(_0x126b15){_0x74657d['count']=_0x126b15;if(_0x17e0bd[_0xe59c('0x31')][_0xe59c('0x3e')]){_0x49c051['include']=[{'all':!![]}];}return db[_0xe59c('0x29')][_0xe59c('0x3f')](_0x49c051);})[_0xe59c('0x23')](function(_0x33dda7){_0x74657d[_0xe59c('0x40')]=_0x33dda7;return _0x74657d;})[_0xe59c('0x23')](respondWithFilteredResult(_0x3970ce,_0x49c051))[_0xe59c('0x41')](handleError(_0x3970ce,null));};exports[_0xe59c('0x42')]=function(_0x46e57c,_0x16608a){var _0x3cb494={'raw':!![],'where':{'id':_0x46e57c[_0xe59c('0x43')]['id']}},_0x5cb328={};_0x5cb328[_0xe59c('0x2e')]=_['keys'](db[_0xe59c('0x29')][_0xe59c('0x2a')]);_0x5cb328[_0xe59c('0x31')]=_[_0xe59c('0x30')](_0x46e57c[_0xe59c('0x31')]);_0x5cb328[_0xe59c('0x32')]=_[_0xe59c('0x33')](_0x5cb328['model'],_0x5cb328['query']);_0x3cb494[_0xe59c('0x44')]=_[_0xe59c('0x33')](_0x5cb328[_0xe59c('0x2e')],qs[_0xe59c('0x34')](_0x46e57c[_0xe59c('0x31')]['fields']));_0x3cb494[_0xe59c('0x44')]=_0x3cb494['attributes'][_0xe59c('0x35')]?_0x3cb494[_0xe59c('0x44')]:_0x5cb328[_0xe59c('0x2e')];if(_0x46e57c[_0xe59c('0x31')][_0xe59c('0x3e')]){_0x3cb494[_0xe59c('0x45')]=[{'all':!![]}];}_0x3cb494=_[_0xe59c('0x3c')]({},_0x3cb494,_0x46e57c[_0xe59c('0x3d')]);return db['Attachment'][_0xe59c('0x46')](_0x3cb494)[_0xe59c('0x23')](handleEntityNotFound(_0x16608a,null))[_0xe59c('0x23')](respondWithResult(_0x16608a,null))[_0xe59c('0x41')](handleError(_0x16608a,null));};exports['clone']=function(_0x108562,_0x175e57){var _0x215036={'where':{'id':_0x108562[_0xe59c('0x43')]['id']}},_0x457f03={};_0x457f03[_0xe59c('0x2e')]=_[_0xe59c('0x30')](db['Attachment'][_0xe59c('0x2a')]);_0x215036[_0xe59c('0x44')]=_['intersection'](_0x457f03[_0xe59c('0x2e')],qs[_0xe59c('0x34')](_0x108562['query'][_0xe59c('0x34')]));_0x215036['attributes']=_0x215036['attributes']['length']?_0x215036[_0xe59c('0x44')]:_0x457f03['model'];if(_0x108562[_0xe59c('0x31')][_0xe59c('0x3e')]){_0x215036['include']=[{'all':!![]}];}_0x215036=_[_0xe59c('0x3c')]({},_0x215036,_0x108562[_0xe59c('0x3d')]);return db['Attachment'][_0xe59c('0x46')](_0x215036)['then'](handleEntityNotFound(_0x175e57,null))['then'](function(_0x3289c4){if(_0x3289c4){var _0xac118a=_0x3289c4['get']({'plain':!![]});_0xac118a=qs['omit'](_0xac118a,['id','createdAt',_0xe59c('0x47')]);_0x108562[_0xe59c('0x48')]=_[_0xe59c('0x49')](_0x108562[_0xe59c('0x48')],['id',_0xe59c('0x4a'),_0xe59c('0x47')]);return db[_0xe59c('0x29')]['create'](_[_0xe59c('0x3c')](_0xac118a,_0x108562[_0xe59c('0x48')]),{'include':_0x108562[_0xe59c('0x31')][_0xe59c('0x3e')]?[{'all':!![]}]:undefined});}})[_0xe59c('0x23')](respondWithResult(_0x175e57,0xc9))[_0xe59c('0x41')](handleError(_0x175e57,null));};exports[_0xe59c('0x22')]=function(_0xa4de49,_0x3adeed){if(_0xa4de49['body']['id']){delete _0xa4de49[_0xe59c('0x48')]['id'];}return db[_0xe59c('0x29')][_0xe59c('0x46')]({'where':{'id':_0xa4de49[_0xe59c('0x43')]['id']}})['then'](handleEntityNotFound(_0x3adeed,null))['then'](saveUpdates(_0xa4de49['body'],null))[_0xe59c('0x23')](respondWithResult(_0x3adeed,null))['catch'](handleError(_0x3adeed,null));};exports['destroy']=function(_0x39f953,_0x446228){return db['Attachment'][_0xe59c('0x46')]({'where':{'id':_0x39f953['params']['id']}})[_0xe59c('0x23')](handleEntityNotFound(_0x446228,null))[_0xe59c('0x23')](removeEntity(_0x446228,null))[_0xe59c('0x41')](handleError(_0x446228,null));};exports['create']=function(_0x146aac,_0x425f8f,_0x1d0996){_0x146aac['body']['name']=_0x146aac[_0xe59c('0x4b')][_0xe59c('0x4c')];_0x146aac[_0xe59c('0x48')][_0xe59c('0x4d')]=_0x146aac[_0xe59c('0x4b')][_0xe59c('0x4e')];_0x146aac[_0xe59c('0x48')][_0xe59c('0x2c')]=_0x146aac[_0xe59c('0x4b')][_0xe59c('0x4f')];return db[_0xe59c('0x29')]['create'](_0x146aac['body'])[_0xe59c('0x23')](respondWithResult(_0x425f8f,0xc9))['catch'](handleError(_0x425f8f,null));};exports[_0xe59c('0x50')]=function(_0x26ac56,_0xf25c39,_0x516034){return db['Attachment']['findOne']({'where':{'id':_0x26ac56[_0xe59c('0x43')]['id']},'raw':!![]})[_0xe59c('0x23')](handleEntityNotFound(_0xf25c39,null))[_0xe59c('0x23')](function(_0x5a8250){if(_0x5a8250){return _0xf25c39[_0xe59c('0x50')](path['join'](config[_0xe59c('0x51')],_0xe59c('0x52'),_0x5a8250[_0xe59c('0x4d')]));}})[_0xe59c('0x41')](handleError(_0xf25c39,null));};
\ No newline at end of file
+var _0x2a02=['offset','set','Content-Range','json','reject','save','update','then','sendStatus','name','send','map','rawAttributes','fieldName','type','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','merge','where','Attachment','includeAll','include','catch','show','keys','options','find','clone','params','get','omit','createdAt','updatedAt','body','create','file','filename','mimetype','download','findOne','ChatOfflineMessageId','join','server/files/attachments/','basename','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','path','sox','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','status','end','limit','count'];(function(_0x5f3f88,_0x562baf){var _0xd08119=function(_0x42dbf7){while(--_0x42dbf7){_0x5f3f88['push'](_0x5f3f88['shift']());}};_0xd08119(++_0x562baf);}(_0x2a02,0x183));var _0x22a0=function(_0x8abd64,_0x539570){_0x8abd64=_0x8abd64-0x0;var _0xd2511e=_0x2a02[_0x8abd64];return _0xd2511e;};'use strict';var emlformat=require(_0x22a0('0x0'));var rimraf=require(_0x22a0('0x1'));var zipdir=require(_0x22a0('0x2'));var jsonpatch=require(_0x22a0('0x3'));var rp=require(_0x22a0('0x4'));var moment=require(_0x22a0('0x5'));var BPromise=require(_0x22a0('0x6'));var Mustache=require('mustache');var util=require('util');var path=require(_0x22a0('0x7'));var sox=require(_0x22a0('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x22a0('0x9'));var _=require(_0x22a0('0xa'));var squel=require(_0x22a0('0xb'));var crypto=require(_0x22a0('0xc'));var jsforce=require(_0x22a0('0xd'));var deskjs=require(_0x22a0('0xe'));var toCsv=require(_0x22a0('0xf'));var querystring=require(_0x22a0('0x10'));var Papa=require(_0x22a0('0x11'));var Redis=require(_0x22a0('0x12'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x22a0('0x13'));var logger=require(_0x22a0('0x14'))(_0x22a0('0x15'));var utils=require(_0x22a0('0x16'));var config=require(_0x22a0('0x17'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1e3eab,_0x30ed41){_0x30ed41=_0x30ed41||0xcc;return function(_0x3529cf){if(_0x3529cf){return _0x1e3eab['sendStatus'](_0x30ed41);}return _0x1e3eab[_0x22a0('0x18')](_0x30ed41)[_0x22a0('0x19')]();};}function respondWithResult(_0x38404c,_0x36647a){_0x36647a=_0x36647a||0xc8;return function(_0x22acf4){if(_0x22acf4){return _0x38404c['status'](_0x36647a)['json'](_0x22acf4);}};}function respondWithFilteredResult(_0x2148bb,_0x4181a0){return function(_0x38e638){if(_0x38e638){var _0x55663e=typeof _0x4181a0['offset']==='undefined'&&typeof _0x4181a0[_0x22a0('0x1a')]==='undefined';var _0x1b3944=_0x38e638[_0x22a0('0x1b')];var _0xaa27ca=_0x55663e?0x0:_0x4181a0[_0x22a0('0x1c')];var _0x4635ec=_0x55663e?_0x38e638[_0x22a0('0x1b')]:_0x4181a0[_0x22a0('0x1c')]+_0x4181a0[_0x22a0('0x1a')];var _0x4fb551;if(_0x4635ec>=_0x1b3944){_0x4635ec=_0x1b3944;_0x4fb551=0xc8;}else{_0x4fb551=0xce;}_0x2148bb[_0x22a0('0x18')](_0x4fb551);return _0x2148bb[_0x22a0('0x1d')](_0x22a0('0x1e'),_0xaa27ca+'-'+_0x4635ec+'/'+_0x1b3944)[_0x22a0('0x1f')](_0x38e638);}return null;};}function patchUpdates(_0x28cf37){return function(_0x59c21){try{jsonpatch['apply'](_0x59c21,_0x28cf37,!![]);}catch(_0x55c22f){return BPromise[_0x22a0('0x20')](_0x55c22f);}return _0x59c21[_0x22a0('0x21')]();};}function saveUpdates(_0x2f8be7,_0x26da5a){return function(_0xf7b242){if(_0xf7b242){return _0xf7b242[_0x22a0('0x22')](_0x2f8be7)['then'](function(_0x470f6a){return _0x470f6a;});}return null;};}function removeEntity(_0x2dbd29,_0x69258a){return function(_0x5d8c3a){if(_0x5d8c3a){return _0x5d8c3a['destroy']()[_0x22a0('0x23')](function(){_0x2dbd29[_0x22a0('0x18')](0xcc)[_0x22a0('0x19')]();});}};}function handleEntityNotFound(_0x5c788a,_0x2b7f6b){return function(_0x2b1f09){if(!_0x2b1f09){_0x5c788a[_0x22a0('0x24')](0x194);}return _0x2b1f09;};}function handleError(_0x259da5,_0x4a4fbd){_0x4a4fbd=_0x4a4fbd||0x1f4;return function(_0x32e211){logger['error'](_0x32e211['stack']);if(_0x32e211[_0x22a0('0x25')]){delete _0x32e211[_0x22a0('0x25')];}_0x259da5[_0x22a0('0x18')](_0x4a4fbd)[_0x22a0('0x26')](_0x32e211);};}exports['index']=function(_0x51c3aa,_0x2ca118){var _0x3bc95b={},_0x19767e={},_0x2ef7dc={'count':0x0,'rows':[]};var _0x11b0ee=_[_0x22a0('0x27')](db['Attachment'][_0x22a0('0x28')],function(_0x14a9e5){return{'name':_0x14a9e5[_0x22a0('0x29')],'type':_0x14a9e5[_0x22a0('0x2a')]['key']};});_0x19767e[_0x22a0('0x2b')]=_[_0x22a0('0x27')](_0x11b0ee,_0x22a0('0x25'));_0x19767e['query']=_['keys'](_0x51c3aa[_0x22a0('0x2c')]);_0x19767e[_0x22a0('0x2d')]=_[_0x22a0('0x2e')](_0x19767e['model'],_0x19767e[_0x22a0('0x2c')]);_0x3bc95b[_0x22a0('0x2f')]=_[_0x22a0('0x2e')](_0x19767e[_0x22a0('0x2b')],qs[_0x22a0('0x30')](_0x51c3aa['query'][_0x22a0('0x30')]));_0x3bc95b['attributes']=_0x3bc95b[_0x22a0('0x2f')][_0x22a0('0x31')]?_0x3bc95b[_0x22a0('0x2f')]:_0x19767e[_0x22a0('0x2b')];if(!_0x51c3aa[_0x22a0('0x2c')][_0x22a0('0x32')](_0x22a0('0x33'))){_0x3bc95b[_0x22a0('0x1a')]=qs[_0x22a0('0x1a')](_0x51c3aa['query'][_0x22a0('0x1a')]);_0x3bc95b['offset']=qs[_0x22a0('0x1c')](_0x51c3aa[_0x22a0('0x2c')][_0x22a0('0x1c')]);}_0x3bc95b[_0x22a0('0x34')]=qs[_0x22a0('0x35')](_0x51c3aa[_0x22a0('0x2c')][_0x22a0('0x35')]);_0x3bc95b['where']=qs[_0x22a0('0x2d')](_[_0x22a0('0x36')](_0x51c3aa[_0x22a0('0x2c')],_0x19767e[_0x22a0('0x2d')]),_0x11b0ee);if(_0x51c3aa['query'][_0x22a0('0x37')]){_0x3bc95b['where']=_[_0x22a0('0x38')](_0x3bc95b[_0x22a0('0x39')],{'$or':_[_0x22a0('0x27')](_0x11b0ee,function(_0x3ab84e){if(_0x3ab84e[_0x22a0('0x2a')]!=='VIRTUAL'){var _0x458b38={};_0x458b38[_0x3ab84e[_0x22a0('0x25')]]={'$like':'%'+_0x51c3aa['query']['filter']+'%'};return _0x458b38;}})});}_0x3bc95b=_[_0x22a0('0x38')]({},_0x3bc95b,_0x51c3aa['options']);var _0x5990df={'where':_0x3bc95b[_0x22a0('0x39')]};return db[_0x22a0('0x3a')][_0x22a0('0x1b')](_0x5990df)[_0x22a0('0x23')](function(_0x4389ed){_0x2ef7dc['count']=_0x4389ed;if(_0x51c3aa['query'][_0x22a0('0x3b')]){_0x3bc95b[_0x22a0('0x3c')]=[{'all':!![]}];}return db['Attachment']['findAll'](_0x3bc95b);})[_0x22a0('0x23')](function(_0x427a0c){_0x2ef7dc['rows']=_0x427a0c;return _0x2ef7dc;})[_0x22a0('0x23')](respondWithFilteredResult(_0x2ca118,_0x3bc95b))[_0x22a0('0x3d')](handleError(_0x2ca118,null));};exports[_0x22a0('0x3e')]=function(_0x1ed7d4,_0x5590da){var _0x3a0fb0={'raw':!![],'where':{'id':_0x1ed7d4['params']['id']}},_0x30e7eb={};_0x30e7eb[_0x22a0('0x2b')]=_[_0x22a0('0x3f')](db[_0x22a0('0x3a')][_0x22a0('0x28')]);_0x30e7eb[_0x22a0('0x2c')]=_['keys'](_0x1ed7d4['query']);_0x30e7eb[_0x22a0('0x2d')]=_[_0x22a0('0x2e')](_0x30e7eb[_0x22a0('0x2b')],_0x30e7eb[_0x22a0('0x2c')]);_0x3a0fb0['attributes']=_[_0x22a0('0x2e')](_0x30e7eb[_0x22a0('0x2b')],qs['fields'](_0x1ed7d4['query'][_0x22a0('0x30')]));_0x3a0fb0['attributes']=_0x3a0fb0['attributes'][_0x22a0('0x31')]?_0x3a0fb0[_0x22a0('0x2f')]:_0x30e7eb[_0x22a0('0x2b')];if(_0x1ed7d4['query'][_0x22a0('0x3b')]){_0x3a0fb0[_0x22a0('0x3c')]=[{'all':!![]}];}_0x3a0fb0=_[_0x22a0('0x38')]({},_0x3a0fb0,_0x1ed7d4[_0x22a0('0x40')]);return db[_0x22a0('0x3a')][_0x22a0('0x41')](_0x3a0fb0)[_0x22a0('0x23')](handleEntityNotFound(_0x5590da,null))[_0x22a0('0x23')](respondWithResult(_0x5590da,null))[_0x22a0('0x3d')](handleError(_0x5590da,null));};exports[_0x22a0('0x42')]=function(_0x309e26,_0x29b4ec){var _0x565e7f={'where':{'id':_0x309e26[_0x22a0('0x43')]['id']}},_0x5b72d8={};_0x5b72d8[_0x22a0('0x2b')]=_['keys'](db[_0x22a0('0x3a')]['rawAttributes']);_0x565e7f[_0x22a0('0x2f')]=_['intersection'](_0x5b72d8[_0x22a0('0x2b')],qs[_0x22a0('0x30')](_0x309e26[_0x22a0('0x2c')][_0x22a0('0x30')]));_0x565e7f[_0x22a0('0x2f')]=_0x565e7f['attributes'][_0x22a0('0x31')]?_0x565e7f['attributes']:_0x5b72d8['model'];if(_0x309e26[_0x22a0('0x2c')][_0x22a0('0x3b')]){_0x565e7f['include']=[{'all':!![]}];}_0x565e7f=_[_0x22a0('0x38')]({},_0x565e7f,_0x309e26[_0x22a0('0x40')]);return db[_0x22a0('0x3a')][_0x22a0('0x41')](_0x565e7f)[_0x22a0('0x23')](handleEntityNotFound(_0x29b4ec,null))[_0x22a0('0x23')](function(_0x226d16){if(_0x226d16){var _0x1466c5=_0x226d16[_0x22a0('0x44')]({'plain':!![]});_0x1466c5=qs[_0x22a0('0x45')](_0x1466c5,['id',_0x22a0('0x46'),_0x22a0('0x47')]);_0x309e26['body']=_['omit'](_0x309e26[_0x22a0('0x48')],['id',_0x22a0('0x46'),_0x22a0('0x47')]);return db[_0x22a0('0x3a')][_0x22a0('0x49')](_['merge'](_0x1466c5,_0x309e26['body']),{'include':_0x309e26[_0x22a0('0x2c')][_0x22a0('0x3b')]?[{'all':!![]}]:undefined});}})[_0x22a0('0x23')](respondWithResult(_0x29b4ec,0xc9))[_0x22a0('0x3d')](handleError(_0x29b4ec,null));};exports[_0x22a0('0x22')]=function(_0x3e10aa,_0x30fee1){if(_0x3e10aa[_0x22a0('0x48')]['id']){delete _0x3e10aa['body']['id'];}return db['Attachment'][_0x22a0('0x41')]({'where':{'id':_0x3e10aa['params']['id']}})['then'](handleEntityNotFound(_0x30fee1,null))[_0x22a0('0x23')](saveUpdates(_0x3e10aa['body'],null))[_0x22a0('0x23')](respondWithResult(_0x30fee1,null))['catch'](handleError(_0x30fee1,null));};exports['destroy']=function(_0x5a0453,_0x26cce4){return db[_0x22a0('0x3a')][_0x22a0('0x41')]({'where':{'id':_0x5a0453[_0x22a0('0x43')]['id']}})[_0x22a0('0x23')](handleEntityNotFound(_0x26cce4,null))[_0x22a0('0x23')](removeEntity(_0x26cce4,null))[_0x22a0('0x3d')](handleError(_0x26cce4,null));};exports[_0x22a0('0x49')]=function(_0x22c82b,_0x4fd8e9,_0x1af0b5){_0x22c82b[_0x22a0('0x48')][_0x22a0('0x25')]=_0x22c82b[_0x22a0('0x4a')]['originalname'];_0x22c82b[_0x22a0('0x48')]['basename']=_0x22c82b['file'][_0x22a0('0x4b')];_0x22c82b[_0x22a0('0x48')][_0x22a0('0x2a')]=_0x22c82b[_0x22a0('0x4a')][_0x22a0('0x4c')];return db[_0x22a0('0x3a')][_0x22a0('0x49')](_0x22c82b['body'])[_0x22a0('0x23')](respondWithResult(_0x4fd8e9,0xc9))[_0x22a0('0x3d')](handleError(_0x4fd8e9,null));};exports[_0x22a0('0x4d')]=function(_0x1088d4,_0x4681ca,_0x2d08f7){return db['Attachment'][_0x22a0('0x4e')]({'where':{'id':_0x1088d4[_0x22a0('0x43')]['id']},'raw':!![]})[_0x22a0('0x23')](handleEntityNotFound(_0x4681ca,null))[_0x22a0('0x23')](function(_0x11607a){if(_0x11607a){var _0x50d144=_0x11607a[_0x22a0('0x4f')]!==null;var _0x8e78e7=path[_0x22a0('0x50')](config['root'],_0x22a0('0x51'));if(_0x50d144){_0x8e78e7=path[_0x22a0('0x50')](_0x8e78e7,'offline-chat/');}var _0x3fb4ab=path[_0x22a0('0x50')](_0x8e78e7,_0x11607a[_0x22a0('0x52')]);return _0x4681ca[_0x22a0('0x4d')](_0x3fb4ab);}})['catch'](handleError(_0x4681ca,null));};
\ No newline at end of file