Built motion from commit b5996064.|2.6.21
[motion2.git] / server / api / attachment / attachment.controller.js
index fc3f20f..c566c8d 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x76f8=['attributes','fields','length','hasOwnProperty','nolimit','sort','pick','filter','where','merge','VIRTUAL','options','count','then','rows','catch','show','params','includeAll','include','find','clone','omit','createdAt','updatedAt','create','body','file','originalname','basename','filename','mimetype','download','findOne','ChatOfflineMessageId','join','root','rimraf','request-promise','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','set','Content-Range','apply','save','update','destroy','stack','name','send','map','Attachment','rawAttributes','type','key','model','query','keys','filters','intersection'];(function(_0x870b62,_0x2143f9){var _0x2dcb39=function(_0x2fb63d){while(--_0x2fb63d){_0x870b62['push'](_0x870b62['shift']());}};_0x2dcb39(++_0x2143f9);}(_0x76f8,0xd3));var _0x876f=function(_0x4365cb,_0x55ed1e){_0x4365cb=_0x4365cb-0x0;var _0x3ec9f7=_0x76f8[_0x4365cb];return _0x3ec9f7;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x876f('0x0'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x876f('0x1'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x876f('0x2'));var util=require(_0x876f('0x3'));var path=require(_0x876f('0x4'));var sox=require(_0x876f('0x5'));var csv=require(_0x876f('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x876f('0x7'));var _=require(_0x876f('0x8'));var squel=require(_0x876f('0x9'));var crypto=require(_0x876f('0xa'));var jsforce=require('jsforce');var deskjs=require(_0x876f('0xb'));var toCsv=require(_0x876f('0x6'));var querystring=require(_0x876f('0xc'));var Papa=require(_0x876f('0xd'));var Redis=require(_0x876f('0xe'));var authService=require(_0x876f('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x876f('0x10'));var hardwareService=require(_0x876f('0x11'));var logger=require(_0x876f('0x12'))(_0x876f('0x13'));var utils=require(_0x876f('0x14'));var config=require(_0x876f('0x15'));var licenseUtil=require(_0x876f('0x16'));var db=require(_0x876f('0x17'))['db'];function respondWithStatusCode(_0xf4f57,_0x547351){_0x547351=_0x547351||0xcc;return function(_0x2c2a38){if(_0x2c2a38){return _0xf4f57[_0x876f('0x18')](_0x547351);}return _0xf4f57[_0x876f('0x19')](_0x547351)[_0x876f('0x1a')]();};}function respondWithResult(_0x536af9,_0x1ace0b){_0x1ace0b=_0x1ace0b||0xc8;return function(_0x422676){if(_0x422676){return _0x536af9[_0x876f('0x19')](_0x1ace0b)[_0x876f('0x1b')](_0x422676);}};}function respondWithFilteredResult(_0x3f400a,_0x4e3e33){return function(_0x4a1cf9){if(_0x4a1cf9){var _0x5b9cd5=typeof _0x4e3e33[_0x876f('0x1c')]===_0x876f('0x1d')&&typeof _0x4e3e33[_0x876f('0x1e')]===_0x876f('0x1d');var _0x36eb99=_0x4a1cf9['count'];var _0xbdcf0a=_0x5b9cd5?0x0:_0x4e3e33[_0x876f('0x1c')];var _0xcd4986=_0x5b9cd5?_0x4a1cf9['count']:_0x4e3e33[_0x876f('0x1c')]+_0x4e3e33[_0x876f('0x1e')];var _0x1121d0;if(_0xcd4986>=_0x36eb99){_0xcd4986=_0x36eb99;_0x1121d0=0xc8;}else{_0x1121d0=0xce;}_0x3f400a[_0x876f('0x19')](_0x1121d0);return _0x3f400a[_0x876f('0x1f')](_0x876f('0x20'),_0xbdcf0a+'-'+_0xcd4986+'/'+_0x36eb99)[_0x876f('0x1b')](_0x4a1cf9);}return null;};}function patchUpdates(_0x539bd4){return function(_0x8d4932){try{jsonpatch[_0x876f('0x21')](_0x8d4932,_0x539bd4,!![]);}catch(_0x22a12d){return BPromise['reject'](_0x22a12d);}return _0x8d4932[_0x876f('0x22')]();};}function saveUpdates(_0x4004df,_0x427b03){return function(_0x2a85e1){if(_0x2a85e1){return _0x2a85e1[_0x876f('0x23')](_0x4004df)['then'](function(_0x1c641d){return _0x1c641d;});}return null;};}function removeEntity(_0x164ed9,_0x4d6edf){return function(_0x40ff3f){if(_0x40ff3f){return _0x40ff3f[_0x876f('0x24')]()['then'](function(){_0x164ed9[_0x876f('0x19')](0xcc)[_0x876f('0x1a')]();});}};}function handleEntityNotFound(_0x140d47,_0x157802){return function(_0x58f516){if(!_0x58f516){_0x140d47[_0x876f('0x18')](0x194);}return _0x58f516;};}function handleError(_0x1663e8,_0x3221aa){_0x3221aa=_0x3221aa||0x1f4;return function(_0x3f9d7a){logger['error'](_0x3f9d7a[_0x876f('0x25')]);if(_0x3f9d7a[_0x876f('0x26')]){delete _0x3f9d7a[_0x876f('0x26')];}_0x1663e8[_0x876f('0x19')](_0x3221aa)[_0x876f('0x27')](_0x3f9d7a);};}exports['index']=function(_0x3db4f6,_0x449f34){var _0x568ef8={},_0x155490={},_0x349930={'count':0x0,'rows':[]};var _0x1f21e8=_[_0x876f('0x28')](db[_0x876f('0x29')][_0x876f('0x2a')],function(_0x23a87f){return{'name':_0x23a87f['fieldName'],'type':_0x23a87f[_0x876f('0x2b')][_0x876f('0x2c')]};});_0x155490[_0x876f('0x2d')]=_[_0x876f('0x28')](_0x1f21e8,_0x876f('0x26'));_0x155490[_0x876f('0x2e')]=_[_0x876f('0x2f')](_0x3db4f6['query']);_0x155490[_0x876f('0x30')]=_[_0x876f('0x31')](_0x155490['model'],_0x155490['query']);_0x568ef8[_0x876f('0x32')]=_[_0x876f('0x31')](_0x155490[_0x876f('0x2d')],qs['fields'](_0x3db4f6['query'][_0x876f('0x33')]));_0x568ef8['attributes']=_0x568ef8[_0x876f('0x32')][_0x876f('0x34')]?_0x568ef8['attributes']:_0x155490[_0x876f('0x2d')];if(!_0x3db4f6[_0x876f('0x2e')][_0x876f('0x35')](_0x876f('0x36'))){_0x568ef8[_0x876f('0x1e')]=qs[_0x876f('0x1e')](_0x3db4f6[_0x876f('0x2e')]['limit']);_0x568ef8[_0x876f('0x1c')]=qs[_0x876f('0x1c')](_0x3db4f6['query']['offset']);}_0x568ef8['order']=qs[_0x876f('0x37')](_0x3db4f6['query']['sort']);_0x568ef8['where']=qs[_0x876f('0x30')](_[_0x876f('0x38')](_0x3db4f6['query'],_0x155490[_0x876f('0x30')]),_0x1f21e8);if(_0x3db4f6['query'][_0x876f('0x39')]){_0x568ef8[_0x876f('0x3a')]=_[_0x876f('0x3b')](_0x568ef8['where'],{'$or':_[_0x876f('0x28')](_0x1f21e8,function(_0x306a01){if(_0x306a01[_0x876f('0x2b')]!==_0x876f('0x3c')){var _0x15add2={};_0x15add2[_0x306a01['name']]={'$like':'%'+_0x3db4f6[_0x876f('0x2e')][_0x876f('0x39')]+'%'};return _0x15add2;}})});}_0x568ef8=_[_0x876f('0x3b')]({},_0x568ef8,_0x3db4f6[_0x876f('0x3d')]);var _0x3b28dd={'where':_0x568ef8[_0x876f('0x3a')]};return db[_0x876f('0x29')][_0x876f('0x3e')](_0x3b28dd)[_0x876f('0x3f')](function(_0x53166c){_0x349930[_0x876f('0x3e')]=_0x53166c;if(_0x3db4f6[_0x876f('0x2e')]['includeAll']){_0x568ef8['include']=[{'all':!![]}];}return db['Attachment']['findAll'](_0x568ef8);})[_0x876f('0x3f')](function(_0x17a04b){_0x349930[_0x876f('0x40')]=_0x17a04b;return _0x349930;})[_0x876f('0x3f')](respondWithFilteredResult(_0x449f34,_0x568ef8))[_0x876f('0x41')](handleError(_0x449f34,null));};exports[_0x876f('0x42')]=function(_0x13d9d7,_0x5a8aa6){var _0x4b78da={'raw':!![],'where':{'id':_0x13d9d7[_0x876f('0x43')]['id']}},_0x41ed57={};_0x41ed57[_0x876f('0x2d')]=_[_0x876f('0x2f')](db[_0x876f('0x29')][_0x876f('0x2a')]);_0x41ed57[_0x876f('0x2e')]=_[_0x876f('0x2f')](_0x13d9d7['query']);_0x41ed57[_0x876f('0x30')]=_['intersection'](_0x41ed57[_0x876f('0x2d')],_0x41ed57[_0x876f('0x2e')]);_0x4b78da[_0x876f('0x32')]=_[_0x876f('0x31')](_0x41ed57[_0x876f('0x2d')],qs[_0x876f('0x33')](_0x13d9d7[_0x876f('0x2e')][_0x876f('0x33')]));_0x4b78da[_0x876f('0x32')]=_0x4b78da[_0x876f('0x32')]['length']?_0x4b78da['attributes']:_0x41ed57[_0x876f('0x2d')];if(_0x13d9d7['query'][_0x876f('0x44')]){_0x4b78da[_0x876f('0x45')]=[{'all':!![]}];}_0x4b78da=_[_0x876f('0x3b')]({},_0x4b78da,_0x13d9d7[_0x876f('0x3d')]);return db[_0x876f('0x29')][_0x876f('0x46')](_0x4b78da)[_0x876f('0x3f')](handleEntityNotFound(_0x5a8aa6,null))['then'](respondWithResult(_0x5a8aa6,null))['catch'](handleError(_0x5a8aa6,null));};exports[_0x876f('0x47')]=function(_0x4cd5b0,_0x11942f){var _0x34bfdf={'where':{'id':_0x4cd5b0[_0x876f('0x43')]['id']}},_0x4f5c54={};_0x4f5c54[_0x876f('0x2d')]=_[_0x876f('0x2f')](db[_0x876f('0x29')]['rawAttributes']);_0x34bfdf['attributes']=_[_0x876f('0x31')](_0x4f5c54[_0x876f('0x2d')],qs[_0x876f('0x33')](_0x4cd5b0[_0x876f('0x2e')][_0x876f('0x33')]));_0x34bfdf['attributes']=_0x34bfdf['attributes'][_0x876f('0x34')]?_0x34bfdf[_0x876f('0x32')]:_0x4f5c54[_0x876f('0x2d')];if(_0x4cd5b0[_0x876f('0x2e')][_0x876f('0x44')]){_0x34bfdf[_0x876f('0x45')]=[{'all':!![]}];}_0x34bfdf=_['merge']({},_0x34bfdf,_0x4cd5b0[_0x876f('0x3d')]);return db[_0x876f('0x29')][_0x876f('0x46')](_0x34bfdf)[_0x876f('0x3f')](handleEntityNotFound(_0x11942f,null))[_0x876f('0x3f')](function(_0x15e944){if(_0x15e944){var _0xb77034=_0x15e944['get']({'plain':!![]});_0xb77034=qs[_0x876f('0x48')](_0xb77034,['id',_0x876f('0x49'),_0x876f('0x4a')]);_0x4cd5b0['body']=_['omit'](_0x4cd5b0['body'],['id',_0x876f('0x49'),'updatedAt']);return db['Attachment'][_0x876f('0x4b')](_[_0x876f('0x3b')](_0xb77034,_0x4cd5b0['body']),{'include':_0x4cd5b0[_0x876f('0x2e')][_0x876f('0x44')]?[{'all':!![]}]:undefined});}})[_0x876f('0x3f')](respondWithResult(_0x11942f,0xc9))[_0x876f('0x41')](handleError(_0x11942f,null));};exports['update']=function(_0x29bef2,_0x491cc1){if(_0x29bef2[_0x876f('0x4c')]['id']){delete _0x29bef2['body']['id'];}return db['Attachment'][_0x876f('0x46')]({'where':{'id':_0x29bef2[_0x876f('0x43')]['id']}})['then'](handleEntityNotFound(_0x491cc1,null))[_0x876f('0x3f')](saveUpdates(_0x29bef2[_0x876f('0x4c')],null))[_0x876f('0x3f')](respondWithResult(_0x491cc1,null))[_0x876f('0x41')](handleError(_0x491cc1,null));};exports[_0x876f('0x24')]=function(_0x53b718,_0x553258){return db['Attachment'][_0x876f('0x46')]({'where':{'id':_0x53b718[_0x876f('0x43')]['id']}})[_0x876f('0x3f')](handleEntityNotFound(_0x553258,null))[_0x876f('0x3f')](removeEntity(_0x553258,null))[_0x876f('0x41')](handleError(_0x553258,null));};exports[_0x876f('0x4b')]=function(_0x4a47d7,_0x3f1e7d,_0x3b43a5){_0x4a47d7['body'][_0x876f('0x26')]=_0x4a47d7[_0x876f('0x4d')][_0x876f('0x4e')];_0x4a47d7[_0x876f('0x4c')][_0x876f('0x4f')]=_0x4a47d7[_0x876f('0x4d')][_0x876f('0x50')];_0x4a47d7[_0x876f('0x4c')][_0x876f('0x2b')]=_0x4a47d7[_0x876f('0x4d')][_0x876f('0x51')];return db[_0x876f('0x29')][_0x876f('0x4b')](_0x4a47d7['body'])[_0x876f('0x3f')](respondWithResult(_0x3f1e7d,0xc9))[_0x876f('0x41')](handleError(_0x3f1e7d,null));};exports[_0x876f('0x52')]=function(_0x7bf600,_0x4e7056,_0x1af92b){return db['Attachment'][_0x876f('0x53')]({'where':{'id':_0x7bf600['params']['id']},'raw':!![]})[_0x876f('0x3f')](handleEntityNotFound(_0x4e7056,null))[_0x876f('0x3f')](function(_0x4a300b){if(_0x4a300b){var _0x335d8c=_0x4a300b[_0x876f('0x54')]!==null;var _0x27631c=path[_0x876f('0x55')](config[_0x876f('0x56')],'server/files/attachments/');if(_0x335d8c){_0x27631c=path[_0x876f('0x55')](_0x27631c,'offline-chat/');}var _0x4b8de9=path['join'](_0x27631c,_0x4a300b[_0x876f('0x4f')]);return _0x4e7056[_0x876f('0x52')](_0x4b8de9);}})[_0x876f('0x41')](handleError(_0x4e7056,null));};
\ No newline at end of file
+var _0xd20f=['root','server/files/attachments/','basename','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','path','sox','fs-extra','lodash','crypto','jsforce','desk.js','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','end','status','json','undefined','limit','count','offset','set','Content-Range','apply','reject','update','then','destroy','stack','name','send','index','map','Attachment','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','options','include','findAll','catch','show','params','merge','find','get','omit','createdAt','updatedAt','body','create','includeAll','file','originalname','filename','mimetype','download','findOne','join'];(function(_0x1252cb,_0x4c91eb){var _0x27968e=function(_0x1c17bd){while(--_0x1c17bd){_0x1252cb['push'](_0x1252cb['shift']());}};_0x27968e(++_0x4c91eb);}(_0xd20f,0x16f));var _0xfd20=function(_0x25bc3b,_0x141901){_0x25bc3b=_0x25bc3b-0x0;var _0x24eeab=_0xd20f[_0x25bc3b];return _0x24eeab;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xfd20('0x0'));var zipdir=require(_0xfd20('0x1'));var jsonpatch=require(_0xfd20('0x2'));var rp=require(_0xfd20('0x3'));var moment=require('moment');var BPromise=require(_0xfd20('0x4'));var Mustache=require(_0xfd20('0x5'));var util=require('util');var path=require(_0xfd20('0x6'));var sox=require(_0xfd20('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xfd20('0x8'));var _=require(_0xfd20('0x9'));var squel=require('squel');var crypto=require(_0xfd20('0xa'));var jsforce=require(_0xfd20('0xb'));var deskjs=require(_0xfd20('0xc'));var toCsv=require(_0xfd20('0xd'));var querystring=require(_0xfd20('0xe'));var Papa=require(_0xfd20('0xf'));var Redis=require(_0xfd20('0x10'));var authService=require(_0xfd20('0x11'));var qs=require(_0xfd20('0x12'));var as=require(_0xfd20('0x13'));var hardwareService=require(_0xfd20('0x14'));var logger=require('../../config/logger')(_0xfd20('0x15'));var utils=require(_0xfd20('0x16'));var config=require(_0xfd20('0x17'));var licenseUtil=require(_0xfd20('0x18'));var db=require(_0xfd20('0x19'))['db'];function respondWithStatusCode(_0x34483c,_0x2497a3){_0x2497a3=_0x2497a3||0xcc;return function(_0x25bc07){if(_0x25bc07){return _0x34483c[_0xfd20('0x1a')](_0x2497a3);}return _0x34483c['status'](_0x2497a3)[_0xfd20('0x1b')]();};}function respondWithResult(_0x221ae4,_0xdad3fe){_0xdad3fe=_0xdad3fe||0xc8;return function(_0x2accbf){if(_0x2accbf){return _0x221ae4[_0xfd20('0x1c')](_0xdad3fe)[_0xfd20('0x1d')](_0x2accbf);}};}function respondWithFilteredResult(_0xd0921f,_0x2e79e7){return function(_0xa4e634){if(_0xa4e634){var _0x378000=typeof _0x2e79e7['offset']===_0xfd20('0x1e')&&typeof _0x2e79e7[_0xfd20('0x1f')]==='undefined';var _0xd75b84=_0xa4e634[_0xfd20('0x20')];var _0x2a3cd1=_0x378000?0x0:_0x2e79e7['offset'];var _0x22ba28=_0x378000?_0xa4e634['count']:_0x2e79e7[_0xfd20('0x21')]+_0x2e79e7['limit'];var _0x1432e6;if(_0x22ba28>=_0xd75b84){_0x22ba28=_0xd75b84;_0x1432e6=0xc8;}else{_0x1432e6=0xce;}_0xd0921f[_0xfd20('0x1c')](_0x1432e6);return _0xd0921f[_0xfd20('0x22')](_0xfd20('0x23'),_0x2a3cd1+'-'+_0x22ba28+'/'+_0xd75b84)[_0xfd20('0x1d')](_0xa4e634);}return null;};}function patchUpdates(_0x4f6b4f){return function(_0x3c925f){try{jsonpatch[_0xfd20('0x24')](_0x3c925f,_0x4f6b4f,!![]);}catch(_0xd84493){return BPromise[_0xfd20('0x25')](_0xd84493);}return _0x3c925f['save']();};}function saveUpdates(_0x3a13de,_0x35c879){return function(_0x497400){if(_0x497400){return _0x497400[_0xfd20('0x26')](_0x3a13de)[_0xfd20('0x27')](function(_0x3c1eaf){return _0x3c1eaf;});}return null;};}function removeEntity(_0x4479ba,_0x10b6e3){return function(_0x3a630d){if(_0x3a630d){return _0x3a630d[_0xfd20('0x28')]()['then'](function(){_0x4479ba['status'](0xcc)[_0xfd20('0x1b')]();});}};}function handleEntityNotFound(_0x28d3aa,_0x5e3ec6){return function(_0x5a7adb){if(!_0x5a7adb){_0x28d3aa['sendStatus'](0x194);}return _0x5a7adb;};}function handleError(_0x2943d2,_0x187aad){_0x187aad=_0x187aad||0x1f4;return function(_0x33c798){logger['error'](_0x33c798[_0xfd20('0x29')]);if(_0x33c798[_0xfd20('0x2a')]){delete _0x33c798[_0xfd20('0x2a')];}_0x2943d2[_0xfd20('0x1c')](_0x187aad)[_0xfd20('0x2b')](_0x33c798);};}exports[_0xfd20('0x2c')]=function(_0x46444b,_0xf15665){var _0x592524={},_0x174bad={},_0x1acb14={'count':0x0,'rows':[]};var _0x589ca9=_[_0xfd20('0x2d')](db[_0xfd20('0x2e')][_0xfd20('0x2f')],function(_0x41a06a){return{'name':_0x41a06a[_0xfd20('0x30')],'type':_0x41a06a[_0xfd20('0x31')][_0xfd20('0x32')]};});_0x174bad['model']=_['map'](_0x589ca9,'name');_0x174bad[_0xfd20('0x33')]=_[_0xfd20('0x34')](_0x46444b['query']);_0x174bad[_0xfd20('0x35')]=_[_0xfd20('0x36')](_0x174bad[_0xfd20('0x37')],_0x174bad[_0xfd20('0x33')]);_0x592524['attributes']=_['intersection'](_0x174bad[_0xfd20('0x37')],qs[_0xfd20('0x38')](_0x46444b[_0xfd20('0x33')][_0xfd20('0x38')]));_0x592524[_0xfd20('0x39')]=_0x592524[_0xfd20('0x39')][_0xfd20('0x3a')]?_0x592524[_0xfd20('0x39')]:_0x174bad[_0xfd20('0x37')];if(!_0x46444b[_0xfd20('0x33')][_0xfd20('0x3b')](_0xfd20('0x3c'))){_0x592524[_0xfd20('0x1f')]=qs[_0xfd20('0x1f')](_0x46444b['query']['limit']);_0x592524[_0xfd20('0x21')]=qs[_0xfd20('0x21')](_0x46444b[_0xfd20('0x33')][_0xfd20('0x21')]);}_0x592524[_0xfd20('0x3d')]=qs['sort'](_0x46444b[_0xfd20('0x33')][_0xfd20('0x3e')]);_0x592524[_0xfd20('0x3f')]=qs['filters'](_[_0xfd20('0x40')](_0x46444b['query'],_0x174bad[_0xfd20('0x35')]),_0x589ca9);if(_0x46444b[_0xfd20('0x33')][_0xfd20('0x41')]){_0x592524[_0xfd20('0x3f')]=_['merge'](_0x592524[_0xfd20('0x3f')],{'$or':_[_0xfd20('0x2d')](_0x589ca9,function(_0x458ffc){if(_0x458ffc['type']!=='VIRTUAL'){var _0x4ba591={};_0x4ba591[_0x458ffc[_0xfd20('0x2a')]]={'$like':'%'+_0x46444b[_0xfd20('0x33')][_0xfd20('0x41')]+'%'};return _0x4ba591;}})});}_0x592524=_['merge']({},_0x592524,_0x46444b[_0xfd20('0x42')]);var _0x3bb56f={'where':_0x592524['where']};return db['Attachment']['count'](_0x3bb56f)[_0xfd20('0x27')](function(_0x319601){_0x1acb14[_0xfd20('0x20')]=_0x319601;if(_0x46444b[_0xfd20('0x33')]['includeAll']){_0x592524[_0xfd20('0x43')]=[{'all':!![]}];}return db[_0xfd20('0x2e')][_0xfd20('0x44')](_0x592524);})[_0xfd20('0x27')](function(_0x33e3b0){_0x1acb14['rows']=_0x33e3b0;return _0x1acb14;})['then'](respondWithFilteredResult(_0xf15665,_0x592524))[_0xfd20('0x45')](handleError(_0xf15665,null));};exports[_0xfd20('0x46')]=function(_0x174fe8,_0x138346){var _0x1e62f3={'raw':!![],'where':{'id':_0x174fe8[_0xfd20('0x47')]['id']}},_0x4a306d={};_0x4a306d[_0xfd20('0x37')]=_[_0xfd20('0x34')](db[_0xfd20('0x2e')][_0xfd20('0x2f')]);_0x4a306d[_0xfd20('0x33')]=_[_0xfd20('0x34')](_0x174fe8[_0xfd20('0x33')]);_0x4a306d[_0xfd20('0x35')]=_[_0xfd20('0x36')](_0x4a306d[_0xfd20('0x37')],_0x4a306d[_0xfd20('0x33')]);_0x1e62f3['attributes']=_['intersection'](_0x4a306d[_0xfd20('0x37')],qs['fields'](_0x174fe8[_0xfd20('0x33')]['fields']));_0x1e62f3['attributes']=_0x1e62f3[_0xfd20('0x39')][_0xfd20('0x3a')]?_0x1e62f3[_0xfd20('0x39')]:_0x4a306d[_0xfd20('0x37')];if(_0x174fe8[_0xfd20('0x33')]['includeAll']){_0x1e62f3[_0xfd20('0x43')]=[{'all':!![]}];}_0x1e62f3=_[_0xfd20('0x48')]({},_0x1e62f3,_0x174fe8[_0xfd20('0x42')]);return db[_0xfd20('0x2e')][_0xfd20('0x49')](_0x1e62f3)[_0xfd20('0x27')](handleEntityNotFound(_0x138346,null))[_0xfd20('0x27')](respondWithResult(_0x138346,null))[_0xfd20('0x45')](handleError(_0x138346,null));};exports['clone']=function(_0x2294df,_0x3c1bc1){var _0x4ce119={'where':{'id':_0x2294df['params']['id']}},_0x8dc9a3={};_0x8dc9a3[_0xfd20('0x37')]=_[_0xfd20('0x34')](db['Attachment'][_0xfd20('0x2f')]);_0x4ce119[_0xfd20('0x39')]=_[_0xfd20('0x36')](_0x8dc9a3[_0xfd20('0x37')],qs[_0xfd20('0x38')](_0x2294df[_0xfd20('0x33')][_0xfd20('0x38')]));_0x4ce119[_0xfd20('0x39')]=_0x4ce119[_0xfd20('0x39')][_0xfd20('0x3a')]?_0x4ce119[_0xfd20('0x39')]:_0x8dc9a3[_0xfd20('0x37')];if(_0x2294df[_0xfd20('0x33')]['includeAll']){_0x4ce119[_0xfd20('0x43')]=[{'all':!![]}];}_0x4ce119=_[_0xfd20('0x48')]({},_0x4ce119,_0x2294df[_0xfd20('0x42')]);return db[_0xfd20('0x2e')][_0xfd20('0x49')](_0x4ce119)[_0xfd20('0x27')](handleEntityNotFound(_0x3c1bc1,null))[_0xfd20('0x27')](function(_0xc8c687){if(_0xc8c687){var _0x260988=_0xc8c687[_0xfd20('0x4a')]({'plain':!![]});_0x260988=qs[_0xfd20('0x4b')](_0x260988,['id',_0xfd20('0x4c'),_0xfd20('0x4d')]);_0x2294df['body']=_['omit'](_0x2294df[_0xfd20('0x4e')],['id','createdAt','updatedAt']);return db[_0xfd20('0x2e')][_0xfd20('0x4f')](_[_0xfd20('0x48')](_0x260988,_0x2294df[_0xfd20('0x4e')]),{'include':_0x2294df['query'][_0xfd20('0x50')]?[{'all':!![]}]:undefined});}})[_0xfd20('0x27')](respondWithResult(_0x3c1bc1,0xc9))['catch'](handleError(_0x3c1bc1,null));};exports['update']=function(_0x486920,_0x5a5d1a){if(_0x486920[_0xfd20('0x4e')]['id']){delete _0x486920[_0xfd20('0x4e')]['id'];}return db[_0xfd20('0x2e')]['find']({'where':{'id':_0x486920['params']['id']}})[_0xfd20('0x27')](handleEntityNotFound(_0x5a5d1a,null))['then'](saveUpdates(_0x486920[_0xfd20('0x4e')],null))[_0xfd20('0x27')](respondWithResult(_0x5a5d1a,null))['catch'](handleError(_0x5a5d1a,null));};exports[_0xfd20('0x28')]=function(_0x1d2d09,_0x5d9f03){return db['Attachment'][_0xfd20('0x49')]({'where':{'id':_0x1d2d09[_0xfd20('0x47')]['id']}})[_0xfd20('0x27')](handleEntityNotFound(_0x5d9f03,null))[_0xfd20('0x27')](removeEntity(_0x5d9f03,null))['catch'](handleError(_0x5d9f03,null));};exports['create']=function(_0x319a89,_0x422d2d,_0x27b996){_0x319a89[_0xfd20('0x4e')][_0xfd20('0x2a')]=_0x319a89[_0xfd20('0x51')][_0xfd20('0x52')];_0x319a89[_0xfd20('0x4e')]['basename']=_0x319a89[_0xfd20('0x51')][_0xfd20('0x53')];_0x319a89[_0xfd20('0x4e')][_0xfd20('0x31')]=_0x319a89[_0xfd20('0x51')][_0xfd20('0x54')];return db[_0xfd20('0x2e')][_0xfd20('0x4f')](_0x319a89[_0xfd20('0x4e')])[_0xfd20('0x27')](respondWithResult(_0x422d2d,0xc9))[_0xfd20('0x45')](handleError(_0x422d2d,null));};exports[_0xfd20('0x55')]=function(_0x44eb7f,_0x1d3975,_0x11d4d5){return db['Attachment'][_0xfd20('0x56')]({'where':{'id':_0x44eb7f[_0xfd20('0x47')]['id']},'raw':!![]})[_0xfd20('0x27')](handleEntityNotFound(_0x1d3975,null))[_0xfd20('0x27')](function(_0x9664bc){if(_0x9664bc){var _0x2b8d55=_0x9664bc['ChatOfflineMessageId']!==null;var _0x3000d3=path[_0xfd20('0x57')](config[_0xfd20('0x58')],_0xfd20('0x59'));if(_0x2b8d55){_0x3000d3=path[_0xfd20('0x57')](_0x3000d3,'offline-chat/');}var _0x180e49=path['join'](_0x3000d3,_0x9664bc[_0xfd20('0x5a')]);return _0x1d3975[_0xfd20('0x55')](_0x180e49);}})['catch'](handleError(_0x1d3975,null));};
\ No newline at end of file