Built motion from commit 1fa89557.|2.6.10
[motion2.git] / server / api / chatApplication / chatApplication.controller.js
index 76dca70..cf7e201 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 _0x6836=['stack','name','send','show','params','keys','ChatApplication','query','filters','model','attributes','intersection','fields','length','includeAll','include','merge','options','find','body','catch','eml-format','rimraf','zip-dir','request-promise','bluebird','util','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','offset','undefined','limit','count','set','Content-Range','json','apply','reject','save','update','then','destroy','error'];(function(_0x3588f8,_0x4b049d){var _0x5a3983=function(_0x14379c){while(--_0x14379c){_0x3588f8['push'](_0x3588f8['shift']());}};_0x5a3983(++_0x4b049d);}(_0x6836,0x1c0));var _0x6683=function(_0xc4001c,_0x1bf8f0){_0xc4001c=_0xc4001c-0x0;var _0x49f7bc=_0x6836[_0xc4001c];return _0x49f7bc;};'use strict';var emlformat=require(_0x6683('0x0'));var rimraf=require(_0x6683('0x1'));var zipdir=require(_0x6683('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x6683('0x3'));var moment=require('moment');var BPromise=require(_0x6683('0x4'));var Mustache=require('mustache');var util=require(_0x6683('0x5'));var path=require('path');var sox=require(_0x6683('0x6'));var csv=require(_0x6683('0x7'));var ejs=require(_0x6683('0x8'));var fs=require('fs');var fs_extra=require(_0x6683('0x9'));var _=require('lodash');var squel=require(_0x6683('0xa'));var crypto=require(_0x6683('0xb'));var jsforce=require(_0x6683('0xc'));var deskjs=require(_0x6683('0xd'));var toCsv=require(_0x6683('0x7'));var querystring=require(_0x6683('0xe'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x6683('0xf'));var qs=require(_0x6683('0x10'));var as=require(_0x6683('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x6683('0x12'))('api');var utils=require(_0x6683('0x13'));var config=require(_0x6683('0x14'));var licenseUtil=require(_0x6683('0x15'));var db=require(_0x6683('0x16'))['db'];function respondWithStatusCode(_0x3479a3,_0x205647){_0x205647=_0x205647||0xcc;return function(_0x4181e2){if(_0x4181e2){return _0x3479a3[_0x6683('0x17')](_0x205647);}return _0x3479a3['status'](_0x205647)[_0x6683('0x18')]();};}function respondWithResult(_0x1bf449,_0x4ccb6){_0x4ccb6=_0x4ccb6||0xc8;return function(_0x28985f){if(_0x28985f){return _0x1bf449[_0x6683('0x19')](_0x4ccb6)['json'](_0x28985f);}};}function respondWithFilteredResult(_0x2a6c74,_0x44e850){return function(_0x3df040){if(_0x3df040){var _0x11fdef=typeof _0x44e850[_0x6683('0x1a')]===_0x6683('0x1b')&&typeof _0x44e850[_0x6683('0x1c')]===_0x6683('0x1b');var _0x47466b=_0x3df040[_0x6683('0x1d')];var _0x4cad41=_0x11fdef?0x0:_0x44e850[_0x6683('0x1a')];var _0x1be466=_0x11fdef?_0x3df040[_0x6683('0x1d')]:_0x44e850[_0x6683('0x1a')]+_0x44e850['limit'];var _0x2dabc1;if(_0x1be466>=_0x47466b){_0x1be466=_0x47466b;_0x2dabc1=0xc8;}else{_0x2dabc1=0xce;}_0x2a6c74[_0x6683('0x19')](_0x2dabc1);return _0x2a6c74[_0x6683('0x1e')](_0x6683('0x1f'),_0x4cad41+'-'+_0x1be466+'/'+_0x47466b)[_0x6683('0x20')](_0x3df040);}return null;};}function patchUpdates(_0x2d3775){return function(_0x1fa733){try{jsonpatch[_0x6683('0x21')](_0x1fa733,_0x2d3775,!![]);}catch(_0x1978a9){return BPromise[_0x6683('0x22')](_0x1978a9);}return _0x1fa733[_0x6683('0x23')]();};}function saveUpdates(_0x248177,_0x34680f){return function(_0x3b63e7){if(_0x3b63e7){return _0x3b63e7[_0x6683('0x24')](_0x248177)[_0x6683('0x25')](function(_0x55aeb3){return _0x55aeb3;});}return null;};}function removeEntity(_0x12ce3f,_0x33cdd3){return function(_0x49c1ce){if(_0x49c1ce){return _0x49c1ce[_0x6683('0x26')]()[_0x6683('0x25')](function(){_0x12ce3f[_0x6683('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3b005e,_0x2a2243){return function(_0x43879e){if(!_0x43879e){_0x3b005e[_0x6683('0x17')](0x194);}return _0x43879e;};}function handleError(_0x507b67,_0x1e9c1e){_0x1e9c1e=_0x1e9c1e||0x1f4;return function(_0x40959d){logger[_0x6683('0x27')](_0x40959d[_0x6683('0x28')]);if(_0x40959d['name']){delete _0x40959d[_0x6683('0x29')];}_0x507b67[_0x6683('0x19')](_0x1e9c1e)[_0x6683('0x2a')](_0x40959d);};}exports[_0x6683('0x2b')]=function(_0x1cf62b,_0x1bb6e0){var _0x343f4e={'raw':!![],'where':{'id':_0x1cf62b[_0x6683('0x2c')]['id']}},_0xda3a48={};_0xda3a48['model']=_[_0x6683('0x2d')](db[_0x6683('0x2e')]['rawAttributes']);_0xda3a48[_0x6683('0x2f')]=_[_0x6683('0x2d')](_0x1cf62b['query']);_0xda3a48[_0x6683('0x30')]=_['intersection'](_0xda3a48[_0x6683('0x31')],_0xda3a48[_0x6683('0x2f')]);_0x343f4e[_0x6683('0x32')]=_[_0x6683('0x33')](_0xda3a48['model'],qs[_0x6683('0x34')](_0x1cf62b[_0x6683('0x2f')][_0x6683('0x34')]));_0x343f4e[_0x6683('0x32')]=_0x343f4e[_0x6683('0x32')][_0x6683('0x35')]?_0x343f4e[_0x6683('0x32')]:_0xda3a48[_0x6683('0x31')];if(_0x1cf62b[_0x6683('0x2f')][_0x6683('0x36')]){_0x343f4e[_0x6683('0x37')]=[{'all':!![]}];}_0x343f4e=_[_0x6683('0x38')]({},_0x343f4e,_0x1cf62b[_0x6683('0x39')]);return db[_0x6683('0x2e')][_0x6683('0x3a')](_0x343f4e)['then'](handleEntityNotFound(_0x1bb6e0,null))[_0x6683('0x25')](respondWithResult(_0x1bb6e0,null))['catch'](handleError(_0x1bb6e0,null));};exports['update']=function(_0x2b8188,_0x27ad02){if(_0x2b8188[_0x6683('0x3b')]['id']){delete _0x2b8188[_0x6683('0x3b')]['id'];}return db[_0x6683('0x2e')][_0x6683('0x3a')]({'where':{'id':_0x2b8188[_0x6683('0x2c')]['id']}})[_0x6683('0x25')](handleEntityNotFound(_0x27ad02,null))['then'](saveUpdates(_0x2b8188[_0x6683('0x3b')],null))[_0x6683('0x25')](respondWithResult(_0x27ad02,null))[_0x6683('0x3c')](handleError(_0x27ad02,null));};exports['destroy']=function(_0x4f572b,_0x2bd212){return db['ChatApplication'][_0x6683('0x3a')]({'where':{'id':_0x4f572b[_0x6683('0x2c')]['id']}})['then'](handleEntityNotFound(_0x2bd212,null))[_0x6683('0x25')](removeEntity(_0x2bd212,null))[_0x6683('0x3c')](handleError(_0x2bd212,null));};
\ No newline at end of file