Built motion from commit (unavailable).|2.5.27
[motion2.git] / server / api / chatApplication / chatApplication.controller.js
index 52d4932..c2c7c10 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xcbf5=['destroy','error','stack','name','send','show','params','keys','rawAttributes','query','filters','intersection','model','attributes','fields','includeAll','include','ChatApplication','find','catch','body','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','squel','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','apply','reject','save','update','then'];(function(_0x317fba,_0x5b5b38){var _0x279bc7=function(_0xd4e6d9){while(--_0xd4e6d9){_0x317fba['push'](_0x317fba['shift']());}};_0x279bc7(++_0x5b5b38);}(_0xcbf5,0x1e5));var _0x5cbf=function(_0xf34da4,_0x30c006){_0xf34da4=_0xf34da4-0x0;var _0xc8b3ef=_0xcbf5[_0xf34da4];return _0xc8b3ef;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x5cbf('0x0'));var rimraf=require(_0x5cbf('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x5cbf('0x2'));var rp=require(_0x5cbf('0x3'));var moment=require(_0x5cbf('0x4'));var BPromise=require(_0x5cbf('0x5'));var Mustache=require(_0x5cbf('0x6'));var util=require(_0x5cbf('0x7'));var path=require(_0x5cbf('0x8'));var sox=require(_0x5cbf('0x9'));var csv=require(_0x5cbf('0xa'));var ejs=require(_0x5cbf('0xb'));var fs=require('fs');var _=require('lodash');var squel=require(_0x5cbf('0xc'));var crypto=require('crypto');var jsforce=require(_0x5cbf('0xd'));var deskjs=require(_0x5cbf('0xe'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x5cbf('0xf'));var Redis=require(_0x5cbf('0x10'));var authService=require(_0x5cbf('0x11'));var qs=require(_0x5cbf('0x12'));var as=require(_0x5cbf('0x13'));var hardwareService=require(_0x5cbf('0x14'));var logger=require('../../config/logger')('api');var utils=require(_0x5cbf('0x15'));var config=require(_0x5cbf('0x16'));var db=require(_0x5cbf('0x17'))['db'];function respondWithStatusCode(_0x16e151,_0x5ad170){_0x5ad170=_0x5ad170||0xcc;return function(_0x5775bf){if(_0x5775bf){return _0x16e151[_0x5cbf('0x18')](_0x5ad170);}return _0x16e151[_0x5cbf('0x19')](_0x5ad170)[_0x5cbf('0x1a')]();};}function respondWithResult(_0x1963b1,_0x11268d){_0x11268d=_0x11268d||0xc8;return function(_0x135169){if(_0x135169){return _0x1963b1['status'](_0x11268d)[_0x5cbf('0x1b')](_0x135169);}};}function respondWithFilteredResult(_0x4e4f55,_0x1141ae){return function(_0x404f19){if(_0x404f19){var _0x10a59f=_0x404f19[_0x5cbf('0x1c')],_0x277802=_0x1141ae[_0x5cbf('0x1d')],_0x275508=_0x1141ae[_0x5cbf('0x1d')]+_0x1141ae[_0x5cbf('0x1e')],_0x524093;if(_0x275508>=_0x10a59f){_0x275508=_0x10a59f;_0x524093=0xc8;}else{_0x524093=0xce;}_0x4e4f55['status'](_0x524093);return _0x4e4f55[_0x5cbf('0x1f')]('Content-Range',_0x277802+'-'+_0x275508+'/'+_0x10a59f)[_0x5cbf('0x1b')](_0x404f19);}return null;};}function patchUpdates(_0x1a5ea2){return function(_0xab5cf6){try{jsonpatch[_0x5cbf('0x20')](_0xab5cf6,_0x1a5ea2,!![]);}catch(_0x285ad0){return BPromise[_0x5cbf('0x21')](_0x285ad0);}return _0xab5cf6[_0x5cbf('0x22')]();};}function saveUpdates(_0x47616c,_0x4a7c34){return function(_0x5ea5b7){if(_0x5ea5b7){return _0x5ea5b7[_0x5cbf('0x23')](_0x47616c)[_0x5cbf('0x24')](function(_0x31be2c){return _0x31be2c;});}return null;};}function removeEntity(_0x355d26,_0x3a978c){return function(_0x565d00){if(_0x565d00){return _0x565d00[_0x5cbf('0x25')]()['then'](function(){_0x355d26['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x1f604c,_0x474aa6){return function(_0x31358f){if(!_0x31358f){_0x1f604c[_0x5cbf('0x18')](0x194);}return _0x31358f;};}function handleError(_0x5bf1e9,_0x5dcde5){_0x5dcde5=_0x5dcde5||0x1f4;return function(_0x2741ae){logger[_0x5cbf('0x26')](_0x2741ae[_0x5cbf('0x27')]);if(_0x2741ae['name']){delete _0x2741ae[_0x5cbf('0x28')];}_0x5bf1e9[_0x5cbf('0x19')](_0x5dcde5)[_0x5cbf('0x29')](_0x2741ae);};}exports[_0x5cbf('0x2a')]=function(_0x528fea,_0x5d9b4e){var _0x33cb9c={'raw':!![],'where':{'id':_0x528fea[_0x5cbf('0x2b')]['id']}},_0xe84a17={};_0xe84a17['model']=_[_0x5cbf('0x2c')](db['ChatApplication'][_0x5cbf('0x2d')]);_0xe84a17['query']=_[_0x5cbf('0x2c')](_0x528fea[_0x5cbf('0x2e')]);_0xe84a17[_0x5cbf('0x2f')]=_[_0x5cbf('0x30')](_0xe84a17[_0x5cbf('0x31')],_0xe84a17[_0x5cbf('0x2e')]);_0x33cb9c[_0x5cbf('0x32')]=_[_0x5cbf('0x30')](_0xe84a17[_0x5cbf('0x31')],qs[_0x5cbf('0x33')](_0x528fea[_0x5cbf('0x2e')][_0x5cbf('0x33')]));_0x33cb9c[_0x5cbf('0x32')]=_0x33cb9c[_0x5cbf('0x32')]['length']?_0x33cb9c['attributes']:_0xe84a17[_0x5cbf('0x31')];if(_0x528fea[_0x5cbf('0x2e')][_0x5cbf('0x34')]){_0x33cb9c[_0x5cbf('0x35')]=[{'all':!![]}];}_0x33cb9c=_['merge']({},_0x33cb9c,_0x528fea['options']);return db[_0x5cbf('0x36')][_0x5cbf('0x37')](_0x33cb9c)[_0x5cbf('0x24')](handleEntityNotFound(_0x5d9b4e,null))['then'](respondWithResult(_0x5d9b4e,null))[_0x5cbf('0x38')](handleError(_0x5d9b4e,null));};exports[_0x5cbf('0x23')]=function(_0x44376c,_0x4dbd6b){if(_0x44376c[_0x5cbf('0x39')]['id']){delete _0x44376c[_0x5cbf('0x39')]['id'];}return db[_0x5cbf('0x36')][_0x5cbf('0x37')]({'where':{'id':_0x44376c[_0x5cbf('0x2b')]['id']}})['then'](handleEntityNotFound(_0x4dbd6b,null))[_0x5cbf('0x24')](saveUpdates(_0x44376c[_0x5cbf('0x39')],null))['then'](respondWithResult(_0x4dbd6b,null))[_0x5cbf('0x38')](handleError(_0x4dbd6b,null));};exports[_0x5cbf('0x25')]=function(_0x1c1148,_0x57aa34){return db[_0x5cbf('0x36')][_0x5cbf('0x37')]({'where':{'id':_0x1c1148[_0x5cbf('0x2b')]['id']}})['then'](handleEntityNotFound(_0x57aa34,null))[_0x5cbf('0x24')](removeEntity(_0x57aa34,null))[_0x5cbf('0x38')](handleError(_0x57aa34,null));};
\ No newline at end of file
+var _0x8923=['to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','count','offset','limit','set','Content-Range','json','apply','reject','save','update','then','destroy','end','error','stack','name','send','show','params','model','keys','ChatApplication','rawAttributes','query','intersection','attributes','length','includeAll','include','options','find','catch','body','rimraf','zip-dir','fast-json-patch','moment','mustache','util','path','sox'];(function(_0x3fd455,_0x1f7c5b){var _0x1c259f=function(_0x2da88a){while(--_0x2da88a){_0x3fd455['push'](_0x3fd455['shift']());}};_0x1c259f(++_0x1f7c5b);}(_0x8923,0x70));var _0x3892=function(_0x517eb1,_0xa0759f){_0x517eb1=_0x517eb1-0x0;var _0x59e6d0=_0x8923[_0x517eb1];return _0x59e6d0;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x3892('0x0'));var zipdir=require(_0x3892('0x1'));var jsonpatch=require(_0x3892('0x2'));var rp=require('request-promise');var moment=require(_0x3892('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x3892('0x4'));var util=require(_0x3892('0x5'));var path=require(_0x3892('0x6'));var sox=require(_0x3892('0x7'));var csv=require(_0x3892('0x8'));var ejs=require(_0x3892('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x3892('0xa'));var squel=require(_0x3892('0xb'));var crypto=require(_0x3892('0xc'));var jsforce=require(_0x3892('0xd'));var deskjs=require(_0x3892('0xe'));var toCsv=require(_0x3892('0x8'));var querystring=require(_0x3892('0xf'));var Papa=require(_0x3892('0x10'));var Redis=require('ioredis');var authService=require(_0x3892('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x3892('0x12'));var hardwareService=require(_0x3892('0x13'));var logger=require(_0x3892('0x14'))(_0x3892('0x15'));var utils=require(_0x3892('0x16'));var config=require(_0x3892('0x17'));var licenseUtil=require(_0x3892('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x59835e,_0x2b0c5f){_0x2b0c5f=_0x2b0c5f||0xcc;return function(_0x3c6c57){if(_0x3c6c57){return _0x59835e[_0x3892('0x19')](_0x2b0c5f);}return _0x59835e[_0x3892('0x1a')](_0x2b0c5f)['end']();};}function respondWithResult(_0x49fffb,_0x1cbb1d){_0x1cbb1d=_0x1cbb1d||0xc8;return function(_0xf31ff7){if(_0xf31ff7){return _0x49fffb[_0x3892('0x1a')](_0x1cbb1d)['json'](_0xf31ff7);}};}function respondWithFilteredResult(_0xbc0d29,_0x11169f){return function(_0x508cfc){if(_0x508cfc){var _0x59ff29=_0x508cfc[_0x3892('0x1b')],_0x226e14=_0x11169f['offset'],_0x15ab22=_0x11169f[_0x3892('0x1c')]+_0x11169f[_0x3892('0x1d')],_0x3a73c7;if(_0x15ab22>=_0x59ff29){_0x15ab22=_0x59ff29;_0x3a73c7=0xc8;}else{_0x3a73c7=0xce;}_0xbc0d29[_0x3892('0x1a')](_0x3a73c7);return _0xbc0d29[_0x3892('0x1e')](_0x3892('0x1f'),_0x226e14+'-'+_0x15ab22+'/'+_0x59ff29)[_0x3892('0x20')](_0x508cfc);}return null;};}function patchUpdates(_0x75fb6d){return function(_0x1dc92a){try{jsonpatch[_0x3892('0x21')](_0x1dc92a,_0x75fb6d,!![]);}catch(_0x1258ed){return BPromise[_0x3892('0x22')](_0x1258ed);}return _0x1dc92a[_0x3892('0x23')]();};}function saveUpdates(_0x450730,_0x5a78fb){return function(_0x5b042d){if(_0x5b042d){return _0x5b042d[_0x3892('0x24')](_0x450730)[_0x3892('0x25')](function(_0x5ae33b){return _0x5ae33b;});}return null;};}function removeEntity(_0x4d66dc,_0x4faa17){return function(_0x24f5dc){if(_0x24f5dc){return _0x24f5dc[_0x3892('0x26')]()['then'](function(){_0x4d66dc[_0x3892('0x1a')](0xcc)[_0x3892('0x27')]();});}};}function handleEntityNotFound(_0x54ca10,_0x3890e2){return function(_0xde04cd){if(!_0xde04cd){_0x54ca10[_0x3892('0x19')](0x194);}return _0xde04cd;};}function handleError(_0x46ec1e,_0x550688){_0x550688=_0x550688||0x1f4;return function(_0x6e3571){logger[_0x3892('0x28')](_0x6e3571[_0x3892('0x29')]);if(_0x6e3571['name']){delete _0x6e3571[_0x3892('0x2a')];}_0x46ec1e[_0x3892('0x1a')](_0x550688)[_0x3892('0x2b')](_0x6e3571);};}exports[_0x3892('0x2c')]=function(_0x50d916,_0x3b8338){var _0x37066a={'raw':!![],'where':{'id':_0x50d916[_0x3892('0x2d')]['id']}},_0xd0f480={};_0xd0f480[_0x3892('0x2e')]=_[_0x3892('0x2f')](db[_0x3892('0x30')][_0x3892('0x31')]);_0xd0f480[_0x3892('0x32')]=_['keys'](_0x50d916[_0x3892('0x32')]);_0xd0f480['filters']=_['intersection'](_0xd0f480[_0x3892('0x2e')],_0xd0f480[_0x3892('0x32')]);_0x37066a['attributes']=_[_0x3892('0x33')](_0xd0f480[_0x3892('0x2e')],qs['fields'](_0x50d916[_0x3892('0x32')]['fields']));_0x37066a[_0x3892('0x34')]=_0x37066a['attributes'][_0x3892('0x35')]?_0x37066a['attributes']:_0xd0f480[_0x3892('0x2e')];if(_0x50d916['query'][_0x3892('0x36')]){_0x37066a[_0x3892('0x37')]=[{'all':!![]}];}_0x37066a=_['merge']({},_0x37066a,_0x50d916[_0x3892('0x38')]);return db['ChatApplication'][_0x3892('0x39')](_0x37066a)['then'](handleEntityNotFound(_0x3b8338,null))[_0x3892('0x25')](respondWithResult(_0x3b8338,null))[_0x3892('0x3a')](handleError(_0x3b8338,null));};exports['update']=function(_0x36f720,_0x4f62a4){if(_0x36f720[_0x3892('0x3b')]['id']){delete _0x36f720[_0x3892('0x3b')]['id'];}return db['ChatApplication'][_0x3892('0x39')]({'where':{'id':_0x36f720[_0x3892('0x2d')]['id']}})['then'](handleEntityNotFound(_0x4f62a4,null))['then'](saveUpdates(_0x36f720[_0x3892('0x3b')],null))[_0x3892('0x25')](respondWithResult(_0x4f62a4,null))[_0x3892('0x3a')](handleError(_0x4f62a4,null));};exports[_0x3892('0x26')]=function(_0x276e9a,_0x1069ed){return db['ChatApplication'][_0x3892('0x39')]({'where':{'id':_0x276e9a[_0x3892('0x2d')]['id']}})['then'](handleEntityNotFound(_0x1069ed,null))[_0x3892('0x25')](removeEntity(_0x1069ed,null))['catch'](handleError(_0x1069ed,null));};
\ No newline at end of file