Built motion from commit (unavailable).|2.5.16
[motion2.git] / server / api / chatTransferReport / chatTransferReport.controller.js
index d2caccd..b46e431 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x6118=['../../config/license/util','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','apply','reject','save','update','then','destroy','error','stack','name','send','index','ChatTransferReport','rawAttributes','fieldName','type','key','map','query','keys','filters','intersection','model','attributes','fields','length','nolimit','order','sort','where','pick','filter','merge','show','params','includeAll','include','options','find','create','body','catch','describe','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment'];(function(_0x54e3c3,_0x59bf6e){var _0x411fdd=function(_0x266f42){while(--_0x266f42){_0x54e3c3['push'](_0x54e3c3['shift']());}};_0x411fdd(++_0x59bf6e);}(_0x6118,0x1bf));var _0x8611=function(_0x5a7618,_0x3f44c2){_0x5a7618=_0x5a7618-0x0;var _0x12dc65=_0x6118[_0x5a7618];return _0x12dc65;};'use strict';var pdf=require(_0x8611('0x0'));var emlformat=require(_0x8611('0x1'));var rimraf=require(_0x8611('0x2'));var zipdir=require(_0x8611('0x3'));var jsonpatch=require(_0x8611('0x4'));var rp=require(_0x8611('0x5'));var moment=require(_0x8611('0x6'));var BPromise=require(_0x8611('0x7'));var Mustache=require(_0x8611('0x8'));var util=require(_0x8611('0x9'));var path=require(_0x8611('0xa'));var sox=require('sox');var csv=require(_0x8611('0xb'));var ejs=require(_0x8611('0xc'));var fs=require('fs');var _=require(_0x8611('0xd'));var squel=require(_0x8611('0xe'));var crypto=require(_0x8611('0xf'));var jsforce=require(_0x8611('0x10'));var deskjs=require(_0x8611('0x11'));var toCsv=require(_0x8611('0xb'));var querystring=require(_0x8611('0x12'));var Papa=require(_0x8611('0x13'));var Redis=require(_0x8611('0x14'));var authService=require(_0x8611('0x15'));var qs=require(_0x8611('0x16'));var as=require(_0x8611('0x17'));var hardwareService=require(_0x8611('0x18'));var logger=require('../../config/logger')('api');var utils=require(_0x8611('0x19'));var config=require(_0x8611('0x1a'));var licenseUtil=require(_0x8611('0x1b'));var db=require(_0x8611('0x1c'))['db'];function respondWithStatusCode(_0x160e25,_0x4f229a){_0x4f229a=_0x4f229a||0xcc;return function(_0xf88890){if(_0xf88890){return _0x160e25[_0x8611('0x1d')](_0x4f229a);}return _0x160e25[_0x8611('0x1e')](_0x4f229a)[_0x8611('0x1f')]();};}function respondWithResult(_0x3135de,_0x1d0fee){_0x1d0fee=_0x1d0fee||0xc8;return function(_0x112079){if(_0x112079){return _0x3135de[_0x8611('0x1e')](_0x1d0fee)[_0x8611('0x20')](_0x112079);}};}function respondWithFilteredResult(_0x12c8d2,_0x57bc6f){return function(_0x4eac39){if(_0x4eac39){var _0x4e1ae1=_0x4eac39[_0x8611('0x21')],_0x4b25ee=_0x57bc6f[_0x8611('0x22')],_0x424a32=_0x57bc6f['offset']+_0x57bc6f[_0x8611('0x23')],_0x4e597a;if(_0x424a32>=_0x4e1ae1){_0x424a32=_0x4e1ae1;_0x4e597a=0xc8;}else{_0x4e597a=0xce;}_0x12c8d2[_0x8611('0x1e')](_0x4e597a);return _0x12c8d2[_0x8611('0x24')]('Content-Range',_0x4b25ee+'-'+_0x424a32+'/'+_0x4e1ae1)[_0x8611('0x20')](_0x4eac39);}return null;};}function patchUpdates(_0x589144){return function(_0x495f39){try{jsonpatch[_0x8611('0x25')](_0x495f39,_0x589144,!![]);}catch(_0x2e0ccd){return BPromise[_0x8611('0x26')](_0x2e0ccd);}return _0x495f39[_0x8611('0x27')]();};}function saveUpdates(_0x4cfa71,_0x2c63ca){return function(_0x5c4c71){if(_0x5c4c71){return _0x5c4c71[_0x8611('0x28')](_0x4cfa71)[_0x8611('0x29')](function(_0x5de646){return _0x5de646;});}return null;};}function removeEntity(_0x41ae24,_0x361f8d){return function(_0x56042a){if(_0x56042a){return _0x56042a[_0x8611('0x2a')]()[_0x8611('0x29')](function(){_0x41ae24[_0x8611('0x1e')](0xcc)[_0x8611('0x1f')]();});}};}function handleEntityNotFound(_0x3fa4bb,_0x5904cf){return function(_0x3866ac){if(!_0x3866ac){_0x3fa4bb[_0x8611('0x1d')](0x194);}return _0x3866ac;};}function handleError(_0x343db9,_0x2ce92a){_0x2ce92a=_0x2ce92a||0x1f4;return function(_0x54c489){logger[_0x8611('0x2b')](_0x54c489[_0x8611('0x2c')]);if(_0x54c489[_0x8611('0x2d')]){delete _0x54c489[_0x8611('0x2d')];}_0x343db9['status'](_0x2ce92a)[_0x8611('0x2e')](_0x54c489);};}exports[_0x8611('0x2f')]=function(_0x2807d8,_0x3723f0){var _0x32bb39={},_0x1151b5={},_0x1ff9a3={'count':0x0,'rows':[]};var _0x3c5a1c=_['map'](db[_0x8611('0x30')][_0x8611('0x31')],function(_0x8604a2){return{'name':_0x8604a2[_0x8611('0x32')],'type':_0x8604a2[_0x8611('0x33')][_0x8611('0x34')]};});_0x1151b5['model']=_[_0x8611('0x35')](_0x3c5a1c,_0x8611('0x2d'));_0x1151b5[_0x8611('0x36')]=_[_0x8611('0x37')](_0x2807d8[_0x8611('0x36')]);_0x1151b5[_0x8611('0x38')]=_[_0x8611('0x39')](_0x1151b5[_0x8611('0x3a')],_0x1151b5[_0x8611('0x36')]);_0x32bb39[_0x8611('0x3b')]=_[_0x8611('0x39')](_0x1151b5[_0x8611('0x3a')],qs['fields'](_0x2807d8[_0x8611('0x36')][_0x8611('0x3c')]));_0x32bb39[_0x8611('0x3b')]=_0x32bb39[_0x8611('0x3b')][_0x8611('0x3d')]?_0x32bb39['attributes']:_0x1151b5[_0x8611('0x3a')];if(!_0x2807d8[_0x8611('0x36')]['hasOwnProperty'](_0x8611('0x3e'))){_0x32bb39[_0x8611('0x23')]=qs[_0x8611('0x23')](_0x2807d8[_0x8611('0x36')][_0x8611('0x23')]);_0x32bb39[_0x8611('0x22')]=qs[_0x8611('0x22')](_0x2807d8[_0x8611('0x36')][_0x8611('0x22')]);}_0x32bb39[_0x8611('0x3f')]=qs[_0x8611('0x40')](_0x2807d8[_0x8611('0x36')][_0x8611('0x40')]);_0x32bb39[_0x8611('0x41')]=qs['filters'](_[_0x8611('0x42')](_0x2807d8[_0x8611('0x36')],_0x1151b5[_0x8611('0x38')]),_0x3c5a1c);if(_0x2807d8[_0x8611('0x36')][_0x8611('0x43')]){_0x32bb39[_0x8611('0x41')]=_[_0x8611('0x44')](_0x32bb39[_0x8611('0x41')],{'$or':_[_0x8611('0x35')](_0x3c5a1c,function(_0x298381){if(_0x298381[_0x8611('0x33')]!=='VIRTUAL'){var _0xdb0235={};_0xdb0235[_0x298381['name']]={'$like':'%'+_0x2807d8['query'][_0x8611('0x43')]+'%'};return _0xdb0235;}})});}_0x32bb39=_[_0x8611('0x44')]({},_0x32bb39,_0x2807d8['options']);var _0x155482={'where':_0x32bb39[_0x8611('0x41')]};return db[_0x8611('0x30')]['count'](_0x155482)[_0x8611('0x29')](function(_0x5a5717){_0x1ff9a3[_0x8611('0x21')]=_0x5a5717;if(_0x2807d8[_0x8611('0x36')]['includeAll']){_0x32bb39['include']=[{'all':!![]}];}return db[_0x8611('0x30')]['findAll'](_0x32bb39);})[_0x8611('0x29')](function(_0x268f6c){_0x1ff9a3['rows']=_0x268f6c;return _0x1ff9a3;})[_0x8611('0x29')](respondWithFilteredResult(_0x3723f0,_0x32bb39))['catch'](handleError(_0x3723f0,null));};exports[_0x8611('0x45')]=function(_0x5a9cdb,_0xf3781b){var _0x102b65={'raw':!![],'where':{'id':_0x5a9cdb[_0x8611('0x46')]['id']}},_0x87691b={};_0x87691b[_0x8611('0x3a')]=_[_0x8611('0x37')](db[_0x8611('0x30')]['rawAttributes']);_0x87691b['query']=_[_0x8611('0x37')](_0x5a9cdb[_0x8611('0x36')]);_0x87691b['filters']=_['intersection'](_0x87691b['model'],_0x87691b[_0x8611('0x36')]);_0x102b65['attributes']=_['intersection'](_0x87691b['model'],qs['fields'](_0x5a9cdb[_0x8611('0x36')][_0x8611('0x3c')]));_0x102b65[_0x8611('0x3b')]=_0x102b65[_0x8611('0x3b')][_0x8611('0x3d')]?_0x102b65[_0x8611('0x3b')]:_0x87691b[_0x8611('0x3a')];if(_0x5a9cdb[_0x8611('0x36')][_0x8611('0x47')]){_0x102b65[_0x8611('0x48')]=[{'all':!![]}];}_0x102b65=_[_0x8611('0x44')]({},_0x102b65,_0x5a9cdb[_0x8611('0x49')]);return db['ChatTransferReport'][_0x8611('0x4a')](_0x102b65)['then'](handleEntityNotFound(_0xf3781b,null))[_0x8611('0x29')](respondWithResult(_0xf3781b,null))['catch'](handleError(_0xf3781b,null));};exports[_0x8611('0x4b')]=function(_0x5d054e,_0x4ce06b){return db[_0x8611('0x30')][_0x8611('0x4b')](_0x5d054e[_0x8611('0x4c')],{})['then'](respondWithResult(_0x4ce06b,0xc9))[_0x8611('0x4d')](handleError(_0x4ce06b,null));};exports[_0x8611('0x28')]=function(_0x2a7925,_0x5b4a51){if(_0x2a7925[_0x8611('0x4c')]['id']){delete _0x2a7925['body']['id'];}return db[_0x8611('0x30')][_0x8611('0x4a')]({'where':{'id':_0x2a7925['params']['id']}})['then'](handleEntityNotFound(_0x5b4a51,null))['then'](saveUpdates(_0x2a7925[_0x8611('0x4c')],null))[_0x8611('0x29')](respondWithResult(_0x5b4a51,null))['catch'](handleError(_0x5b4a51,null));};exports[_0x8611('0x2a')]=function(_0x1fd12f,_0x6cf5f4){return db[_0x8611('0x30')]['find']({'where':{'id':_0x1fd12f[_0x8611('0x46')]['id']}})[_0x8611('0x29')](handleEntityNotFound(_0x6cf5f4,null))[_0x8611('0x29')](removeEntity(_0x6cf5f4,null))[_0x8611('0x4d')](handleError(_0x6cf5f4,null));};exports[_0x8611('0x4e')]=function(_0x7d1c61,_0x37c100){return db[_0x8611('0x30')]['describe']()['then'](respondWithResult(_0x37c100,null))['catch'](handleError(_0x37c100,null));};
\ No newline at end of file
+var _0x82f4=['sendStatus','status','count','offset','limit','Content-Range','json','apply','reject','update','then','destroy','end','error','stack','name','index','map','ChatTransferReport','rawAttributes','fieldName','type','key','query','filters','intersection','model','fields','length','attributes','hasOwnProperty','nolimit','order','sort','where','filter','merge','options','includeAll','include','findAll','rows','catch','show','params','keys','create','body','find','describe','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x82f4,0xce));var _0x482f=function(_0x3e1415,_0x2ad5ee){_0x3e1415=_0x3e1415-0x0;var _0x2e1ec7=_0x82f4[_0x3e1415];return _0x2e1ec7;};'use strict';var pdf=require(_0x482f('0x0'));var emlformat=require(_0x482f('0x1'));var rimraf=require(_0x482f('0x2'));var zipdir=require(_0x482f('0x3'));var jsonpatch=require(_0x482f('0x4'));var rp=require(_0x482f('0x5'));var moment=require(_0x482f('0x6'));var BPromise=require('bluebird');var Mustache=require(_0x482f('0x7'));var util=require('util');var path=require(_0x482f('0x8'));var sox=require(_0x482f('0x9'));var csv=require(_0x482f('0xa'));var ejs=require(_0x482f('0xb'));var fs=require('fs');var _=require(_0x482f('0xc'));var squel=require(_0x482f('0xd'));var crypto=require(_0x482f('0xe'));var jsforce=require(_0x482f('0xf'));var deskjs=require('desk.js');var toCsv=require(_0x482f('0xa'));var querystring=require(_0x482f('0x10'));var Papa=require(_0x482f('0x11'));var Redis=require(_0x482f('0x12'));var authService=require(_0x482f('0x13'));var qs=require(_0x482f('0x14'));var as=require(_0x482f('0x15'));var hardwareService=require(_0x482f('0x16'));var logger=require(_0x482f('0x17'))(_0x482f('0x18'));var utils=require('../../config/utils');var config=require(_0x482f('0x19'));var licenseUtil=require(_0x482f('0x1a'));var db=require(_0x482f('0x1b'))['db'];function respondWithStatusCode(_0x4ab62f,_0x576633){_0x576633=_0x576633||0xcc;return function(_0x3886f2){if(_0x3886f2){return _0x4ab62f[_0x482f('0x1c')](_0x576633);}return _0x4ab62f[_0x482f('0x1d')](_0x576633)['end']();};}function respondWithResult(_0x1a0e46,_0x128f24){_0x128f24=_0x128f24||0xc8;return function(_0x315d92){if(_0x315d92){return _0x1a0e46[_0x482f('0x1d')](_0x128f24)['json'](_0x315d92);}};}function respondWithFilteredResult(_0x312f44,_0x4818e0){return function(_0x3cd6d1){if(_0x3cd6d1){var _0x8a84fe=_0x3cd6d1[_0x482f('0x1e')],_0x1c58e1=_0x4818e0[_0x482f('0x1f')],_0x3a78ee=_0x4818e0[_0x482f('0x1f')]+_0x4818e0[_0x482f('0x20')],_0x32d4b2;if(_0x3a78ee>=_0x8a84fe){_0x3a78ee=_0x8a84fe;_0x32d4b2=0xc8;}else{_0x32d4b2=0xce;}_0x312f44['status'](_0x32d4b2);return _0x312f44['set'](_0x482f('0x21'),_0x1c58e1+'-'+_0x3a78ee+'/'+_0x8a84fe)[_0x482f('0x22')](_0x3cd6d1);}return null;};}function patchUpdates(_0x13c3f9){return function(_0x5ece8d){try{jsonpatch[_0x482f('0x23')](_0x5ece8d,_0x13c3f9,!![]);}catch(_0x1c08aa){return BPromise[_0x482f('0x24')](_0x1c08aa);}return _0x5ece8d['save']();};}function saveUpdates(_0x187bb4,_0x55d625){return function(_0x472027){if(_0x472027){return _0x472027[_0x482f('0x25')](_0x187bb4)[_0x482f('0x26')](function(_0x13b407){return _0x13b407;});}return null;};}function removeEntity(_0x41ec40,_0xc9525f){return function(_0x5965cb){if(_0x5965cb){return _0x5965cb[_0x482f('0x27')]()[_0x482f('0x26')](function(){_0x41ec40[_0x482f('0x1d')](0xcc)[_0x482f('0x28')]();});}};}function handleEntityNotFound(_0x5ba940,_0x36b31a){return function(_0x2b70ad){if(!_0x2b70ad){_0x5ba940[_0x482f('0x1c')](0x194);}return _0x2b70ad;};}function handleError(_0x11b7da,_0x547302){_0x547302=_0x547302||0x1f4;return function(_0x4d7138){logger[_0x482f('0x29')](_0x4d7138[_0x482f('0x2a')]);if(_0x4d7138[_0x482f('0x2b')]){delete _0x4d7138[_0x482f('0x2b')];}_0x11b7da[_0x482f('0x1d')](_0x547302)['send'](_0x4d7138);};}exports[_0x482f('0x2c')]=function(_0x2be8fe,_0x64283c){var _0x34df93={},_0x3e8a35={},_0xf3124={'count':0x0,'rows':[]};var _0x495625=_[_0x482f('0x2d')](db[_0x482f('0x2e')][_0x482f('0x2f')],function(_0x1d63ba){return{'name':_0x1d63ba[_0x482f('0x30')],'type':_0x1d63ba[_0x482f('0x31')][_0x482f('0x32')]};});_0x3e8a35['model']=_[_0x482f('0x2d')](_0x495625,_0x482f('0x2b'));_0x3e8a35['query']=_['keys'](_0x2be8fe[_0x482f('0x33')]);_0x3e8a35[_0x482f('0x34')]=_[_0x482f('0x35')](_0x3e8a35[_0x482f('0x36')],_0x3e8a35['query']);_0x34df93['attributes']=_[_0x482f('0x35')](_0x3e8a35[_0x482f('0x36')],qs[_0x482f('0x37')](_0x2be8fe[_0x482f('0x33')][_0x482f('0x37')]));_0x34df93['attributes']=_0x34df93['attributes'][_0x482f('0x38')]?_0x34df93[_0x482f('0x39')]:_0x3e8a35[_0x482f('0x36')];if(!_0x2be8fe[_0x482f('0x33')][_0x482f('0x3a')](_0x482f('0x3b'))){_0x34df93[_0x482f('0x20')]=qs[_0x482f('0x20')](_0x2be8fe[_0x482f('0x33')][_0x482f('0x20')]);_0x34df93[_0x482f('0x1f')]=qs[_0x482f('0x1f')](_0x2be8fe[_0x482f('0x33')][_0x482f('0x1f')]);}_0x34df93[_0x482f('0x3c')]=qs[_0x482f('0x3d')](_0x2be8fe['query'][_0x482f('0x3d')]);_0x34df93[_0x482f('0x3e')]=qs[_0x482f('0x34')](_['pick'](_0x2be8fe[_0x482f('0x33')],_0x3e8a35[_0x482f('0x34')]),_0x495625);if(_0x2be8fe[_0x482f('0x33')][_0x482f('0x3f')]){_0x34df93[_0x482f('0x3e')]=_[_0x482f('0x40')](_0x34df93[_0x482f('0x3e')],{'$or':_['map'](_0x495625,function(_0x81a47b){if(_0x81a47b[_0x482f('0x31')]!=='VIRTUAL'){var _0x2bb0e0={};_0x2bb0e0[_0x81a47b[_0x482f('0x2b')]]={'$like':'%'+_0x2be8fe['query'][_0x482f('0x3f')]+'%'};return _0x2bb0e0;}})});}_0x34df93=_['merge']({},_0x34df93,_0x2be8fe[_0x482f('0x41')]);var _0x3a7b28={'where':_0x34df93['where']};return db[_0x482f('0x2e')][_0x482f('0x1e')](_0x3a7b28)[_0x482f('0x26')](function(_0x1e05f6){_0xf3124['count']=_0x1e05f6;if(_0x2be8fe[_0x482f('0x33')][_0x482f('0x42')]){_0x34df93[_0x482f('0x43')]=[{'all':!![]}];}return db[_0x482f('0x2e')][_0x482f('0x44')](_0x34df93);})[_0x482f('0x26')](function(_0x3a9e98){_0xf3124[_0x482f('0x45')]=_0x3a9e98;return _0xf3124;})[_0x482f('0x26')](respondWithFilteredResult(_0x64283c,_0x34df93))[_0x482f('0x46')](handleError(_0x64283c,null));};exports[_0x482f('0x47')]=function(_0x4525ff,_0x57527b){var _0x29f600={'raw':!![],'where':{'id':_0x4525ff[_0x482f('0x48')]['id']}},_0x1a36f5={};_0x1a36f5[_0x482f('0x36')]=_[_0x482f('0x49')](db[_0x482f('0x2e')]['rawAttributes']);_0x1a36f5[_0x482f('0x33')]=_[_0x482f('0x49')](_0x4525ff[_0x482f('0x33')]);_0x1a36f5[_0x482f('0x34')]=_['intersection'](_0x1a36f5[_0x482f('0x36')],_0x1a36f5[_0x482f('0x33')]);_0x29f600[_0x482f('0x39')]=_['intersection'](_0x1a36f5['model'],qs[_0x482f('0x37')](_0x4525ff[_0x482f('0x33')][_0x482f('0x37')]));_0x29f600[_0x482f('0x39')]=_0x29f600[_0x482f('0x39')]['length']?_0x29f600[_0x482f('0x39')]:_0x1a36f5[_0x482f('0x36')];if(_0x4525ff[_0x482f('0x33')][_0x482f('0x42')]){_0x29f600[_0x482f('0x43')]=[{'all':!![]}];}_0x29f600=_[_0x482f('0x40')]({},_0x29f600,_0x4525ff[_0x482f('0x41')]);return db[_0x482f('0x2e')]['find'](_0x29f600)['then'](handleEntityNotFound(_0x57527b,null))[_0x482f('0x26')](respondWithResult(_0x57527b,null))['catch'](handleError(_0x57527b,null));};exports[_0x482f('0x4a')]=function(_0x5295f3,_0x4f1b76){return db[_0x482f('0x2e')][_0x482f('0x4a')](_0x5295f3[_0x482f('0x4b')],{})[_0x482f('0x26')](respondWithResult(_0x4f1b76,0xc9))[_0x482f('0x46')](handleError(_0x4f1b76,null));};exports['update']=function(_0x131433,_0x28599a){if(_0x131433[_0x482f('0x4b')]['id']){delete _0x131433[_0x482f('0x4b')]['id'];}return db[_0x482f('0x2e')][_0x482f('0x4c')]({'where':{'id':_0x131433[_0x482f('0x48')]['id']}})[_0x482f('0x26')](handleEntityNotFound(_0x28599a,null))['then'](saveUpdates(_0x131433[_0x482f('0x4b')],null))[_0x482f('0x26')](respondWithResult(_0x28599a,null))[_0x482f('0x46')](handleError(_0x28599a,null));};exports[_0x482f('0x27')]=function(_0x3fa8e0,_0x471d49){return db['ChatTransferReport'][_0x482f('0x4c')]({'where':{'id':_0x3fa8e0[_0x482f('0x48')]['id']}})[_0x482f('0x26')](handleEntityNotFound(_0x471d49,null))['then'](removeEntity(_0x471d49,null))['catch'](handleError(_0x471d49,null));};exports[_0x482f('0x4d')]=function(_0x571e66,_0x2c7f07){return db[_0x482f('0x2e')][_0x482f('0x4d')]()[_0x482f('0x26')](respondWithResult(_0x2c7f07,null))['catch'](handleError(_0x2c7f07,null));};
\ No newline at end of file