Built motion from commit da617fac.|2.6.6
[motion2.git] / server / api / chatApplication / chatApplication.controller.js
index 76dca70..924deef 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xb30e=['filters','attributes','intersection','fields','include','merge','options','find','catch','body','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','crypto','jsforce','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/environment','../../mysqldb','status','end','offset','limit','set','Content-Range','json','reject','save','update','then','sendStatus','error','name','send','show','params','model','keys','ChatApplication','rawAttributes','query'];(function(_0x2fc8a7,_0x227128){var _0x14b454=function(_0xa2a066){while(--_0xa2a066){_0x2fc8a7['push'](_0x2fc8a7['shift']());}};_0x14b454(++_0x227128);}(_0xb30e,0x17d));var _0xeb30=function(_0x39eaa0,_0x2cea62){_0x39eaa0=_0x39eaa0-0x0;var _0x2402c5=_0xb30e[_0x39eaa0];return _0x2402c5;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xeb30('0x0'));var rimraf=require(_0xeb30('0x1'));var zipdir=require(_0xeb30('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xeb30('0x3'));var moment=require('moment');var BPromise=require(_0xeb30('0x4'));var Mustache=require(_0xeb30('0x5'));var util=require(_0xeb30('0x6'));var path=require(_0xeb30('0x7'));var sox=require(_0xeb30('0x8'));var csv=require(_0xeb30('0x9'));var ejs=require(_0xeb30('0xa'));var fs=require('fs');var _=require(_0xeb30('0xb'));var squel=require('squel');var crypto=require(_0xeb30('0xc'));var jsforce=require(_0xeb30('0xd'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xeb30('0xe'));var Papa=require(_0xeb30('0xf'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xeb30('0x10'));var as=require(_0xeb30('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xeb30('0x12'));var utils=require('../../config/utils');var config=require(_0xeb30('0x13'));var licenseUtil=require('../../config/license/util');var db=require(_0xeb30('0x14'))['db'];function respondWithStatusCode(_0x36f9a0,_0x10bfdb){_0x10bfdb=_0x10bfdb||0xcc;return function(_0x156b92){if(_0x156b92){return _0x36f9a0['sendStatus'](_0x10bfdb);}return _0x36f9a0[_0xeb30('0x15')](_0x10bfdb)[_0xeb30('0x16')]();};}function respondWithResult(_0x20326e,_0x4ac690){_0x4ac690=_0x4ac690||0xc8;return function(_0x185265){if(_0x185265){return _0x20326e[_0xeb30('0x15')](_0x4ac690)['json'](_0x185265);}};}function respondWithFilteredResult(_0x24a683,_0x1f95f4){return function(_0x511a9c){if(_0x511a9c){var _0x271cbf=_0x511a9c['count'],_0x2e48a9=_0x1f95f4[_0xeb30('0x17')],_0x272643=_0x1f95f4[_0xeb30('0x17')]+_0x1f95f4[_0xeb30('0x18')],_0x2ea0ad;if(_0x272643>=_0x271cbf){_0x272643=_0x271cbf;_0x2ea0ad=0xc8;}else{_0x2ea0ad=0xce;}_0x24a683['status'](_0x2ea0ad);return _0x24a683[_0xeb30('0x19')](_0xeb30('0x1a'),_0x2e48a9+'-'+_0x272643+'/'+_0x271cbf)[_0xeb30('0x1b')](_0x511a9c);}return null;};}function patchUpdates(_0xbe4b89){return function(_0x480517){try{jsonpatch['apply'](_0x480517,_0xbe4b89,!![]);}catch(_0x533ff5){return BPromise[_0xeb30('0x1c')](_0x533ff5);}return _0x480517[_0xeb30('0x1d')]();};}function saveUpdates(_0xdb3695,_0x4b66b1){return function(_0x3e42b4){if(_0x3e42b4){return _0x3e42b4[_0xeb30('0x1e')](_0xdb3695)['then'](function(_0x5b5cca){return _0x5b5cca;});}return null;};}function removeEntity(_0x1f8f6a,_0x4c85f1){return function(_0x3b0439){if(_0x3b0439){return _0x3b0439['destroy']()[_0xeb30('0x1f')](function(){_0x1f8f6a['status'](0xcc)[_0xeb30('0x16')]();});}};}function handleEntityNotFound(_0x1f81a5,_0x47cb7f){return function(_0x183c94){if(!_0x183c94){_0x1f81a5[_0xeb30('0x20')](0x194);}return _0x183c94;};}function handleError(_0x48a7d5,_0x843d7){_0x843d7=_0x843d7||0x1f4;return function(_0x4a23b7){logger[_0xeb30('0x21')](_0x4a23b7['stack']);if(_0x4a23b7[_0xeb30('0x22')]){delete _0x4a23b7[_0xeb30('0x22')];}_0x48a7d5[_0xeb30('0x15')](_0x843d7)[_0xeb30('0x23')](_0x4a23b7);};}exports[_0xeb30('0x24')]=function(_0x29938e,_0x8e1206){var _0xa6ec76={'raw':!![],'where':{'id':_0x29938e[_0xeb30('0x25')]['id']}},_0x5e40ca={};_0x5e40ca[_0xeb30('0x26')]=_[_0xeb30('0x27')](db[_0xeb30('0x28')][_0xeb30('0x29')]);_0x5e40ca[_0xeb30('0x2a')]=_[_0xeb30('0x27')](_0x29938e[_0xeb30('0x2a')]);_0x5e40ca[_0xeb30('0x2b')]=_['intersection'](_0x5e40ca[_0xeb30('0x26')],_0x5e40ca[_0xeb30('0x2a')]);_0xa6ec76[_0xeb30('0x2c')]=_[_0xeb30('0x2d')](_0x5e40ca['model'],qs[_0xeb30('0x2e')](_0x29938e[_0xeb30('0x2a')][_0xeb30('0x2e')]));_0xa6ec76[_0xeb30('0x2c')]=_0xa6ec76[_0xeb30('0x2c')]['length']?_0xa6ec76[_0xeb30('0x2c')]:_0x5e40ca['model'];if(_0x29938e[_0xeb30('0x2a')]['includeAll']){_0xa6ec76[_0xeb30('0x2f')]=[{'all':!![]}];}_0xa6ec76=_[_0xeb30('0x30')]({},_0xa6ec76,_0x29938e[_0xeb30('0x31')]);return db['ChatApplication'][_0xeb30('0x32')](_0xa6ec76)['then'](handleEntityNotFound(_0x8e1206,null))[_0xeb30('0x1f')](respondWithResult(_0x8e1206,null))[_0xeb30('0x33')](handleError(_0x8e1206,null));};exports['update']=function(_0x5272eb,_0x2f14d4){if(_0x5272eb[_0xeb30('0x34')]['id']){delete _0x5272eb[_0xeb30('0x34')]['id'];}return db[_0xeb30('0x28')][_0xeb30('0x32')]({'where':{'id':_0x5272eb[_0xeb30('0x25')]['id']}})[_0xeb30('0x1f')](handleEntityNotFound(_0x2f14d4,null))[_0xeb30('0x1f')](saveUpdates(_0x5272eb[_0xeb30('0x34')],null))[_0xeb30('0x1f')](respondWithResult(_0x2f14d4,null))[_0xeb30('0x33')](handleError(_0x2f14d4,null));};exports['destroy']=function(_0x431d9b,_0x4b2307){return db[_0xeb30('0x28')][_0xeb30('0x32')]({'where':{'id':_0x431d9b[_0xeb30('0x25')]['id']}})[_0xeb30('0x1f')](handleEntityNotFound(_0x4b2307,null))['then'](removeEntity(_0x4b2307,null))['catch'](handleError(_0x4b2307,null));};
\ No newline at end of file
+var _0x6b24=['fast-json-patch','request-promise','util','sox','ejs','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','stack','name','send','show','ChatApplication','rawAttributes','query','filters','model','attributes','intersection','fields','length','includeAll','include','merge','options','find','catch','body','params','rimraf','zip-dir'];(function(_0x9e5cfb,_0x5e1a0f){var _0x5a3140=function(_0x287290){while(--_0x287290){_0x9e5cfb['push'](_0x9e5cfb['shift']());}};_0x5a3140(++_0x5e1a0f);}(_0x6b24,0x1ce));var _0x46b2=function(_0x51fc7c,_0x475586){_0x51fc7c=_0x51fc7c-0x0;var _0x1482a7=_0x6b24[_0x51fc7c];return _0x1482a7;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x46b2('0x0'));var zipdir=require(_0x46b2('0x1'));var jsonpatch=require(_0x46b2('0x2'));var rp=require(_0x46b2('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x46b2('0x4'));var path=require('path');var sox=require(_0x46b2('0x5'));var csv=require('to-csv');var ejs=require(_0x46b2('0x6'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x46b2('0x7'));var crypto=require(_0x46b2('0x8'));var jsforce=require(_0x46b2('0x9'));var deskjs=require(_0x46b2('0xa'));var toCsv=require(_0x46b2('0xb'));var querystring=require(_0x46b2('0xc'));var Papa=require(_0x46b2('0xd'));var Redis=require(_0x46b2('0xe'));var authService=require(_0x46b2('0xf'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x46b2('0x10'));var logger=require(_0x46b2('0x11'))(_0x46b2('0x12'));var utils=require('../../config/utils');var config=require(_0x46b2('0x13'));var licenseUtil=require(_0x46b2('0x14'));var db=require(_0x46b2('0x15'))['db'];function respondWithStatusCode(_0x5343fc,_0x468ae9){_0x468ae9=_0x468ae9||0xcc;return function(_0x886e41){if(_0x886e41){return _0x5343fc[_0x46b2('0x16')](_0x468ae9);}return _0x5343fc[_0x46b2('0x17')](_0x468ae9)[_0x46b2('0x18')]();};}function respondWithResult(_0x1cf0f0,_0x3ff25d){_0x3ff25d=_0x3ff25d||0xc8;return function(_0x228261){if(_0x228261){return _0x1cf0f0[_0x46b2('0x17')](_0x3ff25d)[_0x46b2('0x19')](_0x228261);}};}function respondWithFilteredResult(_0x563b05,_0x43e0d9){return function(_0x5b49da){if(_0x5b49da){var _0x49479c=typeof _0x43e0d9[_0x46b2('0x1a')]===_0x46b2('0x1b')&&typeof _0x43e0d9[_0x46b2('0x1c')]===_0x46b2('0x1b');var _0x373c49=_0x5b49da[_0x46b2('0x1d')];var _0x226ab5=_0x49479c?0x0:_0x43e0d9['offset'];var _0x316c39=_0x49479c?_0x5b49da['count']:_0x43e0d9[_0x46b2('0x1a')]+_0x43e0d9[_0x46b2('0x1c')];var _0x9b4723;if(_0x316c39>=_0x373c49){_0x316c39=_0x373c49;_0x9b4723=0xc8;}else{_0x9b4723=0xce;}_0x563b05['status'](_0x9b4723);return _0x563b05[_0x46b2('0x1e')](_0x46b2('0x1f'),_0x226ab5+'-'+_0x316c39+'/'+_0x373c49)[_0x46b2('0x19')](_0x5b49da);}return null;};}function patchUpdates(_0x1e5c35){return function(_0x350f85){try{jsonpatch[_0x46b2('0x20')](_0x350f85,_0x1e5c35,!![]);}catch(_0x3a0ea5){return BPromise[_0x46b2('0x21')](_0x3a0ea5);}return _0x350f85[_0x46b2('0x22')]();};}function saveUpdates(_0x259f2f,_0x29ade9){return function(_0x1b5fbe){if(_0x1b5fbe){return _0x1b5fbe[_0x46b2('0x23')](_0x259f2f)[_0x46b2('0x24')](function(_0x1caa77){return _0x1caa77;});}return null;};}function removeEntity(_0x50011b,_0x209519){return function(_0x4c2983){if(_0x4c2983){return _0x4c2983['destroy']()[_0x46b2('0x24')](function(){_0x50011b[_0x46b2('0x17')](0xcc)[_0x46b2('0x18')]();});}};}function handleEntityNotFound(_0x134526,_0x16f646){return function(_0x58069e){if(!_0x58069e){_0x134526[_0x46b2('0x16')](0x194);}return _0x58069e;};}function handleError(_0x138f6c,_0x5ca1c7){_0x5ca1c7=_0x5ca1c7||0x1f4;return function(_0x3c5997){logger['error'](_0x3c5997[_0x46b2('0x25')]);if(_0x3c5997[_0x46b2('0x26')]){delete _0x3c5997[_0x46b2('0x26')];}_0x138f6c[_0x46b2('0x17')](_0x5ca1c7)[_0x46b2('0x27')](_0x3c5997);};}exports[_0x46b2('0x28')]=function(_0x74615,_0x1a6caf){var _0x429496={'raw':!![],'where':{'id':_0x74615['params']['id']}},_0x20ccb2={};_0x20ccb2['model']=_['keys'](db[_0x46b2('0x29')][_0x46b2('0x2a')]);_0x20ccb2[_0x46b2('0x2b')]=_['keys'](_0x74615[_0x46b2('0x2b')]);_0x20ccb2[_0x46b2('0x2c')]=_['intersection'](_0x20ccb2[_0x46b2('0x2d')],_0x20ccb2[_0x46b2('0x2b')]);_0x429496[_0x46b2('0x2e')]=_[_0x46b2('0x2f')](_0x20ccb2[_0x46b2('0x2d')],qs[_0x46b2('0x30')](_0x74615[_0x46b2('0x2b')][_0x46b2('0x30')]));_0x429496[_0x46b2('0x2e')]=_0x429496['attributes'][_0x46b2('0x31')]?_0x429496[_0x46b2('0x2e')]:_0x20ccb2[_0x46b2('0x2d')];if(_0x74615['query'][_0x46b2('0x32')]){_0x429496[_0x46b2('0x33')]=[{'all':!![]}];}_0x429496=_[_0x46b2('0x34')]({},_0x429496,_0x74615[_0x46b2('0x35')]);return db['ChatApplication'][_0x46b2('0x36')](_0x429496)['then'](handleEntityNotFound(_0x1a6caf,null))[_0x46b2('0x24')](respondWithResult(_0x1a6caf,null))[_0x46b2('0x37')](handleError(_0x1a6caf,null));};exports[_0x46b2('0x23')]=function(_0x8bae67,_0x12c5a5){if(_0x8bae67[_0x46b2('0x38')]['id']){delete _0x8bae67[_0x46b2('0x38')]['id'];}return db['ChatApplication'][_0x46b2('0x36')]({'where':{'id':_0x8bae67[_0x46b2('0x39')]['id']}})[_0x46b2('0x24')](handleEntityNotFound(_0x12c5a5,null))[_0x46b2('0x24')](saveUpdates(_0x8bae67[_0x46b2('0x38')],null))[_0x46b2('0x24')](respondWithResult(_0x12c5a5,null))[_0x46b2('0x37')](handleError(_0x12c5a5,null));};exports['destroy']=function(_0x4a2d30,_0x4cb294){return db[_0x46b2('0x29')][_0x46b2('0x36')]({'where':{'id':_0x4a2d30['params']['id']}})[_0x46b2('0x24')](handleEntityNotFound(_0x4cb294,null))['then'](removeEntity(_0x4cb294,null))['catch'](handleError(_0x4cb294,null));};
\ No newline at end of file