Built motion from commit b5996064.|2.6.21
[motion2.git] / server / api / attachment / attachment.controller.js
index 3ccd4b8..c566c8d 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x1f80=['length','include','merge','find','clone','get','omit','createdAt','body','updatedAt','file','basename','filename','type','mimetype','create','download','findOne','root','server/files/attachments/','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','util','path','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','error','name','send','index','map','Attachment','key','model','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','options','count','includeAll','findAll','rows','catch','show','params','keys','rawAttributes'];(function(_0x26f155,_0x182edc){var _0x2cdd23=function(_0x104668){while(--_0x104668){_0x26f155['push'](_0x26f155['shift']());}};_0x2cdd23(++_0x182edc);}(_0x1f80,0x71));var _0x01f8=function(_0x81d01b,_0x1a8ad5){_0x81d01b=_0x81d01b-0x0;var _0x1358e3=_0x1f80[_0x81d01b];return _0x1358e3;};'use strict';var pdf=require(_0x01f8('0x0'));var emlformat=require(_0x01f8('0x1'));var rimraf=require(_0x01f8('0x2'));var zipdir=require(_0x01f8('0x3'));var jsonpatch=require(_0x01f8('0x4'));var rp=require(_0x01f8('0x5'));var moment=require('moment');var BPromise=require(_0x01f8('0x6'));var Mustache=require('mustache');var util=require(_0x01f8('0x7'));var path=require(_0x01f8('0x8'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x01f8('0x9'));var fs=require('fs');var _=require(_0x01f8('0xa'));var squel=require(_0x01f8('0xb'));var crypto=require(_0x01f8('0xc'));var jsforce=require(_0x01f8('0xd'));var deskjs=require(_0x01f8('0xe'));var toCsv=require(_0x01f8('0xf'));var querystring=require(_0x01f8('0x10'));var Papa=require('papaparse');var Redis=require(_0x01f8('0x11'));var authService=require(_0x01f8('0x12'));var qs=require(_0x01f8('0x13'));var as=require(_0x01f8('0x14'));var hardwareService=require(_0x01f8('0x15'));var logger=require(_0x01f8('0x16'))(_0x01f8('0x17'));var utils=require(_0x01f8('0x18'));var config=require(_0x01f8('0x19'));var licenseUtil=require(_0x01f8('0x1a'));var db=require(_0x01f8('0x1b'))['db'];function respondWithStatusCode(_0x5ac03b,_0x4465dd){_0x4465dd=_0x4465dd||0xcc;return function(_0x42bdbb){if(_0x42bdbb){return _0x5ac03b[_0x01f8('0x1c')](_0x4465dd);}return _0x5ac03b[_0x01f8('0x1d')](_0x4465dd)[_0x01f8('0x1e')]();};}function respondWithResult(_0x3b24a0,_0x22e3b8){_0x22e3b8=_0x22e3b8||0xc8;return function(_0x3a8fa8){if(_0x3a8fa8){return _0x3b24a0['status'](_0x22e3b8)[_0x01f8('0x1f')](_0x3a8fa8);}};}function respondWithFilteredResult(_0x3bc682,_0x413f4b){return function(_0x4f7f31){if(_0x4f7f31){var _0x5baa92=_0x4f7f31['count'],_0x28e396=_0x413f4b[_0x01f8('0x20')],_0x27002c=_0x413f4b[_0x01f8('0x20')]+_0x413f4b[_0x01f8('0x21')],_0x2d2d75;if(_0x27002c>=_0x5baa92){_0x27002c=_0x5baa92;_0x2d2d75=0xc8;}else{_0x2d2d75=0xce;}_0x3bc682[_0x01f8('0x1d')](_0x2d2d75);return _0x3bc682[_0x01f8('0x22')](_0x01f8('0x23'),_0x28e396+'-'+_0x27002c+'/'+_0x5baa92)[_0x01f8('0x1f')](_0x4f7f31);}return null;};}function patchUpdates(_0x188d1c){return function(_0x339a7a){try{jsonpatch[_0x01f8('0x24')](_0x339a7a,_0x188d1c,!![]);}catch(_0xe281c7){return BPromise[_0x01f8('0x25')](_0xe281c7);}return _0x339a7a[_0x01f8('0x26')]();};}function saveUpdates(_0x3e2da9,_0x1deeb3){return function(_0x3d9115){if(_0x3d9115){return _0x3d9115[_0x01f8('0x27')](_0x3e2da9)[_0x01f8('0x28')](function(_0x25e6bf){return _0x25e6bf;});}return null;};}function removeEntity(_0xcfbd66,_0x3272ce){return function(_0x218b41){if(_0x218b41){return _0x218b41[_0x01f8('0x29')]()[_0x01f8('0x28')](function(){_0xcfbd66['status'](0xcc)[_0x01f8('0x1e')]();});}};}function handleEntityNotFound(_0x34f87f,_0x2699ef){return function(_0x1c9065){if(!_0x1c9065){_0x34f87f[_0x01f8('0x1c')](0x194);}return _0x1c9065;};}function handleError(_0x2e39bf,_0x36cd3b){_0x36cd3b=_0x36cd3b||0x1f4;return function(_0x1382ff){logger[_0x01f8('0x2a')](_0x1382ff['stack']);if(_0x1382ff[_0x01f8('0x2b')]){delete _0x1382ff[_0x01f8('0x2b')];}_0x2e39bf[_0x01f8('0x1d')](_0x36cd3b)[_0x01f8('0x2c')](_0x1382ff);};}exports[_0x01f8('0x2d')]=function(_0x397dc9,_0x5d4870){var _0x3e24e6={},_0x1f2976={},_0x4f9857={'count':0x0,'rows':[]};var _0x3e5ef0=_[_0x01f8('0x2e')](db[_0x01f8('0x2f')]['rawAttributes'],function(_0x15f2fb){return{'name':_0x15f2fb['fieldName'],'type':_0x15f2fb['type'][_0x01f8('0x30')]};});_0x1f2976[_0x01f8('0x31')]=_['map'](_0x3e5ef0,_0x01f8('0x2b'));_0x1f2976[_0x01f8('0x32')]=_['keys'](_0x397dc9['query']);_0x1f2976[_0x01f8('0x33')]=_[_0x01f8('0x34')](_0x1f2976[_0x01f8('0x31')],_0x1f2976[_0x01f8('0x32')]);_0x3e24e6[_0x01f8('0x35')]=_[_0x01f8('0x34')](_0x1f2976[_0x01f8('0x31')],qs[_0x01f8('0x36')](_0x397dc9['query']['fields']));_0x3e24e6[_0x01f8('0x35')]=_0x3e24e6[_0x01f8('0x35')]['length']?_0x3e24e6[_0x01f8('0x35')]:_0x1f2976[_0x01f8('0x31')];if(!_0x397dc9['query'][_0x01f8('0x37')](_0x01f8('0x38'))){_0x3e24e6[_0x01f8('0x21')]=qs['limit'](_0x397dc9[_0x01f8('0x32')][_0x01f8('0x21')]);_0x3e24e6[_0x01f8('0x20')]=qs[_0x01f8('0x20')](_0x397dc9[_0x01f8('0x32')]['offset']);}_0x3e24e6[_0x01f8('0x39')]=qs['sort'](_0x397dc9['query'][_0x01f8('0x3a')]);_0x3e24e6[_0x01f8('0x3b')]=qs['filters'](_[_0x01f8('0x3c')](_0x397dc9[_0x01f8('0x32')],_0x1f2976[_0x01f8('0x33')]),_0x3e5ef0);if(_0x397dc9[_0x01f8('0x32')][_0x01f8('0x3d')]){_0x3e24e6['where']=_['merge'](_0x3e24e6['where'],{'$or':_['map'](_0x3e5ef0,function(_0x3caf0a){if(_0x3caf0a['type']!==_0x01f8('0x3e')){var _0x8331a7={};_0x8331a7[_0x3caf0a['name']]={'$like':'%'+_0x397dc9[_0x01f8('0x32')][_0x01f8('0x3d')]+'%'};return _0x8331a7;}})});}_0x3e24e6=_['merge']({},_0x3e24e6,_0x397dc9[_0x01f8('0x3f')]);var _0x10d18a={'where':_0x3e24e6['where']};return db[_0x01f8('0x2f')][_0x01f8('0x40')](_0x10d18a)['then'](function(_0x97f156){_0x4f9857[_0x01f8('0x40')]=_0x97f156;if(_0x397dc9[_0x01f8('0x32')][_0x01f8('0x41')]){_0x3e24e6['include']=[{'all':!![]}];}return db['Attachment'][_0x01f8('0x42')](_0x3e24e6);})['then'](function(_0x572b67){_0x4f9857[_0x01f8('0x43')]=_0x572b67;return _0x4f9857;})['then'](respondWithFilteredResult(_0x5d4870,_0x3e24e6))[_0x01f8('0x44')](handleError(_0x5d4870,null));};exports[_0x01f8('0x45')]=function(_0x324825,_0x4bb1e9){var _0x4ef66e={'raw':!![],'where':{'id':_0x324825[_0x01f8('0x46')]['id']}},_0x241d7f={};_0x241d7f['model']=_[_0x01f8('0x47')](db[_0x01f8('0x2f')][_0x01f8('0x48')]);_0x241d7f['query']=_['keys'](_0x324825['query']);_0x241d7f[_0x01f8('0x33')]=_[_0x01f8('0x34')](_0x241d7f[_0x01f8('0x31')],_0x241d7f[_0x01f8('0x32')]);_0x4ef66e[_0x01f8('0x35')]=_[_0x01f8('0x34')](_0x241d7f['model'],qs[_0x01f8('0x36')](_0x324825[_0x01f8('0x32')]['fields']));_0x4ef66e[_0x01f8('0x35')]=_0x4ef66e[_0x01f8('0x35')][_0x01f8('0x49')]?_0x4ef66e[_0x01f8('0x35')]:_0x241d7f[_0x01f8('0x31')];if(_0x324825[_0x01f8('0x32')][_0x01f8('0x41')]){_0x4ef66e[_0x01f8('0x4a')]=[{'all':!![]}];}_0x4ef66e=_[_0x01f8('0x4b')]({},_0x4ef66e,_0x324825[_0x01f8('0x3f')]);return db[_0x01f8('0x2f')][_0x01f8('0x4c')](_0x4ef66e)[_0x01f8('0x28')](handleEntityNotFound(_0x4bb1e9,null))[_0x01f8('0x28')](respondWithResult(_0x4bb1e9,null))['catch'](handleError(_0x4bb1e9,null));};exports[_0x01f8('0x4d')]=function(_0xc008bd,_0x1ea537){var _0x18ea05={'where':{'id':_0xc008bd[_0x01f8('0x46')]['id']}},_0x971949={};_0x971949['model']=_[_0x01f8('0x47')](db[_0x01f8('0x2f')][_0x01f8('0x48')]);_0x18ea05[_0x01f8('0x35')]=_[_0x01f8('0x34')](_0x971949['model'],qs[_0x01f8('0x36')](_0xc008bd[_0x01f8('0x32')][_0x01f8('0x36')]));_0x18ea05[_0x01f8('0x35')]=_0x18ea05[_0x01f8('0x35')][_0x01f8('0x49')]?_0x18ea05[_0x01f8('0x35')]:_0x971949[_0x01f8('0x31')];if(_0xc008bd[_0x01f8('0x32')][_0x01f8('0x41')]){_0x18ea05[_0x01f8('0x4a')]=[{'all':!![]}];}_0x18ea05=_[_0x01f8('0x4b')]({},_0x18ea05,_0xc008bd[_0x01f8('0x3f')]);return db[_0x01f8('0x2f')][_0x01f8('0x4c')](_0x18ea05)['then'](handleEntityNotFound(_0x1ea537,null))[_0x01f8('0x28')](function(_0x130041){if(_0x130041){var _0x3c0b0e=_0x130041[_0x01f8('0x4e')]({'plain':!![]});_0x3c0b0e=qs[_0x01f8('0x4f')](_0x3c0b0e,['id',_0x01f8('0x50'),'updatedAt']);_0xc008bd['body']=_['omit'](_0xc008bd[_0x01f8('0x51')],['id',_0x01f8('0x50'),_0x01f8('0x52')]);return db[_0x01f8('0x2f')]['create'](_[_0x01f8('0x4b')](_0x3c0b0e,_0xc008bd[_0x01f8('0x51')]),{'include':_0xc008bd['query']['includeAll']?[{'all':!![]}]:undefined});}})[_0x01f8('0x28')](respondWithResult(_0x1ea537,0xc9))[_0x01f8('0x44')](handleError(_0x1ea537,null));};exports[_0x01f8('0x27')]=function(_0x5ce501,_0x3e8e76){if(_0x5ce501['body']['id']){delete _0x5ce501[_0x01f8('0x51')]['id'];}return db[_0x01f8('0x2f')][_0x01f8('0x4c')]({'where':{'id':_0x5ce501[_0x01f8('0x46')]['id']}})[_0x01f8('0x28')](handleEntityNotFound(_0x3e8e76,null))[_0x01f8('0x28')](saveUpdates(_0x5ce501[_0x01f8('0x51')],null))[_0x01f8('0x28')](respondWithResult(_0x3e8e76,null))[_0x01f8('0x44')](handleError(_0x3e8e76,null));};exports[_0x01f8('0x29')]=function(_0x10fe33,_0x4851b5){return db[_0x01f8('0x2f')]['find']({'where':{'id':_0x10fe33[_0x01f8('0x46')]['id']}})[_0x01f8('0x28')](handleEntityNotFound(_0x4851b5,null))['then'](removeEntity(_0x4851b5,null))[_0x01f8('0x44')](handleError(_0x4851b5,null));};exports['create']=function(_0x474f75,_0x4d7b1b,_0x692ef3){_0x474f75[_0x01f8('0x51')][_0x01f8('0x2b')]=_0x474f75[_0x01f8('0x53')]['originalname'];_0x474f75[_0x01f8('0x51')][_0x01f8('0x54')]=_0x474f75[_0x01f8('0x53')][_0x01f8('0x55')];_0x474f75[_0x01f8('0x51')][_0x01f8('0x56')]=_0x474f75[_0x01f8('0x53')][_0x01f8('0x57')];return db[_0x01f8('0x2f')][_0x01f8('0x58')](_0x474f75['body'])[_0x01f8('0x28')](respondWithResult(_0x4d7b1b,0xc9))[_0x01f8('0x44')](handleError(_0x4d7b1b,null));};exports[_0x01f8('0x59')]=function(_0x2cc4a0,_0x3aa631,_0x5c68b1){return db[_0x01f8('0x2f')][_0x01f8('0x5a')]({'where':{'id':_0x2cc4a0['params']['id']},'raw':!![]})['then'](handleEntityNotFound(_0x3aa631,null))[_0x01f8('0x28')](function(_0x5d2700){if(_0x5d2700){return _0x3aa631[_0x01f8('0x59')](path['join'](config[_0x01f8('0x5b')],_0x01f8('0x5c'),_0x5d2700[_0x01f8('0x54')]));}})[_0x01f8('0x44')](handleError(_0x3aa631,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