Built motion from commit 092f8824.|2.5.49
[motion2.git] / server / api / chatApplication / chatApplication.controller.js
index 76dca70..32c647e 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 _0x9532=['end','error','stack','name','send','show','params','rawAttributes','query','keys','intersection','model','attributes','fields','includeAll','include','merge','options','ChatApplication','find','catch','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','sox','ejs','fs-extra','crypto','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','destroy','then'];(function(_0x5bc866,_0x37e0e4){var _0x21326d=function(_0x18b6fa){while(--_0x18b6fa){_0x5bc866['push'](_0x5bc866['shift']());}};_0x21326d(++_0x37e0e4);}(_0x9532,0x8c));var _0x2953=function(_0x53f1ba,_0x40e27c){_0x53f1ba=_0x53f1ba-0x0;var _0x303042=_0x9532[_0x53f1ba];return _0x303042;};'use strict';var emlformat=require(_0x2953('0x0'));var rimraf=require(_0x2953('0x1'));var zipdir=require(_0x2953('0x2'));var jsonpatch=require(_0x2953('0x3'));var rp=require(_0x2953('0x4'));var moment=require(_0x2953('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x2953('0x6'));var util=require(_0x2953('0x7'));var path=require('path');var sox=require(_0x2953('0x8'));var csv=require('to-csv');var ejs=require(_0x2953('0x9'));var fs=require('fs');var fs_extra=require(_0x2953('0xa'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x2953('0xb'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x2953('0xc'));var querystring=require('querystring');var Papa=require(_0x2953('0xd'));var Redis=require(_0x2953('0xe'));var authService=require(_0x2953('0xf'));var qs=require(_0x2953('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x2953('0x11'));var logger=require(_0x2953('0x12'))(_0x2953('0x13'));var utils=require(_0x2953('0x14'));var config=require(_0x2953('0x15'));var licenseUtil=require(_0x2953('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x480cae,_0x41f2be){_0x41f2be=_0x41f2be||0xcc;return function(_0x13c8a8){if(_0x13c8a8){return _0x480cae['sendStatus'](_0x41f2be);}return _0x480cae[_0x2953('0x17')](_0x41f2be)['end']();};}function respondWithResult(_0x4f15fc,_0x58f5ca){_0x58f5ca=_0x58f5ca||0xc8;return function(_0x4e1e86){if(_0x4e1e86){return _0x4f15fc[_0x2953('0x17')](_0x58f5ca)[_0x2953('0x18')](_0x4e1e86);}};}function respondWithFilteredResult(_0x2ca196,_0x16dbf5){return function(_0x1305c8){if(_0x1305c8){var _0x4b9da7=typeof _0x16dbf5[_0x2953('0x19')]===_0x2953('0x1a')&&typeof _0x16dbf5[_0x2953('0x1b')]===_0x2953('0x1a');var _0x25dad2=_0x1305c8[_0x2953('0x1c')];var _0x359e81=_0x4b9da7?0x0:_0x16dbf5[_0x2953('0x19')];var _0x52e292=_0x4b9da7?_0x1305c8[_0x2953('0x1c')]:_0x16dbf5[_0x2953('0x19')]+_0x16dbf5[_0x2953('0x1b')];var _0x288d6c;if(_0x52e292>=_0x25dad2){_0x52e292=_0x25dad2;_0x288d6c=0xc8;}else{_0x288d6c=0xce;}_0x2ca196[_0x2953('0x17')](_0x288d6c);return _0x2ca196[_0x2953('0x1d')](_0x2953('0x1e'),_0x359e81+'-'+_0x52e292+'/'+_0x25dad2)[_0x2953('0x18')](_0x1305c8);}return null;};}function patchUpdates(_0x435d94){return function(_0x68d656){try{jsonpatch[_0x2953('0x1f')](_0x68d656,_0x435d94,!![]);}catch(_0x236a10){return BPromise[_0x2953('0x20')](_0x236a10);}return _0x68d656[_0x2953('0x21')]();};}function saveUpdates(_0x142beb,_0x563d81){return function(_0x1a1240){if(_0x1a1240){return _0x1a1240[_0x2953('0x22')](_0x142beb)['then'](function(_0x4f3118){return _0x4f3118;});}return null;};}function removeEntity(_0x301c35,_0x236694){return function(_0x25857e){if(_0x25857e){return _0x25857e[_0x2953('0x23')]()[_0x2953('0x24')](function(){_0x301c35[_0x2953('0x17')](0xcc)[_0x2953('0x25')]();});}};}function handleEntityNotFound(_0x3a7ae5,_0x419192){return function(_0x234b78){if(!_0x234b78){_0x3a7ae5['sendStatus'](0x194);}return _0x234b78;};}function handleError(_0x25223e,_0x550ad8){_0x550ad8=_0x550ad8||0x1f4;return function(_0x21e221){logger[_0x2953('0x26')](_0x21e221[_0x2953('0x27')]);if(_0x21e221[_0x2953('0x28')]){delete _0x21e221['name'];}_0x25223e['status'](_0x550ad8)[_0x2953('0x29')](_0x21e221);};}exports[_0x2953('0x2a')]=function(_0x2309c6,_0x12c7ea){var _0x35040d={'raw':!![],'where':{'id':_0x2309c6[_0x2953('0x2b')]['id']}},_0xbbcead={};_0xbbcead['model']=_['keys'](db['ChatApplication'][_0x2953('0x2c')]);_0xbbcead[_0x2953('0x2d')]=_[_0x2953('0x2e')](_0x2309c6[_0x2953('0x2d')]);_0xbbcead['filters']=_[_0x2953('0x2f')](_0xbbcead[_0x2953('0x30')],_0xbbcead[_0x2953('0x2d')]);_0x35040d[_0x2953('0x31')]=_['intersection'](_0xbbcead[_0x2953('0x30')],qs[_0x2953('0x32')](_0x2309c6[_0x2953('0x2d')][_0x2953('0x32')]));_0x35040d[_0x2953('0x31')]=_0x35040d[_0x2953('0x31')]['length']?_0x35040d[_0x2953('0x31')]:_0xbbcead[_0x2953('0x30')];if(_0x2309c6[_0x2953('0x2d')][_0x2953('0x33')]){_0x35040d[_0x2953('0x34')]=[{'all':!![]}];}_0x35040d=_[_0x2953('0x35')]({},_0x35040d,_0x2309c6[_0x2953('0x36')]);return db[_0x2953('0x37')][_0x2953('0x38')](_0x35040d)['then'](handleEntityNotFound(_0x12c7ea,null))[_0x2953('0x24')](respondWithResult(_0x12c7ea,null))[_0x2953('0x39')](handleError(_0x12c7ea,null));};exports['update']=function(_0xdfc17f,_0x388227){if(_0xdfc17f[_0x2953('0x3a')]['id']){delete _0xdfc17f['body']['id'];}return db[_0x2953('0x37')][_0x2953('0x38')]({'where':{'id':_0xdfc17f[_0x2953('0x2b')]['id']}})[_0x2953('0x24')](handleEntityNotFound(_0x388227,null))['then'](saveUpdates(_0xdfc17f[_0x2953('0x3a')],null))[_0x2953('0x24')](respondWithResult(_0x388227,null))[_0x2953('0x39')](handleError(_0x388227,null));};exports[_0x2953('0x23')]=function(_0x1985a2,_0x266745){return db[_0x2953('0x37')][_0x2953('0x38')]({'where':{'id':_0x1985a2[_0x2953('0x2b')]['id']}})[_0x2953('0x24')](handleEntityNotFound(_0x266745,null))[_0x2953('0x24')](removeEntity(_0x266745,null))['catch'](handleError(_0x266745,null));};
\ No newline at end of file