Built motion from commit 497d3d92.|2.5.43
[motion2.git] / server / api / attachment / attachment.controller.js
index 9c47df6..ef7f1e0 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x0695=['include','rows','show','params','length','find','catch','clone','omit','createdAt','updatedAt','body','create','file','originalname','basename','filename','mimetype','download','findOne','join','root','eml-format','rimraf','moment','bluebird','util','to-csv','ejs','fs-extra','lodash','jsforce','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','status','end','json','undefined','limit','count','offset','set','Content-Range','apply','reject','update','then','destroy','sendStatus','stack','send','index','Attachment','rawAttributes','fieldName','type','key','model','map','name','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','pick','where','merge','VIRTUAL','filter','options','includeAll'];(function(_0x547456,_0x1de17e){var _0xc1fd7b=function(_0x12be35){while(--_0x12be35){_0x547456['push'](_0x547456['shift']());}};_0xc1fd7b(++_0x1de17e);}(_0x0695,0x16e));var _0x5069=function(_0x270a1f,_0x532619){_0x270a1f=_0x270a1f-0x0;var _0x3baab9=_0x0695[_0x270a1f];return _0x3baab9;};'use strict';var emlformat=require(_0x5069('0x0'));var rimraf=require(_0x5069('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x5069('0x2'));var BPromise=require(_0x5069('0x3'));var Mustache=require('mustache');var util=require(_0x5069('0x4'));var path=require('path');var sox=require('sox');var csv=require(_0x5069('0x5'));var ejs=require(_0x5069('0x6'));var fs=require('fs');var fs_extra=require(_0x5069('0x7'));var _=require(_0x5069('0x8'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x5069('0x9'));var deskjs=require('desk.js');var toCsv=require(_0x5069('0x5'));var querystring=require(_0x5069('0xa'));var Papa=require(_0x5069('0xb'));var Redis=require(_0x5069('0xc'));var authService=require('../../components/auth/service');var qs=require(_0x5069('0xd'));var as=require(_0x5069('0xe'));var hardwareService=require(_0x5069('0xf'));var logger=require(_0x5069('0x10'))(_0x5069('0x11'));var utils=require(_0x5069('0x12'));var config=require(_0x5069('0x13'));var licenseUtil=require(_0x5069('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x37bf8a,_0x149896){_0x149896=_0x149896||0xcc;return function(_0xf2ae6d){if(_0xf2ae6d){return _0x37bf8a['sendStatus'](_0x149896);}return _0x37bf8a[_0x5069('0x15')](_0x149896)[_0x5069('0x16')]();};}function respondWithResult(_0x36ebd3,_0x84b2a4){_0x84b2a4=_0x84b2a4||0xc8;return function(_0x1b2f81){if(_0x1b2f81){return _0x36ebd3[_0x5069('0x15')](_0x84b2a4)[_0x5069('0x17')](_0x1b2f81);}};}function respondWithFilteredResult(_0x48ed6c,_0xf1df1b){return function(_0x4ce69d){if(_0x4ce69d){var _0x39e2cb=typeof _0xf1df1b['offset']===_0x5069('0x18')&&typeof _0xf1df1b[_0x5069('0x19')]===_0x5069('0x18');var _0xa50009=_0x4ce69d[_0x5069('0x1a')];var _0x559291=_0x39e2cb?0x0:_0xf1df1b['offset'];var _0x43b46a=_0x39e2cb?_0x4ce69d[_0x5069('0x1a')]:_0xf1df1b[_0x5069('0x1b')]+_0xf1df1b[_0x5069('0x19')];var _0x403009;if(_0x43b46a>=_0xa50009){_0x43b46a=_0xa50009;_0x403009=0xc8;}else{_0x403009=0xce;}_0x48ed6c[_0x5069('0x15')](_0x403009);return _0x48ed6c[_0x5069('0x1c')](_0x5069('0x1d'),_0x559291+'-'+_0x43b46a+'/'+_0xa50009)[_0x5069('0x17')](_0x4ce69d);}return null;};}function patchUpdates(_0x7dd897){return function(_0x1343d6){try{jsonpatch[_0x5069('0x1e')](_0x1343d6,_0x7dd897,!![]);}catch(_0x55eebd){return BPromise[_0x5069('0x1f')](_0x55eebd);}return _0x1343d6['save']();};}function saveUpdates(_0x4723c3,_0x62d5f2){return function(_0x2957ec){if(_0x2957ec){return _0x2957ec[_0x5069('0x20')](_0x4723c3)[_0x5069('0x21')](function(_0x16f976){return _0x16f976;});}return null;};}function removeEntity(_0x25a172,_0x25b9da){return function(_0x570a2a){if(_0x570a2a){return _0x570a2a[_0x5069('0x22')]()[_0x5069('0x21')](function(){_0x25a172[_0x5069('0x15')](0xcc)[_0x5069('0x16')]();});}};}function handleEntityNotFound(_0x4498ec,_0xbf3568){return function(_0x2717dc){if(!_0x2717dc){_0x4498ec[_0x5069('0x23')](0x194);}return _0x2717dc;};}function handleError(_0x3caf56,_0x38a591){_0x38a591=_0x38a591||0x1f4;return function(_0x28a1df){logger['error'](_0x28a1df[_0x5069('0x24')]);if(_0x28a1df['name']){delete _0x28a1df['name'];}_0x3caf56[_0x5069('0x15')](_0x38a591)[_0x5069('0x25')](_0x28a1df);};}exports[_0x5069('0x26')]=function(_0x3df89,_0x237ac4){var _0x13e182={},_0x4fe792={},_0x4ada47={'count':0x0,'rows':[]};var _0x5be8ad=_['map'](db[_0x5069('0x27')][_0x5069('0x28')],function(_0x101e92){return{'name':_0x101e92[_0x5069('0x29')],'type':_0x101e92[_0x5069('0x2a')][_0x5069('0x2b')]};});_0x4fe792[_0x5069('0x2c')]=_[_0x5069('0x2d')](_0x5be8ad,_0x5069('0x2e'));_0x4fe792[_0x5069('0x2f')]=_[_0x5069('0x30')](_0x3df89[_0x5069('0x2f')]);_0x4fe792[_0x5069('0x31')]=_[_0x5069('0x32')](_0x4fe792[_0x5069('0x2c')],_0x4fe792[_0x5069('0x2f')]);_0x13e182[_0x5069('0x33')]=_['intersection'](_0x4fe792[_0x5069('0x2c')],qs[_0x5069('0x34')](_0x3df89['query'][_0x5069('0x34')]));_0x13e182['attributes']=_0x13e182[_0x5069('0x33')]['length']?_0x13e182[_0x5069('0x33')]:_0x4fe792[_0x5069('0x2c')];if(!_0x3df89[_0x5069('0x2f')][_0x5069('0x35')](_0x5069('0x36'))){_0x13e182[_0x5069('0x19')]=qs[_0x5069('0x19')](_0x3df89[_0x5069('0x2f')]['limit']);_0x13e182[_0x5069('0x1b')]=qs[_0x5069('0x1b')](_0x3df89[_0x5069('0x2f')][_0x5069('0x1b')]);}_0x13e182[_0x5069('0x37')]=qs[_0x5069('0x38')](_0x3df89['query'][_0x5069('0x38')]);_0x13e182['where']=qs['filters'](_[_0x5069('0x39')](_0x3df89[_0x5069('0x2f')],_0x4fe792[_0x5069('0x31')]),_0x5be8ad);if(_0x3df89[_0x5069('0x2f')]['filter']){_0x13e182[_0x5069('0x3a')]=_[_0x5069('0x3b')](_0x13e182[_0x5069('0x3a')],{'$or':_[_0x5069('0x2d')](_0x5be8ad,function(_0x29c4a5){if(_0x29c4a5[_0x5069('0x2a')]!==_0x5069('0x3c')){var _0x20579f={};_0x20579f[_0x29c4a5[_0x5069('0x2e')]]={'$like':'%'+_0x3df89[_0x5069('0x2f')][_0x5069('0x3d')]+'%'};return _0x20579f;}})});}_0x13e182=_[_0x5069('0x3b')]({},_0x13e182,_0x3df89[_0x5069('0x3e')]);var _0x318dba={'where':_0x13e182[_0x5069('0x3a')]};return db['Attachment'][_0x5069('0x1a')](_0x318dba)[_0x5069('0x21')](function(_0x4047d4){_0x4ada47[_0x5069('0x1a')]=_0x4047d4;if(_0x3df89[_0x5069('0x2f')][_0x5069('0x3f')]){_0x13e182[_0x5069('0x40')]=[{'all':!![]}];}return db[_0x5069('0x27')]['findAll'](_0x13e182);})[_0x5069('0x21')](function(_0x341822){_0x4ada47[_0x5069('0x41')]=_0x341822;return _0x4ada47;})['then'](respondWithFilteredResult(_0x237ac4,_0x13e182))['catch'](handleError(_0x237ac4,null));};exports[_0x5069('0x42')]=function(_0x2b4caa,_0x389b5b){var _0x11683d={'raw':!![],'where':{'id':_0x2b4caa[_0x5069('0x43')]['id']}},_0x46b08a={};_0x46b08a[_0x5069('0x2c')]=_[_0x5069('0x30')](db[_0x5069('0x27')][_0x5069('0x28')]);_0x46b08a[_0x5069('0x2f')]=_[_0x5069('0x30')](_0x2b4caa[_0x5069('0x2f')]);_0x46b08a[_0x5069('0x31')]=_[_0x5069('0x32')](_0x46b08a[_0x5069('0x2c')],_0x46b08a[_0x5069('0x2f')]);_0x11683d[_0x5069('0x33')]=_[_0x5069('0x32')](_0x46b08a[_0x5069('0x2c')],qs[_0x5069('0x34')](_0x2b4caa[_0x5069('0x2f')][_0x5069('0x34')]));_0x11683d['attributes']=_0x11683d[_0x5069('0x33')][_0x5069('0x44')]?_0x11683d[_0x5069('0x33')]:_0x46b08a[_0x5069('0x2c')];if(_0x2b4caa['query']['includeAll']){_0x11683d['include']=[{'all':!![]}];}_0x11683d=_[_0x5069('0x3b')]({},_0x11683d,_0x2b4caa[_0x5069('0x3e')]);return db['Attachment'][_0x5069('0x45')](_0x11683d)['then'](handleEntityNotFound(_0x389b5b,null))[_0x5069('0x21')](respondWithResult(_0x389b5b,null))[_0x5069('0x46')](handleError(_0x389b5b,null));};exports[_0x5069('0x47')]=function(_0x49c18f,_0x10154f){var _0x384c5f={'where':{'id':_0x49c18f[_0x5069('0x43')]['id']}},_0x32bbe1={};_0x32bbe1[_0x5069('0x2c')]=_[_0x5069('0x30')](db[_0x5069('0x27')][_0x5069('0x28')]);_0x384c5f[_0x5069('0x33')]=_[_0x5069('0x32')](_0x32bbe1[_0x5069('0x2c')],qs[_0x5069('0x34')](_0x49c18f['query']['fields']));_0x384c5f[_0x5069('0x33')]=_0x384c5f[_0x5069('0x33')][_0x5069('0x44')]?_0x384c5f[_0x5069('0x33')]:_0x32bbe1[_0x5069('0x2c')];if(_0x49c18f[_0x5069('0x2f')]['includeAll']){_0x384c5f[_0x5069('0x40')]=[{'all':!![]}];}_0x384c5f=_[_0x5069('0x3b')]({},_0x384c5f,_0x49c18f[_0x5069('0x3e')]);return db['Attachment'][_0x5069('0x45')](_0x384c5f)[_0x5069('0x21')](handleEntityNotFound(_0x10154f,null))['then'](function(_0x55417a){if(_0x55417a){var _0x2fad22=_0x55417a['get']({'plain':!![]});_0x2fad22=qs[_0x5069('0x48')](_0x2fad22,['id',_0x5069('0x49'),_0x5069('0x4a')]);_0x49c18f[_0x5069('0x4b')]=_['omit'](_0x49c18f[_0x5069('0x4b')],['id',_0x5069('0x49'),_0x5069('0x4a')]);return db['Attachment'][_0x5069('0x4c')](_[_0x5069('0x3b')](_0x2fad22,_0x49c18f['body']),{'include':_0x49c18f[_0x5069('0x2f')]['includeAll']?[{'all':!![]}]:undefined});}})[_0x5069('0x21')](respondWithResult(_0x10154f,0xc9))['catch'](handleError(_0x10154f,null));};exports[_0x5069('0x20')]=function(_0x1edee7,_0xefc90a){if(_0x1edee7[_0x5069('0x4b')]['id']){delete _0x1edee7[_0x5069('0x4b')]['id'];}return db[_0x5069('0x27')][_0x5069('0x45')]({'where':{'id':_0x1edee7[_0x5069('0x43')]['id']}})[_0x5069('0x21')](handleEntityNotFound(_0xefc90a,null))[_0x5069('0x21')](saveUpdates(_0x1edee7[_0x5069('0x4b')],null))[_0x5069('0x21')](respondWithResult(_0xefc90a,null))['catch'](handleError(_0xefc90a,null));};exports['destroy']=function(_0x50030f,_0x1cc13e){return db['Attachment'][_0x5069('0x45')]({'where':{'id':_0x50030f[_0x5069('0x43')]['id']}})[_0x5069('0x21')](handleEntityNotFound(_0x1cc13e,null))[_0x5069('0x21')](removeEntity(_0x1cc13e,null))[_0x5069('0x46')](handleError(_0x1cc13e,null));};exports[_0x5069('0x4c')]=function(_0x41b0d6,_0x32315a,_0x1a9343){_0x41b0d6[_0x5069('0x4b')]['name']=_0x41b0d6[_0x5069('0x4d')][_0x5069('0x4e')];_0x41b0d6[_0x5069('0x4b')][_0x5069('0x4f')]=_0x41b0d6[_0x5069('0x4d')][_0x5069('0x50')];_0x41b0d6[_0x5069('0x4b')][_0x5069('0x2a')]=_0x41b0d6['file'][_0x5069('0x51')];return db[_0x5069('0x27')][_0x5069('0x4c')](_0x41b0d6[_0x5069('0x4b')])[_0x5069('0x21')](respondWithResult(_0x32315a,0xc9))[_0x5069('0x46')](handleError(_0x32315a,null));};exports[_0x5069('0x52')]=function(_0x2fb4e3,_0x1475cc,_0x125e1d){return db[_0x5069('0x27')][_0x5069('0x53')]({'where':{'id':_0x2fb4e3[_0x5069('0x43')]['id']},'raw':!![]})[_0x5069('0x21')](handleEntityNotFound(_0x1475cc,null))['then'](function(_0xf41968){if(_0xf41968){var _0x110c90=_0xf41968['ChatOfflineMessageId']!==null;var _0x3e1235=path[_0x5069('0x54')](config[_0x5069('0x55')],'server/files/attachments/');if(_0x110c90){_0x3e1235=path[_0x5069('0x54')](_0x3e1235,'offline-chat/');}var _0x5997d5=path[_0x5069('0x54')](_0x3e1235,_0xf41968[_0x5069('0x4f')]);return _0x1475cc['download'](_0x5997d5);}})['catch'](handleError(_0x1475cc,null));};
\ No newline at end of file
+var _0x31f0=['query','keys','filters','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','merge','filter','includeAll','include','findAll','rows','catch','params','intersection','options','find','get','omit','createdAt','updatedAt','body','create','basename','file','filename','download','ChatOfflineMessageId','join','server/files/attachments/','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','status','end','json','offset','limit','undefined','count','Content-Range','apply','reject','save','update','then','destroy','sendStatus','error','stack','name','send','index','map','Attachment','rawAttributes','fieldName','type','key','model'];(function(_0x1467cf,_0x392f28){var _0x125957=function(_0x1a00b2){while(--_0x1a00b2){_0x1467cf['push'](_0x1467cf['shift']());}};_0x125957(++_0x392f28);}(_0x31f0,0x17f));var _0x031f=function(_0x661ac0,_0x887a86){_0x661ac0=_0x661ac0-0x0;var _0x5a374f=_0x31f0[_0x661ac0];return _0x5a374f;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x031f('0x0'));var zipdir=require(_0x031f('0x1'));var jsonpatch=require(_0x031f('0x2'));var rp=require(_0x031f('0x3'));var moment=require(_0x031f('0x4'));var BPromise=require(_0x031f('0x5'));var Mustache=require(_0x031f('0x6'));var util=require(_0x031f('0x7'));var path=require('path');var sox=require(_0x031f('0x8'));var csv=require(_0x031f('0x9'));var ejs=require(_0x031f('0xa'));var fs=require('fs');var fs_extra=require(_0x031f('0xb'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x031f('0xc'));var jsforce=require(_0x031f('0xd'));var deskjs=require(_0x031f('0xe'));var toCsv=require(_0x031f('0x9'));var querystring=require(_0x031f('0xf'));var Papa=require('papaparse');var Redis=require(_0x031f('0x10'));var authService=require(_0x031f('0x11'));var qs=require(_0x031f('0x12'));var as=require(_0x031f('0x13'));var hardwareService=require(_0x031f('0x14'));var logger=require(_0x031f('0x15'))(_0x031f('0x16'));var utils=require('../../config/utils');var config=require(_0x031f('0x17'));var licenseUtil=require(_0x031f('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2c4004,_0x43587a){_0x43587a=_0x43587a||0xcc;return function(_0x199209){if(_0x199209){return _0x2c4004['sendStatus'](_0x43587a);}return _0x2c4004[_0x031f('0x19')](_0x43587a)[_0x031f('0x1a')]();};}function respondWithResult(_0x58f66b,_0x535d57){_0x535d57=_0x535d57||0xc8;return function(_0x411616){if(_0x411616){return _0x58f66b[_0x031f('0x19')](_0x535d57)[_0x031f('0x1b')](_0x411616);}};}function respondWithFilteredResult(_0x27e1a0,_0x2e6772){return function(_0xe47818){if(_0xe47818){var _0x40cdf7=typeof _0x2e6772[_0x031f('0x1c')]==='undefined'&&typeof _0x2e6772[_0x031f('0x1d')]===_0x031f('0x1e');var _0x21c787=_0xe47818['count'];var _0x17e239=_0x40cdf7?0x0:_0x2e6772[_0x031f('0x1c')];var _0x119c5f=_0x40cdf7?_0xe47818[_0x031f('0x1f')]:_0x2e6772['offset']+_0x2e6772[_0x031f('0x1d')];var _0x26e78f;if(_0x119c5f>=_0x21c787){_0x119c5f=_0x21c787;_0x26e78f=0xc8;}else{_0x26e78f=0xce;}_0x27e1a0[_0x031f('0x19')](_0x26e78f);return _0x27e1a0['set'](_0x031f('0x20'),_0x17e239+'-'+_0x119c5f+'/'+_0x21c787)['json'](_0xe47818);}return null;};}function patchUpdates(_0x2447ec){return function(_0x1f2a84){try{jsonpatch[_0x031f('0x21')](_0x1f2a84,_0x2447ec,!![]);}catch(_0x1cb744){return BPromise[_0x031f('0x22')](_0x1cb744);}return _0x1f2a84[_0x031f('0x23')]();};}function saveUpdates(_0x53a136,_0x529a83){return function(_0x29669c){if(_0x29669c){return _0x29669c[_0x031f('0x24')](_0x53a136)[_0x031f('0x25')](function(_0xd461a0){return _0xd461a0;});}return null;};}function removeEntity(_0x1e9f0b,_0x2b68bf){return function(_0x3adef2){if(_0x3adef2){return _0x3adef2[_0x031f('0x26')]()[_0x031f('0x25')](function(){_0x1e9f0b[_0x031f('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x54986b,_0x2319d8){return function(_0xebd344){if(!_0xebd344){_0x54986b[_0x031f('0x27')](0x194);}return _0xebd344;};}function handleError(_0x2ab27e,_0x362754){_0x362754=_0x362754||0x1f4;return function(_0x291b71){logger[_0x031f('0x28')](_0x291b71[_0x031f('0x29')]);if(_0x291b71[_0x031f('0x2a')]){delete _0x291b71[_0x031f('0x2a')];}_0x2ab27e['status'](_0x362754)[_0x031f('0x2b')](_0x291b71);};}exports[_0x031f('0x2c')]=function(_0x3cc835,_0x296819){var _0x412c29={},_0x283516={},_0x31880b={'count':0x0,'rows':[]};var _0x49c083=_[_0x031f('0x2d')](db[_0x031f('0x2e')][_0x031f('0x2f')],function(_0x46aebe){return{'name':_0x46aebe[_0x031f('0x30')],'type':_0x46aebe[_0x031f('0x31')][_0x031f('0x32')]};});_0x283516[_0x031f('0x33')]=_[_0x031f('0x2d')](_0x49c083,'name');_0x283516[_0x031f('0x34')]=_[_0x031f('0x35')](_0x3cc835[_0x031f('0x34')]);_0x283516[_0x031f('0x36')]=_['intersection'](_0x283516[_0x031f('0x33')],_0x283516[_0x031f('0x34')]);_0x412c29['attributes']=_['intersection'](_0x283516[_0x031f('0x33')],qs[_0x031f('0x37')](_0x3cc835[_0x031f('0x34')][_0x031f('0x37')]));_0x412c29[_0x031f('0x38')]=_0x412c29[_0x031f('0x38')][_0x031f('0x39')]?_0x412c29[_0x031f('0x38')]:_0x283516['model'];if(!_0x3cc835[_0x031f('0x34')][_0x031f('0x3a')](_0x031f('0x3b'))){_0x412c29[_0x031f('0x1d')]=qs['limit'](_0x3cc835['query'][_0x031f('0x1d')]);_0x412c29[_0x031f('0x1c')]=qs[_0x031f('0x1c')](_0x3cc835[_0x031f('0x34')][_0x031f('0x1c')]);}_0x412c29[_0x031f('0x3c')]=qs['sort'](_0x3cc835[_0x031f('0x34')][_0x031f('0x3d')]);_0x412c29[_0x031f('0x3e')]=qs[_0x031f('0x36')](_['pick'](_0x3cc835[_0x031f('0x34')],_0x283516['filters']),_0x49c083);if(_0x3cc835[_0x031f('0x34')]['filter']){_0x412c29[_0x031f('0x3e')]=_[_0x031f('0x3f')](_0x412c29[_0x031f('0x3e')],{'$or':_[_0x031f('0x2d')](_0x49c083,function(_0x5a603e){if(_0x5a603e['type']!=='VIRTUAL'){var _0x226172={};_0x226172[_0x5a603e[_0x031f('0x2a')]]={'$like':'%'+_0x3cc835[_0x031f('0x34')][_0x031f('0x40')]+'%'};return _0x226172;}})});}_0x412c29=_[_0x031f('0x3f')]({},_0x412c29,_0x3cc835['options']);var _0x5e8c0d={'where':_0x412c29[_0x031f('0x3e')]};return db['Attachment'][_0x031f('0x1f')](_0x5e8c0d)[_0x031f('0x25')](function(_0x5c80d9){_0x31880b['count']=_0x5c80d9;if(_0x3cc835[_0x031f('0x34')][_0x031f('0x41')]){_0x412c29[_0x031f('0x42')]=[{'all':!![]}];}return db['Attachment'][_0x031f('0x43')](_0x412c29);})[_0x031f('0x25')](function(_0x4f0a24){_0x31880b[_0x031f('0x44')]=_0x4f0a24;return _0x31880b;})['then'](respondWithFilteredResult(_0x296819,_0x412c29))[_0x031f('0x45')](handleError(_0x296819,null));};exports['show']=function(_0x244b3f,_0x36a228){var _0x227c4e={'raw':!![],'where':{'id':_0x244b3f[_0x031f('0x46')]['id']}},_0x30a990={};_0x30a990[_0x031f('0x33')]=_[_0x031f('0x35')](db[_0x031f('0x2e')]['rawAttributes']);_0x30a990[_0x031f('0x34')]=_[_0x031f('0x35')](_0x244b3f[_0x031f('0x34')]);_0x30a990['filters']=_['intersection'](_0x30a990[_0x031f('0x33')],_0x30a990[_0x031f('0x34')]);_0x227c4e[_0x031f('0x38')]=_[_0x031f('0x47')](_0x30a990[_0x031f('0x33')],qs[_0x031f('0x37')](_0x244b3f['query'][_0x031f('0x37')]));_0x227c4e[_0x031f('0x38')]=_0x227c4e[_0x031f('0x38')][_0x031f('0x39')]?_0x227c4e[_0x031f('0x38')]:_0x30a990[_0x031f('0x33')];if(_0x244b3f[_0x031f('0x34')][_0x031f('0x41')]){_0x227c4e[_0x031f('0x42')]=[{'all':!![]}];}_0x227c4e=_['merge']({},_0x227c4e,_0x244b3f[_0x031f('0x48')]);return db[_0x031f('0x2e')][_0x031f('0x49')](_0x227c4e)[_0x031f('0x25')](handleEntityNotFound(_0x36a228,null))[_0x031f('0x25')](respondWithResult(_0x36a228,null))[_0x031f('0x45')](handleError(_0x36a228,null));};exports['clone']=function(_0xaa1972,_0x12b37a){var _0xbde995={'where':{'id':_0xaa1972[_0x031f('0x46')]['id']}},_0x1dd43a={};_0x1dd43a['model']=_[_0x031f('0x35')](db['Attachment']['rawAttributes']);_0xbde995[_0x031f('0x38')]=_[_0x031f('0x47')](_0x1dd43a['model'],qs[_0x031f('0x37')](_0xaa1972[_0x031f('0x34')][_0x031f('0x37')]));_0xbde995['attributes']=_0xbde995[_0x031f('0x38')]['length']?_0xbde995[_0x031f('0x38')]:_0x1dd43a[_0x031f('0x33')];if(_0xaa1972[_0x031f('0x34')][_0x031f('0x41')]){_0xbde995['include']=[{'all':!![]}];}_0xbde995=_[_0x031f('0x3f')]({},_0xbde995,_0xaa1972[_0x031f('0x48')]);return db[_0x031f('0x2e')][_0x031f('0x49')](_0xbde995)['then'](handleEntityNotFound(_0x12b37a,null))[_0x031f('0x25')](function(_0x3c7e74){if(_0x3c7e74){var _0x549d6e=_0x3c7e74[_0x031f('0x4a')]({'plain':!![]});_0x549d6e=qs[_0x031f('0x4b')](_0x549d6e,['id',_0x031f('0x4c'),_0x031f('0x4d')]);_0xaa1972[_0x031f('0x4e')]=_['omit'](_0xaa1972[_0x031f('0x4e')],['id',_0x031f('0x4c'),_0x031f('0x4d')]);return db[_0x031f('0x2e')][_0x031f('0x4f')](_['merge'](_0x549d6e,_0xaa1972['body']),{'include':_0xaa1972['query'][_0x031f('0x41')]?[{'all':!![]}]:undefined});}})[_0x031f('0x25')](respondWithResult(_0x12b37a,0xc9))[_0x031f('0x45')](handleError(_0x12b37a,null));};exports[_0x031f('0x24')]=function(_0xf85daa,_0x7d5f89){if(_0xf85daa[_0x031f('0x4e')]['id']){delete _0xf85daa['body']['id'];}return db[_0x031f('0x2e')][_0x031f('0x49')]({'where':{'id':_0xf85daa['params']['id']}})['then'](handleEntityNotFound(_0x7d5f89,null))['then'](saveUpdates(_0xf85daa[_0x031f('0x4e')],null))[_0x031f('0x25')](respondWithResult(_0x7d5f89,null))[_0x031f('0x45')](handleError(_0x7d5f89,null));};exports[_0x031f('0x26')]=function(_0x5d76e3,_0x2fec5e){return db[_0x031f('0x2e')][_0x031f('0x49')]({'where':{'id':_0x5d76e3[_0x031f('0x46')]['id']}})[_0x031f('0x25')](handleEntityNotFound(_0x2fec5e,null))['then'](removeEntity(_0x2fec5e,null))[_0x031f('0x45')](handleError(_0x2fec5e,null));};exports['create']=function(_0x57bad5,_0x68fa,_0x34e956){_0x57bad5['body'][_0x031f('0x2a')]=_0x57bad5['file']['originalname'];_0x57bad5[_0x031f('0x4e')][_0x031f('0x50')]=_0x57bad5[_0x031f('0x51')][_0x031f('0x52')];_0x57bad5['body'][_0x031f('0x31')]=_0x57bad5[_0x031f('0x51')]['mimetype'];return db[_0x031f('0x2e')][_0x031f('0x4f')](_0x57bad5[_0x031f('0x4e')])['then'](respondWithResult(_0x68fa,0xc9))[_0x031f('0x45')](handleError(_0x68fa,null));};exports[_0x031f('0x53')]=function(_0x44afad,_0x491056,_0x5c88be){return db[_0x031f('0x2e')]['findOne']({'where':{'id':_0x44afad[_0x031f('0x46')]['id']},'raw':!![]})[_0x031f('0x25')](handleEntityNotFound(_0x491056,null))['then'](function(_0x342b4b){if(_0x342b4b){var _0x360fbb=_0x342b4b[_0x031f('0x54')]!==null;var _0xc2a37d=path[_0x031f('0x55')](config['root'],_0x031f('0x56'));if(_0x360fbb){_0xc2a37d=path['join'](_0xc2a37d,'offline-chat/');}var _0x2e71b6=path[_0x031f('0x55')](_0xc2a37d,_0x342b4b[_0x031f('0x50')]);return _0x491056[_0x031f('0x53')](_0x2e71b6);}})[_0x031f('0x45')](handleError(_0x491056,null));};
\ No newline at end of file