Built motion from commit eddce310.|2.6.12
[motion2.git] / server / api / chatApplication / chatApplication.controller.js
index 7eea44f..529ac8e 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x1057=['reject','save','then','destroy','error','stack','name','send','show','model','keys','rawAttributes','filters','intersection','attributes','fields','length','includeAll','include','merge','options','ChatApplication','find','catch','update','body','params','eml-format','rimraf','request-promise','moment','mustache','util','path','sox','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply'];(function(_0x3be24d,_0x108075){var _0xb6fc04=function(_0x3b1e99){while(--_0x3b1e99){_0x3be24d['push'](_0x3be24d['shift']());}};_0xb6fc04(++_0x108075);}(_0x1057,0x147));var _0x7105=function(_0x4ec8d9,_0x2a0232){_0x4ec8d9=_0x4ec8d9-0x0;var _0x475d52=_0x1057[_0x4ec8d9];return _0x475d52;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x7105('0x0'));var rimraf=require(_0x7105('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x7105('0x2'));var moment=require(_0x7105('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x7105('0x4'));var util=require(_0x7105('0x5'));var path=require(_0x7105('0x6'));var sox=require(_0x7105('0x7'));var csv=require('to-csv');var ejs=require(_0x7105('0x8'));var fs=require('fs');var _=require(_0x7105('0x9'));var squel=require(_0x7105('0xa'));var crypto=require(_0x7105('0xb'));var jsforce=require(_0x7105('0xc'));var deskjs=require(_0x7105('0xd'));var toCsv=require('to-csv');var querystring=require(_0x7105('0xe'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x7105('0xf'));var qs=require(_0x7105('0x10'));var as=require(_0x7105('0x11'));var hardwareService=require(_0x7105('0x12'));var logger=require('../../config/logger')(_0x7105('0x13'));var utils=require('../../config/utils');var config=require(_0x7105('0x14'));var licenseUtil=require(_0x7105('0x15'));var db=require(_0x7105('0x16'))['db'];function respondWithStatusCode(_0x3aa151,_0x36362a){_0x36362a=_0x36362a||0xcc;return function(_0x4e3ae5){if(_0x4e3ae5){return _0x3aa151[_0x7105('0x17')](_0x36362a);}return _0x3aa151[_0x7105('0x18')](_0x36362a)[_0x7105('0x19')]();};}function respondWithResult(_0x228ae6,_0x3f531e){_0x3f531e=_0x3f531e||0xc8;return function(_0x1a7b81){if(_0x1a7b81){return _0x228ae6['status'](_0x3f531e)[_0x7105('0x1a')](_0x1a7b81);}};}function respondWithFilteredResult(_0x524864,_0x3acc74){return function(_0x38c68e){if(_0x38c68e){var _0x5285a4=_0x38c68e[_0x7105('0x1b')],_0x280b34=_0x3acc74[_0x7105('0x1c')],_0x2b4e97=_0x3acc74[_0x7105('0x1c')]+_0x3acc74[_0x7105('0x1d')],_0x2ca7a7;if(_0x2b4e97>=_0x5285a4){_0x2b4e97=_0x5285a4;_0x2ca7a7=0xc8;}else{_0x2ca7a7=0xce;}_0x524864[_0x7105('0x18')](_0x2ca7a7);return _0x524864[_0x7105('0x1e')](_0x7105('0x1f'),_0x280b34+'-'+_0x2b4e97+'/'+_0x5285a4)[_0x7105('0x1a')](_0x38c68e);}return null;};}function patchUpdates(_0x32662d){return function(_0x131c9c){try{jsonpatch[_0x7105('0x20')](_0x131c9c,_0x32662d,!![]);}catch(_0x10e9cb){return BPromise[_0x7105('0x21')](_0x10e9cb);}return _0x131c9c[_0x7105('0x22')]();};}function saveUpdates(_0x19666a,_0x46a46c){return function(_0x1bca1c){if(_0x1bca1c){return _0x1bca1c['update'](_0x19666a)[_0x7105('0x23')](function(_0x317ed1){return _0x317ed1;});}return null;};}function removeEntity(_0x37063e,_0x96dbfd){return function(_0x4692b7){if(_0x4692b7){return _0x4692b7[_0x7105('0x24')]()['then'](function(){_0x37063e['status'](0xcc)[_0x7105('0x19')]();});}};}function handleEntityNotFound(_0x2879a8,_0x1da260){return function(_0x3dd012){if(!_0x3dd012){_0x2879a8[_0x7105('0x17')](0x194);}return _0x3dd012;};}function handleError(_0x4b3f67,_0x435ef2){_0x435ef2=_0x435ef2||0x1f4;return function(_0x3e4a8f){logger[_0x7105('0x25')](_0x3e4a8f[_0x7105('0x26')]);if(_0x3e4a8f[_0x7105('0x27')]){delete _0x3e4a8f['name'];}_0x4b3f67[_0x7105('0x18')](_0x435ef2)[_0x7105('0x28')](_0x3e4a8f);};}exports[_0x7105('0x29')]=function(_0xe6e9c1,_0x1e6646){var _0x2ee087={'raw':!![],'where':{'id':_0xe6e9c1['params']['id']}},_0x179ba2={};_0x179ba2[_0x7105('0x2a')]=_[_0x7105('0x2b')](db['ChatApplication'][_0x7105('0x2c')]);_0x179ba2['query']=_[_0x7105('0x2b')](_0xe6e9c1['query']);_0x179ba2[_0x7105('0x2d')]=_[_0x7105('0x2e')](_0x179ba2['model'],_0x179ba2['query']);_0x2ee087[_0x7105('0x2f')]=_[_0x7105('0x2e')](_0x179ba2[_0x7105('0x2a')],qs[_0x7105('0x30')](_0xe6e9c1['query'][_0x7105('0x30')]));_0x2ee087['attributes']=_0x2ee087[_0x7105('0x2f')][_0x7105('0x31')]?_0x2ee087['attributes']:_0x179ba2[_0x7105('0x2a')];if(_0xe6e9c1['query'][_0x7105('0x32')]){_0x2ee087[_0x7105('0x33')]=[{'all':!![]}];}_0x2ee087=_[_0x7105('0x34')]({},_0x2ee087,_0xe6e9c1[_0x7105('0x35')]);return db[_0x7105('0x36')][_0x7105('0x37')](_0x2ee087)[_0x7105('0x23')](handleEntityNotFound(_0x1e6646,null))[_0x7105('0x23')](respondWithResult(_0x1e6646,null))[_0x7105('0x38')](handleError(_0x1e6646,null));};exports[_0x7105('0x39')]=function(_0x3b13f8,_0x49c575){if(_0x3b13f8[_0x7105('0x3a')]['id']){delete _0x3b13f8[_0x7105('0x3a')]['id'];}return db[_0x7105('0x36')][_0x7105('0x37')]({'where':{'id':_0x3b13f8[_0x7105('0x3b')]['id']}})[_0x7105('0x23')](handleEntityNotFound(_0x49c575,null))[_0x7105('0x23')](saveUpdates(_0x3b13f8[_0x7105('0x3a')],null))[_0x7105('0x23')](respondWithResult(_0x49c575,null))[_0x7105('0x38')](handleError(_0x49c575,null));};exports[_0x7105('0x24')]=function(_0xe182de,_0x3ed3cb){return db[_0x7105('0x36')]['find']({'where':{'id':_0xe182de[_0x7105('0x3b')]['id']}})[_0x7105('0x23')](handleEntityNotFound(_0x3ed3cb,null))[_0x7105('0x23')](removeEntity(_0x3ed3cb,null))[_0x7105('0x38')](handleError(_0x3ed3cb,null));};
\ No newline at end of file
+var _0x38d0=['bluebird','path','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','offset','set','apply','reject','save','then','destroy','error','stack','name','send','model','keys','query','filters','attributes','intersection','fields','length','includeAll','merge','options','ChatApplication','find','catch','update','body','params','rimraf','zip-dir','fast-json-patch','moment'];(function(_0x4342f0,_0x3009c8){var _0x5ce9f0=function(_0x576eed){while(--_0x576eed){_0x4342f0['push'](_0x4342f0['shift']());}};_0x5ce9f0(++_0x3009c8);}(_0x38d0,0x123));var _0x038d=function(_0x17b6e3,_0x4522ed){_0x17b6e3=_0x17b6e3-0x0;var _0x3906f3=_0x38d0[_0x17b6e3];return _0x3906f3;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x038d('0x0'));var zipdir=require(_0x038d('0x1'));var jsonpatch=require(_0x038d('0x2'));var rp=require('request-promise');var moment=require(_0x038d('0x3'));var BPromise=require(_0x038d('0x4'));var Mustache=require('mustache');var util=require('util');var path=require(_0x038d('0x5'));var sox=require('sox');var csv=require(_0x038d('0x6'));var ejs=require(_0x038d('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x038d('0x8'));var squel=require(_0x038d('0x9'));var crypto=require(_0x038d('0xa'));var jsforce=require(_0x038d('0xb'));var deskjs=require(_0x038d('0xc'));var toCsv=require(_0x038d('0x6'));var querystring=require(_0x038d('0xd'));var Papa=require(_0x038d('0xe'));var Redis=require(_0x038d('0xf'));var authService=require(_0x038d('0x10'));var qs=require(_0x038d('0x11'));var as=require(_0x038d('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x038d('0x13'))(_0x038d('0x14'));var utils=require(_0x038d('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x038d('0x16'));var db=require(_0x038d('0x17'))['db'];function respondWithStatusCode(_0x1be329,_0x225683){_0x225683=_0x225683||0xcc;return function(_0x12c34d){if(_0x12c34d){return _0x1be329[_0x038d('0x18')](_0x225683);}return _0x1be329[_0x038d('0x19')](_0x225683)[_0x038d('0x1a')]();};}function respondWithResult(_0x4311b8,_0x4e78d3){_0x4e78d3=_0x4e78d3||0xc8;return function(_0x5adcd5){if(_0x5adcd5){return _0x4311b8['status'](_0x4e78d3)[_0x038d('0x1b')](_0x5adcd5);}};}function respondWithFilteredResult(_0x3ab49a,_0x4c36ee){return function(_0x4b7bfb){if(_0x4b7bfb){var _0x4e4960=typeof _0x4c36ee['offset']===_0x038d('0x1c')&&typeof _0x4c36ee[_0x038d('0x1d')]===_0x038d('0x1c');var _0x2b5feb=_0x4b7bfb[_0x038d('0x1e')];var _0x42c17f=_0x4e4960?0x0:_0x4c36ee[_0x038d('0x1f')];var _0x40c307=_0x4e4960?_0x4b7bfb[_0x038d('0x1e')]:_0x4c36ee[_0x038d('0x1f')]+_0x4c36ee[_0x038d('0x1d')];var _0x21773e;if(_0x40c307>=_0x2b5feb){_0x40c307=_0x2b5feb;_0x21773e=0xc8;}else{_0x21773e=0xce;}_0x3ab49a[_0x038d('0x19')](_0x21773e);return _0x3ab49a[_0x038d('0x20')]('Content-Range',_0x42c17f+'-'+_0x40c307+'/'+_0x2b5feb)['json'](_0x4b7bfb);}return null;};}function patchUpdates(_0x42b6af){return function(_0x42ab21){try{jsonpatch[_0x038d('0x21')](_0x42ab21,_0x42b6af,!![]);}catch(_0x1a8efc){return BPromise[_0x038d('0x22')](_0x1a8efc);}return _0x42ab21[_0x038d('0x23')]();};}function saveUpdates(_0x40586e,_0x4eb93e){return function(_0x89c6f1){if(_0x89c6f1){return _0x89c6f1['update'](_0x40586e)[_0x038d('0x24')](function(_0x4eaaff){return _0x4eaaff;});}return null;};}function removeEntity(_0x5ea43b,_0x19e932){return function(_0x3611ff){if(_0x3611ff){return _0x3611ff[_0x038d('0x25')]()[_0x038d('0x24')](function(){_0x5ea43b[_0x038d('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x107d51,_0x3e1286){return function(_0x1dc3f3){if(!_0x1dc3f3){_0x107d51['sendStatus'](0x194);}return _0x1dc3f3;};}function handleError(_0x593d4a,_0x525908){_0x525908=_0x525908||0x1f4;return function(_0x4379d9){logger[_0x038d('0x26')](_0x4379d9[_0x038d('0x27')]);if(_0x4379d9[_0x038d('0x28')]){delete _0x4379d9[_0x038d('0x28')];}_0x593d4a[_0x038d('0x19')](_0x525908)[_0x038d('0x29')](_0x4379d9);};}exports['show']=function(_0x5044db,_0x2c0b46){var _0x1f7cdb={'raw':!![],'where':{'id':_0x5044db['params']['id']}},_0x33fa99={};_0x33fa99[_0x038d('0x2a')]=_[_0x038d('0x2b')](db['ChatApplication']['rawAttributes']);_0x33fa99[_0x038d('0x2c')]=_[_0x038d('0x2b')](_0x5044db[_0x038d('0x2c')]);_0x33fa99[_0x038d('0x2d')]=_['intersection'](_0x33fa99[_0x038d('0x2a')],_0x33fa99['query']);_0x1f7cdb[_0x038d('0x2e')]=_[_0x038d('0x2f')](_0x33fa99['model'],qs[_0x038d('0x30')](_0x5044db[_0x038d('0x2c')][_0x038d('0x30')]));_0x1f7cdb['attributes']=_0x1f7cdb[_0x038d('0x2e')][_0x038d('0x31')]?_0x1f7cdb['attributes']:_0x33fa99[_0x038d('0x2a')];if(_0x5044db[_0x038d('0x2c')][_0x038d('0x32')]){_0x1f7cdb['include']=[{'all':!![]}];}_0x1f7cdb=_[_0x038d('0x33')]({},_0x1f7cdb,_0x5044db[_0x038d('0x34')]);return db[_0x038d('0x35')][_0x038d('0x36')](_0x1f7cdb)['then'](handleEntityNotFound(_0x2c0b46,null))[_0x038d('0x24')](respondWithResult(_0x2c0b46,null))[_0x038d('0x37')](handleError(_0x2c0b46,null));};exports[_0x038d('0x38')]=function(_0x38dafe,_0x27da2b){if(_0x38dafe['body']['id']){delete _0x38dafe[_0x038d('0x39')]['id'];}return db[_0x038d('0x35')][_0x038d('0x36')]({'where':{'id':_0x38dafe[_0x038d('0x3a')]['id']}})['then'](handleEntityNotFound(_0x27da2b,null))[_0x038d('0x24')](saveUpdates(_0x38dafe[_0x038d('0x39')],null))[_0x038d('0x24')](respondWithResult(_0x27da2b,null))[_0x038d('0x37')](handleError(_0x27da2b,null));};exports['destroy']=function(_0x2cf043,_0x37f749){return db['ChatApplication'][_0x038d('0x36')]({'where':{'id':_0x2cf043['params']['id']}})[_0x038d('0x24')](handleEntityNotFound(_0x37f749,null))[_0x038d('0x24')](removeEntity(_0x37f749,null))['catch'](handleError(_0x37f749,null));};
\ No newline at end of file