Built motion from commit e0fa946e.|2.6.5
[motion2.git] / server / api / chatApplication / chatApplication.controller.js
index e7e1ea6..407a0ed 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xeb36=['../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','set','Content-Range','apply','reject','save','then','destroy','error','name','send','show','model','keys','ChatApplication','query','intersection','fields','includeAll','include','merge','catch','update','body','params','find','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis'];(function(_0x9731b4,_0x26aac3){var _0x3d7a66=function(_0x4be24c){while(--_0x4be24c){_0x9731b4['push'](_0x9731b4['shift']());}};_0x3d7a66(++_0x26aac3);}(_0xeb36,0x182));var _0x6eb3=function(_0xffa1a3,_0x24bbfd){_0xffa1a3=_0xffa1a3-0x0;var _0x2eaf16=_0xeb36[_0xffa1a3];return _0x2eaf16;};'use strict';var pdf=require(_0x6eb3('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x6eb3('0x1'));var zipdir=require(_0x6eb3('0x2'));var jsonpatch=require(_0x6eb3('0x3'));var rp=require(_0x6eb3('0x4'));var moment=require(_0x6eb3('0x5'));var BPromise=require(_0x6eb3('0x6'));var Mustache=require(_0x6eb3('0x7'));var util=require('util');var path=require(_0x6eb3('0x8'));var sox=require(_0x6eb3('0x9'));var csv=require(_0x6eb3('0xa'));var ejs=require(_0x6eb3('0xb'));var fs=require('fs');var _=require(_0x6eb3('0xc'));var squel=require(_0x6eb3('0xd'));var crypto=require(_0x6eb3('0xe'));var jsforce=require(_0x6eb3('0xf'));var deskjs=require(_0x6eb3('0x10'));var toCsv=require(_0x6eb3('0xa'));var querystring=require(_0x6eb3('0x11'));var Papa=require(_0x6eb3('0x12'));var Redis=require(_0x6eb3('0x13'));var authService=require(_0x6eb3('0x14'));var qs=require(_0x6eb3('0x15'));var as=require(_0x6eb3('0x16'));var hardwareService=require(_0x6eb3('0x17'));var logger=require('../../config/logger')(_0x6eb3('0x18'));var utils=require(_0x6eb3('0x19'));var config=require(_0x6eb3('0x1a'));var db=require(_0x6eb3('0x1b'))['db'];function respondWithStatusCode(_0x14ad1f,_0x4f09b3){_0x4f09b3=_0x4f09b3||0xcc;return function(_0x1b30ac){if(_0x1b30ac){return _0x14ad1f[_0x6eb3('0x1c')](_0x4f09b3);}return _0x14ad1f[_0x6eb3('0x1d')](_0x4f09b3)[_0x6eb3('0x1e')]();};}function respondWithResult(_0x3d0316,_0x3ed747){_0x3ed747=_0x3ed747||0xc8;return function(_0x520a1d){if(_0x520a1d){return _0x3d0316['status'](_0x3ed747)[_0x6eb3('0x1f')](_0x520a1d);}};}function respondWithFilteredResult(_0x4c2912,_0x3bb8d0){return function(_0x4326c1){if(_0x4326c1){var _0x35d665=_0x4326c1['count'],_0x563f18=_0x3bb8d0[_0x6eb3('0x20')],_0x138be7=_0x3bb8d0[_0x6eb3('0x20')]+_0x3bb8d0['limit'],_0x181ecf;if(_0x138be7>=_0x35d665){_0x138be7=_0x35d665;_0x181ecf=0xc8;}else{_0x181ecf=0xce;}_0x4c2912[_0x6eb3('0x1d')](_0x181ecf);return _0x4c2912[_0x6eb3('0x21')](_0x6eb3('0x22'),_0x563f18+'-'+_0x138be7+'/'+_0x35d665)['json'](_0x4326c1);}return null;};}function patchUpdates(_0x2cbf85){return function(_0x30e69c){try{jsonpatch[_0x6eb3('0x23')](_0x30e69c,_0x2cbf85,!![]);}catch(_0x4d800e){return BPromise[_0x6eb3('0x24')](_0x4d800e);}return _0x30e69c[_0x6eb3('0x25')]();};}function saveUpdates(_0x3a940e,_0x33aa9e){return function(_0x259d1d){if(_0x259d1d){return _0x259d1d['update'](_0x3a940e)[_0x6eb3('0x26')](function(_0x4a1890){return _0x4a1890;});}return null;};}function removeEntity(_0x4c6c12,_0x3c6c7c){return function(_0x1bb645){if(_0x1bb645){return _0x1bb645[_0x6eb3('0x27')]()[_0x6eb3('0x26')](function(){_0x4c6c12[_0x6eb3('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3dedf0,_0x4ed2b2){return function(_0x5515de){if(!_0x5515de){_0x3dedf0['sendStatus'](0x194);}return _0x5515de;};}function handleError(_0x4f8a4b,_0x5e36a2){_0x5e36a2=_0x5e36a2||0x1f4;return function(_0x4963f6){logger[_0x6eb3('0x28')](_0x4963f6['stack']);if(_0x4963f6[_0x6eb3('0x29')]){delete _0x4963f6[_0x6eb3('0x29')];}_0x4f8a4b[_0x6eb3('0x1d')](_0x5e36a2)[_0x6eb3('0x2a')](_0x4963f6);};}exports[_0x6eb3('0x2b')]=function(_0x4128e0,_0x454ed0){var _0x3ad878={'raw':!![],'where':{'id':_0x4128e0['params']['id']}},_0x49ac3f={};_0x49ac3f[_0x6eb3('0x2c')]=_[_0x6eb3('0x2d')](db[_0x6eb3('0x2e')]['rawAttributes']);_0x49ac3f['query']=_['keys'](_0x4128e0[_0x6eb3('0x2f')]);_0x49ac3f['filters']=_[_0x6eb3('0x30')](_0x49ac3f[_0x6eb3('0x2c')],_0x49ac3f['query']);_0x3ad878['attributes']=_[_0x6eb3('0x30')](_0x49ac3f[_0x6eb3('0x2c')],qs['fields'](_0x4128e0[_0x6eb3('0x2f')][_0x6eb3('0x31')]));_0x3ad878['attributes']=_0x3ad878['attributes']['length']?_0x3ad878['attributes']:_0x49ac3f[_0x6eb3('0x2c')];if(_0x4128e0['query'][_0x6eb3('0x32')]){_0x3ad878[_0x6eb3('0x33')]=[{'all':!![]}];}_0x3ad878=_[_0x6eb3('0x34')]({},_0x3ad878,_0x4128e0['options']);return db[_0x6eb3('0x2e')]['find'](_0x3ad878)[_0x6eb3('0x26')](handleEntityNotFound(_0x454ed0,null))['then'](respondWithResult(_0x454ed0,null))[_0x6eb3('0x35')](handleError(_0x454ed0,null));};exports[_0x6eb3('0x36')]=function(_0x386279,_0x47c394){if(_0x386279[_0x6eb3('0x37')]['id']){delete _0x386279[_0x6eb3('0x37')]['id'];}return db[_0x6eb3('0x2e')]['find']({'where':{'id':_0x386279[_0x6eb3('0x38')]['id']}})['then'](handleEntityNotFound(_0x47c394,null))['then'](saveUpdates(_0x386279['body'],null))[_0x6eb3('0x26')](respondWithResult(_0x47c394,null))['catch'](handleError(_0x47c394,null));};exports['destroy']=function(_0x4fff9e,_0x3962f3){return db[_0x6eb3('0x2e')][_0x6eb3('0x39')]({'where':{'id':_0x4fff9e['params']['id']}})['then'](handleEntityNotFound(_0x3962f3,null))[_0x6eb3('0x26')](removeEntity(_0x3962f3,null))[_0x6eb3('0x35')](handleError(_0x3962f3,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