Built motion from commit e0fa946e.|2.6.5
[motion2.git] / server / api / chatApplication / chatApplication.controller.js
index 43a4544..407a0ed 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x4de7=['intersection','fields','length','includeAll','include','options','then','catch','update','body','destroy','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','offset','undefined','limit','count','set','json','apply','sendStatus','error','stack','name','send','show','params','model','ChatApplication','rawAttributes','keys','query','filters','attributes'];(function(_0x23f3be,_0x24371e){var _0xc99531=function(_0x56e182){while(--_0x56e182){_0x23f3be['push'](_0x23f3be['shift']());}};_0xc99531(++_0x24371e);}(_0x4de7,0x1f3));var _0x74de=function(_0x349f77,_0x226846){_0x349f77=_0x349f77-0x0;var _0x466f19=_0x4de7[_0x349f77];return _0x466f19;};'use strict';var emlformat=require(_0x74de('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x74de('0x1'));var jsonpatch=require(_0x74de('0x2'));var rp=require(_0x74de('0x3'));var moment=require(_0x74de('0x4'));var BPromise=require(_0x74de('0x5'));var Mustache=require('mustache');var util=require(_0x74de('0x6'));var path=require(_0x74de('0x7'));var sox=require(_0x74de('0x8'));var csv=require('to-csv');var ejs=require(_0x74de('0x9'));var fs=require('fs');var fs_extra=require(_0x74de('0xa'));var _=require(_0x74de('0xb'));var squel=require(_0x74de('0xc'));var crypto=require(_0x74de('0xd'));var jsforce=require(_0x74de('0xe'));var deskjs=require(_0x74de('0xf'));var toCsv=require(_0x74de('0x10'));var querystring=require(_0x74de('0x11'));var Papa=require(_0x74de('0x12'));var Redis=require('ioredis');var authService=require(_0x74de('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0x74de('0x14'));var hardwareService=require(_0x74de('0x15'));var logger=require('../../config/logger')(_0x74de('0x16'));var utils=require(_0x74de('0x17'));var config=require(_0x74de('0x18'));var licenseUtil=require(_0x74de('0x19'));var db=require(_0x74de('0x1a'))['db'];function respondWithStatusCode(_0x11a446,_0x4ee614){_0x4ee614=_0x4ee614||0xcc;return function(_0x26f408){if(_0x26f408){return _0x11a446['sendStatus'](_0x4ee614);}return _0x11a446[_0x74de('0x1b')](_0x4ee614)[_0x74de('0x1c')]();};}function respondWithResult(_0x1c83b6,_0x4ecd59){_0x4ecd59=_0x4ecd59||0xc8;return function(_0x35da91){if(_0x35da91){return _0x1c83b6[_0x74de('0x1b')](_0x4ecd59)['json'](_0x35da91);}};}function respondWithFilteredResult(_0x14999b,_0x3d3fee){return function(_0x3dff38){if(_0x3dff38){var _0x431d99=typeof _0x3d3fee[_0x74de('0x1d')]===_0x74de('0x1e')&&typeof _0x3d3fee[_0x74de('0x1f')]==='undefined';var _0x5a371f=_0x3dff38[_0x74de('0x20')];var _0x337a19=_0x431d99?0x0:_0x3d3fee[_0x74de('0x1d')];var _0x89cc48=_0x431d99?_0x3dff38[_0x74de('0x20')]:_0x3d3fee[_0x74de('0x1d')]+_0x3d3fee['limit'];var _0x19f95d;if(_0x89cc48>=_0x5a371f){_0x89cc48=_0x5a371f;_0x19f95d=0xc8;}else{_0x19f95d=0xce;}_0x14999b[_0x74de('0x1b')](_0x19f95d);return _0x14999b[_0x74de('0x21')]('Content-Range',_0x337a19+'-'+_0x89cc48+'/'+_0x5a371f)[_0x74de('0x22')](_0x3dff38);}return null;};}function patchUpdates(_0x44b693){return function(_0x439578){try{jsonpatch[_0x74de('0x23')](_0x439578,_0x44b693,!![]);}catch(_0x56653d){return BPromise['reject'](_0x56653d);}return _0x439578['save']();};}function saveUpdates(_0x570ffb,_0x13c314){return function(_0x3f7a12){if(_0x3f7a12){return _0x3f7a12['update'](_0x570ffb)['then'](function(_0x23fb7f){return _0x23fb7f;});}return null;};}function removeEntity(_0x4032e1,_0x44cdc4){return function(_0x512047){if(_0x512047){return _0x512047['destroy']()['then'](function(){_0x4032e1['status'](0xcc)[_0x74de('0x1c')]();});}};}function handleEntityNotFound(_0x9a58bd,_0x36b4f8){return function(_0x3806e9){if(!_0x3806e9){_0x9a58bd[_0x74de('0x24')](0x194);}return _0x3806e9;};}function handleError(_0x1f1b2c,_0x37626b){_0x37626b=_0x37626b||0x1f4;return function(_0x3bb092){logger[_0x74de('0x25')](_0x3bb092[_0x74de('0x26')]);if(_0x3bb092[_0x74de('0x27')]){delete _0x3bb092[_0x74de('0x27')];}_0x1f1b2c[_0x74de('0x1b')](_0x37626b)[_0x74de('0x28')](_0x3bb092);};}exports[_0x74de('0x29')]=function(_0x40c352,_0x542e96){var _0x547d39={'raw':!![],'where':{'id':_0x40c352[_0x74de('0x2a')]['id']}},_0x1d3504={};_0x1d3504[_0x74de('0x2b')]=_['keys'](db[_0x74de('0x2c')][_0x74de('0x2d')]);_0x1d3504['query']=_[_0x74de('0x2e')](_0x40c352[_0x74de('0x2f')]);_0x1d3504[_0x74de('0x30')]=_['intersection'](_0x1d3504[_0x74de('0x2b')],_0x1d3504[_0x74de('0x2f')]);_0x547d39[_0x74de('0x31')]=_[_0x74de('0x32')](_0x1d3504[_0x74de('0x2b')],qs[_0x74de('0x33')](_0x40c352[_0x74de('0x2f')]['fields']));_0x547d39['attributes']=_0x547d39[_0x74de('0x31')][_0x74de('0x34')]?_0x547d39[_0x74de('0x31')]:_0x1d3504[_0x74de('0x2b')];if(_0x40c352[_0x74de('0x2f')][_0x74de('0x35')]){_0x547d39[_0x74de('0x36')]=[{'all':!![]}];}_0x547d39=_['merge']({},_0x547d39,_0x40c352[_0x74de('0x37')]);return db['ChatApplication']['find'](_0x547d39)[_0x74de('0x38')](handleEntityNotFound(_0x542e96,null))['then'](respondWithResult(_0x542e96,null))[_0x74de('0x39')](handleError(_0x542e96,null));};exports[_0x74de('0x3a')]=function(_0x3d3798,_0x4be009){if(_0x3d3798[_0x74de('0x3b')]['id']){delete _0x3d3798[_0x74de('0x3b')]['id'];}return db['ChatApplication']['find']({'where':{'id':_0x3d3798[_0x74de('0x2a')]['id']}})[_0x74de('0x38')](handleEntityNotFound(_0x4be009,null))['then'](saveUpdates(_0x3d3798[_0x74de('0x3b')],null))[_0x74de('0x38')](respondWithResult(_0x4be009,null))['catch'](handleError(_0x4be009,null));};exports[_0x74de('0x3c')]=function(_0x1a41b5,_0x13ae0d){return db[_0x74de('0x2c')]['find']({'where':{'id':_0x1a41b5[_0x74de('0x2a')]['id']}})['then'](handleEntityNotFound(_0x13ae0d,null))[_0x74de('0x38')](removeEntity(_0x13ae0d,null))[_0x74de('0x39')](handleError(_0x13ae0d,null));};
\ No newline at end of file
+var _0x2504=['zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','crypto','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','then','destroy','error','name','send','show','params','keys','query','filters','model','intersection','fields','attributes','length','includeAll','include','merge','options','ChatApplication','catch','update','body','eml-format','rimraf'];(function(_0x593983,_0x5ac096){var _0x260469=function(_0x2011a7){while(--_0x2011a7){_0x593983['push'](_0x593983['shift']());}};_0x260469(++_0x5ac096);}(_0x2504,0xee));var _0x4250=function(_0x21a87d,_0x2469e1){_0x21a87d=_0x21a87d-0x0;var _0x549694=_0x2504[_0x21a87d];return _0x549694;};'use strict';var emlformat=require(_0x4250('0x0'));var rimraf=require(_0x4250('0x1'));var zipdir=require(_0x4250('0x2'));var jsonpatch=require(_0x4250('0x3'));var rp=require(_0x4250('0x4'));var moment=require(_0x4250('0x5'));var BPromise=require(_0x4250('0x6'));var Mustache=require(_0x4250('0x7'));var util=require(_0x4250('0x8'));var path=require(_0x4250('0x9'));var sox=require(_0x4250('0xa'));var csv=require(_0x4250('0xb'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x4250('0xc'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x4250('0xd'));var jsforce=require(_0x4250('0xe'));var deskjs=require(_0x4250('0xf'));var toCsv=require(_0x4250('0xb'));var querystring=require(_0x4250('0x10'));var Papa=require('papaparse');var Redis=require(_0x4250('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x4250('0x12'));var as=require(_0x4250('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x4250('0x14'))('api');var utils=require('../../config/utils');var config=require(_0x4250('0x15'));var licenseUtil=require(_0x4250('0x16'));var db=require(_0x4250('0x17'))['db'];function respondWithStatusCode(_0x3c1e7e,_0x2a496b){_0x2a496b=_0x2a496b||0xcc;return function(_0x5d62a0){if(_0x5d62a0){return _0x3c1e7e[_0x4250('0x18')](_0x2a496b);}return _0x3c1e7e[_0x4250('0x19')](_0x2a496b)[_0x4250('0x1a')]();};}function respondWithResult(_0x2c8a75,_0xfa4d8a){_0xfa4d8a=_0xfa4d8a||0xc8;return function(_0x33f317){if(_0x33f317){return _0x2c8a75['status'](_0xfa4d8a)[_0x4250('0x1b')](_0x33f317);}};}function respondWithFilteredResult(_0x46ba15,_0x1b0c66){return function(_0x3cff02){if(_0x3cff02){var _0x2979cd=typeof _0x1b0c66[_0x4250('0x1c')]===_0x4250('0x1d')&&typeof _0x1b0c66['limit']===_0x4250('0x1d');var _0x35d232=_0x3cff02[_0x4250('0x1e')];var _0x17a8a9=_0x2979cd?0x0:_0x1b0c66[_0x4250('0x1c')];var _0x30e48c=_0x2979cd?_0x3cff02[_0x4250('0x1e')]:_0x1b0c66['offset']+_0x1b0c66[_0x4250('0x1f')];var _0x4f0154;if(_0x30e48c>=_0x35d232){_0x30e48c=_0x35d232;_0x4f0154=0xc8;}else{_0x4f0154=0xce;}_0x46ba15['status'](_0x4f0154);return _0x46ba15[_0x4250('0x20')](_0x4250('0x21'),_0x17a8a9+'-'+_0x30e48c+'/'+_0x35d232)[_0x4250('0x1b')](_0x3cff02);}return null;};}function patchUpdates(_0x42c331){return function(_0x242cf1){try{jsonpatch[_0x4250('0x22')](_0x242cf1,_0x42c331,!![]);}catch(_0x1ba772){return BPromise[_0x4250('0x23')](_0x1ba772);}return _0x242cf1[_0x4250('0x24')]();};}function saveUpdates(_0x3818c0,_0x728862){return function(_0x30e2ae){if(_0x30e2ae){return _0x30e2ae['update'](_0x3818c0)[_0x4250('0x25')](function(_0x171df4){return _0x171df4;});}return null;};}function removeEntity(_0x1feb98,_0x523053){return function(_0x5d1a74){if(_0x5d1a74){return _0x5d1a74[_0x4250('0x26')]()[_0x4250('0x25')](function(){_0x1feb98[_0x4250('0x19')](0xcc)[_0x4250('0x1a')]();});}};}function handleEntityNotFound(_0x328ffb,_0x5cb4fe){return function(_0x431d01){if(!_0x431d01){_0x328ffb[_0x4250('0x18')](0x194);}return _0x431d01;};}function handleError(_0x3f40dd,_0x559d06){_0x559d06=_0x559d06||0x1f4;return function(_0x5b155e){logger[_0x4250('0x27')](_0x5b155e['stack']);if(_0x5b155e[_0x4250('0x28')]){delete _0x5b155e[_0x4250('0x28')];}_0x3f40dd[_0x4250('0x19')](_0x559d06)[_0x4250('0x29')](_0x5b155e);};}exports[_0x4250('0x2a')]=function(_0x501c5f,_0x395926){var _0x11ca22={'raw':!![],'where':{'id':_0x501c5f[_0x4250('0x2b')]['id']}},_0x48252b={};_0x48252b['model']=_[_0x4250('0x2c')](db['ChatApplication']['rawAttributes']);_0x48252b[_0x4250('0x2d')]=_['keys'](_0x501c5f[_0x4250('0x2d')]);_0x48252b[_0x4250('0x2e')]=_['intersection'](_0x48252b[_0x4250('0x2f')],_0x48252b[_0x4250('0x2d')]);_0x11ca22['attributes']=_[_0x4250('0x30')](_0x48252b[_0x4250('0x2f')],qs['fields'](_0x501c5f[_0x4250('0x2d')][_0x4250('0x31')]));_0x11ca22[_0x4250('0x32')]=_0x11ca22[_0x4250('0x32')][_0x4250('0x33')]?_0x11ca22[_0x4250('0x32')]:_0x48252b[_0x4250('0x2f')];if(_0x501c5f[_0x4250('0x2d')][_0x4250('0x34')]){_0x11ca22[_0x4250('0x35')]=[{'all':!![]}];}_0x11ca22=_[_0x4250('0x36')]({},_0x11ca22,_0x501c5f[_0x4250('0x37')]);return db[_0x4250('0x38')]['find'](_0x11ca22)[_0x4250('0x25')](handleEntityNotFound(_0x395926,null))['then'](respondWithResult(_0x395926,null))[_0x4250('0x39')](handleError(_0x395926,null));};exports[_0x4250('0x3a')]=function(_0x5c30fc,_0xf14c4e){if(_0x5c30fc[_0x4250('0x3b')]['id']){delete _0x5c30fc[_0x4250('0x3b')]['id'];}return db[_0x4250('0x38')]['find']({'where':{'id':_0x5c30fc['params']['id']}})['then'](handleEntityNotFound(_0xf14c4e,null))[_0x4250('0x25')](saveUpdates(_0x5c30fc[_0x4250('0x3b')],null))['then'](respondWithResult(_0xf14c4e,null))[_0x4250('0x39')](handleError(_0xf14c4e,null));};exports[_0x4250('0x26')]=function(_0x3f2ef7,_0x13d997){return db[_0x4250('0x38')]['find']({'where':{'id':_0x3f2ef7[_0x4250('0x2b')]['id']}})['then'](handleEntityNotFound(_0x13d997,null))['then'](removeEntity(_0x13d997,null))[_0x4250('0x39')](handleError(_0x13d997,null));};
\ No newline at end of file