Built motion from commit (unavailable).|2.4.21
[motion2.git] / server / api / chatApplication / chatApplication.controller.js
index fa54983..52d4932 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x3239=['model','fields','length','includeAll','include','options','catch','find','body','eml-format','rimraf','fast-json-patch','request-promise','moment','mustache','util','sox','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../mysqldb','status','end','json','count','Content-Range','apply','reject','save','then','destroy','sendStatus','name','show','params','ChatApplication','rawAttributes','query','keys','filters','intersection','attributes'];(function(_0x2ff762,_0x342c0b){var _0x158b02=function(_0x13c38e){while(--_0x13c38e){_0x2ff762['push'](_0x2ff762['shift']());}};_0x158b02(++_0x342c0b);}(_0x3239,0x1b1));var _0x9323=function(_0x54b9ac,_0x1d40e8){_0x54b9ac=_0x54b9ac-0x0;var _0x5e0065=_0x3239[_0x54b9ac];return _0x5e0065;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x9323('0x0'));var rimraf=require(_0x9323('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x9323('0x2'));var rp=require(_0x9323('0x3'));var moment=require(_0x9323('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x9323('0x5'));var util=require(_0x9323('0x6'));var path=require('path');var sox=require(_0x9323('0x7'));var csv=require(_0x9323('0x8'));var ejs=require(_0x9323('0x9'));var fs=require('fs');var _=require(_0x9323('0xa'));var squel=require(_0x9323('0xb'));var crypto=require(_0x9323('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x9323('0xd'));var toCsv=require(_0x9323('0x8'));var querystring=require(_0x9323('0xe'));var Papa=require(_0x9323('0xf'));var Redis=require('ioredis');var authService=require(_0x9323('0x10'));var qs=require(_0x9323('0x11'));var as=require(_0x9323('0x12'));var hardwareService=require(_0x9323('0x13'));var logger=require(_0x9323('0x14'))('api');var utils=require(_0x9323('0x15'));var config=require('../../config/environment');var db=require(_0x9323('0x16'))['db'];function respondWithStatusCode(_0x24f74b,_0x4ccae4){_0x4ccae4=_0x4ccae4||0xcc;return function(_0x56f70a){if(_0x56f70a){return _0x24f74b['sendStatus'](_0x4ccae4);}return _0x24f74b[_0x9323('0x17')](_0x4ccae4)[_0x9323('0x18')]();};}function respondWithResult(_0x23dc13,_0x171692){_0x171692=_0x171692||0xc8;return function(_0xd2b363){if(_0xd2b363){return _0x23dc13[_0x9323('0x17')](_0x171692)[_0x9323('0x19')](_0xd2b363);}};}function respondWithFilteredResult(_0x4b3783,_0x41969e){return function(_0x4e21ed){if(_0x4e21ed){var _0x1a7891=_0x4e21ed[_0x9323('0x1a')],_0x9168d4=_0x41969e['offset'],_0x7e1f9d=_0x41969e['offset']+_0x41969e['limit'],_0x380e7b;if(_0x7e1f9d>=_0x1a7891){_0x7e1f9d=_0x1a7891;_0x380e7b=0xc8;}else{_0x380e7b=0xce;}_0x4b3783[_0x9323('0x17')](_0x380e7b);return _0x4b3783['set'](_0x9323('0x1b'),_0x9168d4+'-'+_0x7e1f9d+'/'+_0x1a7891)[_0x9323('0x19')](_0x4e21ed);}return null;};}function patchUpdates(_0x16c954){return function(_0x260a4d){try{jsonpatch[_0x9323('0x1c')](_0x260a4d,_0x16c954,!![]);}catch(_0x47e5e8){return BPromise[_0x9323('0x1d')](_0x47e5e8);}return _0x260a4d[_0x9323('0x1e')]();};}function saveUpdates(_0x576698,_0x49e0dc){return function(_0x573d27){if(_0x573d27){return _0x573d27['update'](_0x576698)[_0x9323('0x1f')](function(_0x542228){return _0x542228;});}return null;};}function removeEntity(_0x507750,_0x2087c3){return function(_0x46347f){if(_0x46347f){return _0x46347f[_0x9323('0x20')]()[_0x9323('0x1f')](function(){_0x507750['status'](0xcc)[_0x9323('0x18')]();});}};}function handleEntityNotFound(_0x3a10c3,_0x5412c3){return function(_0x62a40e){if(!_0x62a40e){_0x3a10c3[_0x9323('0x21')](0x194);}return _0x62a40e;};}function handleError(_0x2694d2,_0x5b0af3){_0x5b0af3=_0x5b0af3||0x1f4;return function(_0x44e995){logger['error'](_0x44e995['stack']);if(_0x44e995['name']){delete _0x44e995[_0x9323('0x22')];}_0x2694d2[_0x9323('0x17')](_0x5b0af3)['send'](_0x44e995);};}exports[_0x9323('0x23')]=function(_0xf3d559,_0x33ef81){var _0x113ad7={'raw':!![],'where':{'id':_0xf3d559[_0x9323('0x24')]['id']}},_0x3c861c={};_0x3c861c['model']=_['keys'](db[_0x9323('0x25')][_0x9323('0x26')]);_0x3c861c[_0x9323('0x27')]=_[_0x9323('0x28')](_0xf3d559[_0x9323('0x27')]);_0x3c861c[_0x9323('0x29')]=_[_0x9323('0x2a')](_0x3c861c['model'],_0x3c861c[_0x9323('0x27')]);_0x113ad7[_0x9323('0x2b')]=_[_0x9323('0x2a')](_0x3c861c[_0x9323('0x2c')],qs['fields'](_0xf3d559['query'][_0x9323('0x2d')]));_0x113ad7[_0x9323('0x2b')]=_0x113ad7['attributes'][_0x9323('0x2e')]?_0x113ad7['attributes']:_0x3c861c[_0x9323('0x2c')];if(_0xf3d559[_0x9323('0x27')][_0x9323('0x2f')]){_0x113ad7[_0x9323('0x30')]=[{'all':!![]}];}_0x113ad7=_['merge']({},_0x113ad7,_0xf3d559[_0x9323('0x31')]);return db[_0x9323('0x25')]['find'](_0x113ad7)['then'](handleEntityNotFound(_0x33ef81,null))[_0x9323('0x1f')](respondWithResult(_0x33ef81,null))[_0x9323('0x32')](handleError(_0x33ef81,null));};exports['update']=function(_0x2c23d5,_0x3341b5){if(_0x2c23d5['body']['id']){delete _0x2c23d5['body']['id'];}return db['ChatApplication'][_0x9323('0x33')]({'where':{'id':_0x2c23d5['params']['id']}})['then'](handleEntityNotFound(_0x3341b5,null))['then'](saveUpdates(_0x2c23d5[_0x9323('0x34')],null))[_0x9323('0x1f')](respondWithResult(_0x3341b5,null))[_0x9323('0x32')](handleError(_0x3341b5,null));};exports[_0x9323('0x20')]=function(_0x4f6c34,_0xb0dfa1){return db['ChatApplication'][_0x9323('0x33')]({'where':{'id':_0x4f6c34[_0x9323('0x24')]['id']}})['then'](handleEntityNotFound(_0xb0dfa1,null))['then'](removeEntity(_0xb0dfa1,null))[_0x9323('0x32')](handleError(_0xb0dfa1,null));};
\ No newline at end of file
+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