Built motion from commit f7863d46.|2.5.41
[motion2.git] / server / api / chatTransferReport / chatTransferReport.controller.js
index 1021f32..b8e8db2 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x9509=['count','offset','limit','Content-Range','apply','reject','update','then','destroy','sendStatus','error','stack','name','send','map','ChatTransferReport','type','model','query','keys','filters','intersection','attributes','fields','order','sort','where','merge','filter','options','include','rows','length','find','create','body','params','catch','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','sox','to-csv','ejs','lodash','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','status','end'];(function(_0xcff7e0,_0x13c9c8){var _0x1dddc6=function(_0x568429){while(--_0x568429){_0xcff7e0['push'](_0xcff7e0['shift']());}};_0x1dddc6(++_0x13c9c8);}(_0x9509,0xe3));var _0x9950=function(_0x488813,_0x51c1b3){_0x488813=_0x488813-0x0;var _0x29be1a=_0x9509[_0x488813];return _0x29be1a;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x9950('0x0'));var rimraf=require(_0x9950('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x9950('0x2'));var rp=require(_0x9950('0x3'));var moment=require('moment');var BPromise=require(_0x9950('0x4'));var Mustache=require(_0x9950('0x5'));var util=require(_0x9950('0x6'));var path=require('path');var sox=require(_0x9950('0x7'));var csv=require(_0x9950('0x8'));var ejs=require(_0x9950('0x9'));var fs=require('fs');var _=require(_0x9950('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x9950('0xb'));var deskjs=require(_0x9950('0xc'));var toCsv=require(_0x9950('0x8'));var querystring=require('querystring');var Papa=require(_0x9950('0xd'));var Redis=require(_0x9950('0xe'));var authService=require(_0x9950('0xf'));var qs=require(_0x9950('0x10'));var as=require(_0x9950('0x11'));var hardwareService=require(_0x9950('0x12'));var logger=require(_0x9950('0x13'))(_0x9950('0x14'));var utils=require('../../config/utils');var config=require(_0x9950('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x9950('0x16'))['db'];function respondWithStatusCode(_0x3ed3b5,_0x349750){_0x349750=_0x349750||0xcc;return function(_0x4c2cc9){if(_0x4c2cc9){return _0x3ed3b5['sendStatus'](_0x349750);}return _0x3ed3b5[_0x9950('0x17')](_0x349750)[_0x9950('0x18')]();};}function respondWithResult(_0x21c1f7,_0x3263cb){_0x3263cb=_0x3263cb||0xc8;return function(_0x55a947){if(_0x55a947){return _0x21c1f7['status'](_0x3263cb)['json'](_0x55a947);}};}function respondWithFilteredResult(_0x4d4ee8,_0x3b8a7b){return function(_0xe1cfd2){if(_0xe1cfd2){var _0x2a807b=_0xe1cfd2[_0x9950('0x19')],_0x2425a6=_0x3b8a7b['offset'],_0x83a9c5=_0x3b8a7b[_0x9950('0x1a')]+_0x3b8a7b[_0x9950('0x1b')],_0x442aed;if(_0x83a9c5>=_0x2a807b){_0x83a9c5=_0x2a807b;_0x442aed=0xc8;}else{_0x442aed=0xce;}_0x4d4ee8[_0x9950('0x17')](_0x442aed);return _0x4d4ee8['set'](_0x9950('0x1c'),_0x2425a6+'-'+_0x83a9c5+'/'+_0x2a807b)['json'](_0xe1cfd2);}return null;};}function patchUpdates(_0x470dd5){return function(_0x310972){try{jsonpatch[_0x9950('0x1d')](_0x310972,_0x470dd5,!![]);}catch(_0x368207){return BPromise[_0x9950('0x1e')](_0x368207);}return _0x310972['save']();};}function saveUpdates(_0x365656,_0x1f6c5e){return function(_0x104581){if(_0x104581){return _0x104581[_0x9950('0x1f')](_0x365656)[_0x9950('0x20')](function(_0x556cd2){return _0x556cd2;});}return null;};}function removeEntity(_0x348c96,_0x11cec7){return function(_0x57bf46){if(_0x57bf46){return _0x57bf46[_0x9950('0x21')]()[_0x9950('0x20')](function(){_0x348c96[_0x9950('0x17')](0xcc)[_0x9950('0x18')]();});}};}function handleEntityNotFound(_0x24a166,_0x3fa26c){return function(_0x1bad6e){if(!_0x1bad6e){_0x24a166[_0x9950('0x22')](0x194);}return _0x1bad6e;};}function handleError(_0x67655a,_0x169ba5){_0x169ba5=_0x169ba5||0x1f4;return function(_0x3ca69a){logger[_0x9950('0x23')](_0x3ca69a[_0x9950('0x24')]);if(_0x3ca69a[_0x9950('0x25')]){delete _0x3ca69a[_0x9950('0x25')];}_0x67655a[_0x9950('0x17')](_0x169ba5)[_0x9950('0x26')](_0x3ca69a);};}exports['index']=function(_0xdf529f,_0xbd90c6){var _0x306bde={},_0xc20124={},_0x4076f2={'count':0x0,'rows':[]};var _0x10185f=_[_0x9950('0x27')](db[_0x9950('0x28')]['rawAttributes'],function(_0x4872b4){return{'name':_0x4872b4['fieldName'],'type':_0x4872b4[_0x9950('0x29')]['key']};});_0xc20124[_0x9950('0x2a')]=_[_0x9950('0x27')](_0x10185f,_0x9950('0x25'));_0xc20124[_0x9950('0x2b')]=_[_0x9950('0x2c')](_0xdf529f[_0x9950('0x2b')]);_0xc20124[_0x9950('0x2d')]=_[_0x9950('0x2e')](_0xc20124[_0x9950('0x2a')],_0xc20124['query']);_0x306bde[_0x9950('0x2f')]=_[_0x9950('0x2e')](_0xc20124[_0x9950('0x2a')],qs['fields'](_0xdf529f['query'][_0x9950('0x30')]));_0x306bde[_0x9950('0x2f')]=_0x306bde[_0x9950('0x2f')]['length']?_0x306bde['attributes']:_0xc20124['model'];if(!_0xdf529f[_0x9950('0x2b')]['hasOwnProperty']('nolimit')){_0x306bde[_0x9950('0x1b')]=qs['limit'](_0xdf529f[_0x9950('0x2b')][_0x9950('0x1b')]);_0x306bde[_0x9950('0x1a')]=qs[_0x9950('0x1a')](_0xdf529f[_0x9950('0x2b')][_0x9950('0x1a')]);}_0x306bde[_0x9950('0x31')]=qs['sort'](_0xdf529f[_0x9950('0x2b')][_0x9950('0x32')]);_0x306bde['where']=qs[_0x9950('0x2d')](_['pick'](_0xdf529f[_0x9950('0x2b')],_0xc20124[_0x9950('0x2d')]),_0x10185f);if(_0xdf529f[_0x9950('0x2b')]['filter']){_0x306bde[_0x9950('0x33')]=_[_0x9950('0x34')](_0x306bde[_0x9950('0x33')],{'$or':_[_0x9950('0x27')](_0x10185f,function(_0x3e81c6){if(_0x3e81c6[_0x9950('0x29')]!=='VIRTUAL'){var _0x4a0a09={};_0x4a0a09[_0x3e81c6[_0x9950('0x25')]]={'$like':'%'+_0xdf529f['query'][_0x9950('0x35')]+'%'};return _0x4a0a09;}})});}_0x306bde=_[_0x9950('0x34')]({},_0x306bde,_0xdf529f[_0x9950('0x36')]);var _0x51d735={'where':_0x306bde[_0x9950('0x33')]};return db[_0x9950('0x28')][_0x9950('0x19')](_0x51d735)[_0x9950('0x20')](function(_0x4f2d83){_0x4076f2['count']=_0x4f2d83;if(_0xdf529f[_0x9950('0x2b')]['includeAll']){_0x306bde[_0x9950('0x37')]=[{'all':!![]}];}return db[_0x9950('0x28')]['findAll'](_0x306bde);})[_0x9950('0x20')](function(_0x3fb4fa){_0x4076f2[_0x9950('0x38')]=_0x3fb4fa;return _0x4076f2;})[_0x9950('0x20')](respondWithFilteredResult(_0xbd90c6,_0x306bde))['catch'](handleError(_0xbd90c6,null));};exports['show']=function(_0x4351a7,_0x665a8f){var _0x5195b7={'raw':!![],'where':{'id':_0x4351a7['params']['id']}},_0x301e90={};_0x301e90[_0x9950('0x2a')]=_[_0x9950('0x2c')](db['ChatTransferReport']['rawAttributes']);_0x301e90[_0x9950('0x2b')]=_[_0x9950('0x2c')](_0x4351a7[_0x9950('0x2b')]);_0x301e90['filters']=_[_0x9950('0x2e')](_0x301e90[_0x9950('0x2a')],_0x301e90[_0x9950('0x2b')]);_0x5195b7[_0x9950('0x2f')]=_['intersection'](_0x301e90[_0x9950('0x2a')],qs['fields'](_0x4351a7['query'][_0x9950('0x30')]));_0x5195b7[_0x9950('0x2f')]=_0x5195b7[_0x9950('0x2f')][_0x9950('0x39')]?_0x5195b7['attributes']:_0x301e90[_0x9950('0x2a')];if(_0x4351a7['query']['includeAll']){_0x5195b7[_0x9950('0x37')]=[{'all':!![]}];}_0x5195b7=_[_0x9950('0x34')]({},_0x5195b7,_0x4351a7[_0x9950('0x36')]);return db[_0x9950('0x28')][_0x9950('0x3a')](_0x5195b7)[_0x9950('0x20')](handleEntityNotFound(_0x665a8f,null))[_0x9950('0x20')](respondWithResult(_0x665a8f,null))['catch'](handleError(_0x665a8f,null));};exports[_0x9950('0x3b')]=function(_0x3c4cd2,_0x10e978){return db[_0x9950('0x28')][_0x9950('0x3b')](_0x3c4cd2[_0x9950('0x3c')],{})[_0x9950('0x20')](respondWithResult(_0x10e978,0xc9))['catch'](handleError(_0x10e978,null));};exports[_0x9950('0x1f')]=function(_0x23b282,_0x5d2e62){if(_0x23b282[_0x9950('0x3c')]['id']){delete _0x23b282[_0x9950('0x3c')]['id'];}return db['ChatTransferReport'][_0x9950('0x3a')]({'where':{'id':_0x23b282[_0x9950('0x3d')]['id']}})[_0x9950('0x20')](handleEntityNotFound(_0x5d2e62,null))['then'](saveUpdates(_0x23b282[_0x9950('0x3c')],null))['then'](respondWithResult(_0x5d2e62,null))[_0x9950('0x3e')](handleError(_0x5d2e62,null));};exports[_0x9950('0x21')]=function(_0x12449f,_0x4839b8){return db['ChatTransferReport'][_0x9950('0x3a')]({'where':{'id':_0x12449f[_0x9950('0x3d')]['id']}})[_0x9950('0x20')](handleEntityNotFound(_0x4839b8,null))[_0x9950('0x20')](removeEntity(_0x4839b8,null))[_0x9950('0x3e')](handleError(_0x4839b8,null));};exports['describe']=function(_0x3f86a5,_0x22a0fc){return db[_0x9950('0x28')]['describe']()[_0x9950('0x20')](respondWithResult(_0x22a0fc,null))[_0x9950('0x3e')](handleError(_0x22a0fc,null));};
\ No newline at end of file
+var _0x756f=['keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','where','filter','merge','VIRTUAL','options','include','findAll','catch','params','includeAll','find','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','ejs','lodash','squel','crypto','jsforce','querystring','papaparse','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','offset','undefined','count','limit','set','json','apply','save','update','then','destroy','end','stack','name','send','ChatTransferReport','rawAttributes','fieldName','type','key','model','map','query'];(function(_0x1b2ff7,_0x12a034){var _0x31656a=function(_0x1165a5){while(--_0x1165a5){_0x1b2ff7['push'](_0x1b2ff7['shift']());}};_0x31656a(++_0x12a034);}(_0x756f,0x137));var _0xf756=function(_0x778a18,_0x26f54d){_0x778a18=_0x778a18-0x0;var _0x354822=_0x756f[_0x778a18];return _0x354822;};'use strict';var emlformat=require(_0xf756('0x0'));var rimraf=require(_0xf756('0x1'));var zipdir=require(_0xf756('0x2'));var jsonpatch=require(_0xf756('0x3'));var rp=require('request-promise');var moment=require(_0xf756('0x4'));var BPromise=require(_0xf756('0x5'));var Mustache=require(_0xf756('0x6'));var util=require(_0xf756('0x7'));var path=require(_0xf756('0x8'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xf756('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xf756('0xa'));var squel=require(_0xf756('0xb'));var crypto=require(_0xf756('0xc'));var jsforce=require(_0xf756('0xd'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xf756('0xe'));var Papa=require(_0xf756('0xf'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xf756('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xf756('0x11'));var logger=require(_0xf756('0x12'))(_0xf756('0x13'));var utils=require(_0xf756('0x14'));var config=require(_0xf756('0x15'));var licenseUtil=require(_0xf756('0x16'));var db=require(_0xf756('0x17'))['db'];function respondWithStatusCode(_0x24e0b9,_0x43d40c){_0x43d40c=_0x43d40c||0xcc;return function(_0x3e2ce7){if(_0x3e2ce7){return _0x24e0b9[_0xf756('0x18')](_0x43d40c);}return _0x24e0b9[_0xf756('0x19')](_0x43d40c)['end']();};}function respondWithResult(_0x159436,_0x35f91d){_0x35f91d=_0x35f91d||0xc8;return function(_0x31e27e){if(_0x31e27e){return _0x159436['status'](_0x35f91d)['json'](_0x31e27e);}};}function respondWithFilteredResult(_0x560976,_0x532520){return function(_0x479e90){if(_0x479e90){var _0x4a340f=typeof _0x532520[_0xf756('0x1a')]==='undefined'&&typeof _0x532520['limit']===_0xf756('0x1b');var _0x2bcea4=_0x479e90[_0xf756('0x1c')];var _0x2b6430=_0x4a340f?0x0:_0x532520[_0xf756('0x1a')];var _0x348fdc=_0x4a340f?_0x479e90['count']:_0x532520[_0xf756('0x1a')]+_0x532520[_0xf756('0x1d')];var _0x3b32f8;if(_0x348fdc>=_0x2bcea4){_0x348fdc=_0x2bcea4;_0x3b32f8=0xc8;}else{_0x3b32f8=0xce;}_0x560976[_0xf756('0x19')](_0x3b32f8);return _0x560976[_0xf756('0x1e')]('Content-Range',_0x2b6430+'-'+_0x348fdc+'/'+_0x2bcea4)[_0xf756('0x1f')](_0x479e90);}return null;};}function patchUpdates(_0x1f481a){return function(_0x210f2e){try{jsonpatch[_0xf756('0x20')](_0x210f2e,_0x1f481a,!![]);}catch(_0x56c9d4){return BPromise['reject'](_0x56c9d4);}return _0x210f2e[_0xf756('0x21')]();};}function saveUpdates(_0x4399c7,_0x198613){return function(_0x1af286){if(_0x1af286){return _0x1af286[_0xf756('0x22')](_0x4399c7)[_0xf756('0x23')](function(_0x252112){return _0x252112;});}return null;};}function removeEntity(_0x36d62c,_0x4075b5){return function(_0x58117d){if(_0x58117d){return _0x58117d[_0xf756('0x24')]()[_0xf756('0x23')](function(){_0x36d62c[_0xf756('0x19')](0xcc)[_0xf756('0x25')]();});}};}function handleEntityNotFound(_0x22eb27,_0x126dc1){return function(_0x53cdcb){if(!_0x53cdcb){_0x22eb27[_0xf756('0x18')](0x194);}return _0x53cdcb;};}function handleError(_0x1df3ef,_0xb40b97){_0xb40b97=_0xb40b97||0x1f4;return function(_0x2fb858){logger['error'](_0x2fb858[_0xf756('0x26')]);if(_0x2fb858[_0xf756('0x27')]){delete _0x2fb858[_0xf756('0x27')];}_0x1df3ef[_0xf756('0x19')](_0xb40b97)[_0xf756('0x28')](_0x2fb858);};}exports['index']=function(_0x186a10,_0x2ad930){var _0x2da963={},_0x2d84f4={},_0x100e92={'count':0x0,'rows':[]};var _0x4fb308=_['map'](db[_0xf756('0x29')][_0xf756('0x2a')],function(_0x59266e){return{'name':_0x59266e[_0xf756('0x2b')],'type':_0x59266e[_0xf756('0x2c')][_0xf756('0x2d')]};});_0x2d84f4[_0xf756('0x2e')]=_[_0xf756('0x2f')](_0x4fb308,_0xf756('0x27'));_0x2d84f4[_0xf756('0x30')]=_[_0xf756('0x31')](_0x186a10[_0xf756('0x30')]);_0x2d84f4[_0xf756('0x32')]=_[_0xf756('0x33')](_0x2d84f4['model'],_0x2d84f4[_0xf756('0x30')]);_0x2da963['attributes']=_[_0xf756('0x33')](_0x2d84f4['model'],qs[_0xf756('0x34')](_0x186a10[_0xf756('0x30')]['fields']));_0x2da963[_0xf756('0x35')]=_0x2da963[_0xf756('0x35')][_0xf756('0x36')]?_0x2da963[_0xf756('0x35')]:_0x2d84f4[_0xf756('0x2e')];if(!_0x186a10[_0xf756('0x30')][_0xf756('0x37')](_0xf756('0x38'))){_0x2da963[_0xf756('0x1d')]=qs[_0xf756('0x1d')](_0x186a10[_0xf756('0x30')]['limit']);_0x2da963[_0xf756('0x1a')]=qs[_0xf756('0x1a')](_0x186a10[_0xf756('0x30')][_0xf756('0x1a')]);}_0x2da963['order']=qs[_0xf756('0x39')](_0x186a10[_0xf756('0x30')][_0xf756('0x39')]);_0x2da963[_0xf756('0x3a')]=qs[_0xf756('0x32')](_['pick'](_0x186a10[_0xf756('0x30')],_0x2d84f4[_0xf756('0x32')]),_0x4fb308);if(_0x186a10[_0xf756('0x30')][_0xf756('0x3b')]){_0x2da963[_0xf756('0x3a')]=_[_0xf756('0x3c')](_0x2da963[_0xf756('0x3a')],{'$or':_[_0xf756('0x2f')](_0x4fb308,function(_0x119178){if(_0x119178[_0xf756('0x2c')]!==_0xf756('0x3d')){var _0x2cf443={};_0x2cf443[_0x119178[_0xf756('0x27')]]={'$like':'%'+_0x186a10[_0xf756('0x30')][_0xf756('0x3b')]+'%'};return _0x2cf443;}})});}_0x2da963=_['merge']({},_0x2da963,_0x186a10[_0xf756('0x3e')]);var _0x35576c={'where':_0x2da963['where']};return db['ChatTransferReport'][_0xf756('0x1c')](_0x35576c)[_0xf756('0x23')](function(_0x39f2db){_0x100e92[_0xf756('0x1c')]=_0x39f2db;if(_0x186a10[_0xf756('0x30')]['includeAll']){_0x2da963[_0xf756('0x3f')]=[{'all':!![]}];}return db[_0xf756('0x29')][_0xf756('0x40')](_0x2da963);})[_0xf756('0x23')](function(_0x2e3754){_0x100e92['rows']=_0x2e3754;return _0x100e92;})['then'](respondWithFilteredResult(_0x2ad930,_0x2da963))[_0xf756('0x41')](handleError(_0x2ad930,null));};exports['show']=function(_0x1b1a93,_0x1e1efa){var _0x4f0d8a={'raw':!![],'where':{'id':_0x1b1a93[_0xf756('0x42')]['id']}},_0xa3804d={};_0xa3804d[_0xf756('0x2e')]=_[_0xf756('0x31')](db['ChatTransferReport'][_0xf756('0x2a')]);_0xa3804d[_0xf756('0x30')]=_[_0xf756('0x31')](_0x1b1a93['query']);_0xa3804d[_0xf756('0x32')]=_[_0xf756('0x33')](_0xa3804d['model'],_0xa3804d[_0xf756('0x30')]);_0x4f0d8a[_0xf756('0x35')]=_['intersection'](_0xa3804d[_0xf756('0x2e')],qs['fields'](_0x1b1a93['query'][_0xf756('0x34')]));_0x4f0d8a[_0xf756('0x35')]=_0x4f0d8a['attributes'][_0xf756('0x36')]?_0x4f0d8a[_0xf756('0x35')]:_0xa3804d['model'];if(_0x1b1a93['query'][_0xf756('0x43')]){_0x4f0d8a[_0xf756('0x3f')]=[{'all':!![]}];}_0x4f0d8a=_[_0xf756('0x3c')]({},_0x4f0d8a,_0x1b1a93[_0xf756('0x3e')]);return db[_0xf756('0x29')][_0xf756('0x44')](_0x4f0d8a)[_0xf756('0x23')](handleEntityNotFound(_0x1e1efa,null))['then'](respondWithResult(_0x1e1efa,null))['catch'](handleError(_0x1e1efa,null));};exports[_0xf756('0x45')]=function(_0xf70b8,_0x34365a){return db[_0xf756('0x29')][_0xf756('0x45')](_0xf70b8['body'],{})['then'](respondWithResult(_0x34365a,0xc9))[_0xf756('0x41')](handleError(_0x34365a,null));};exports['update']=function(_0x3b543a,_0x5a3ca2){if(_0x3b543a[_0xf756('0x46')]['id']){delete _0x3b543a[_0xf756('0x46')]['id'];}return db[_0xf756('0x29')]['find']({'where':{'id':_0x3b543a[_0xf756('0x42')]['id']}})[_0xf756('0x23')](handleEntityNotFound(_0x5a3ca2,null))[_0xf756('0x23')](saveUpdates(_0x3b543a['body'],null))[_0xf756('0x23')](respondWithResult(_0x5a3ca2,null))[_0xf756('0x41')](handleError(_0x5a3ca2,null));};exports['destroy']=function(_0x48d859,_0x56045b){return db[_0xf756('0x29')]['find']({'where':{'id':_0x48d859[_0xf756('0x42')]['id']}})[_0xf756('0x23')](handleEntityNotFound(_0x56045b,null))[_0xf756('0x23')](removeEntity(_0x56045b,null))[_0xf756('0x41')](handleError(_0x56045b,null));};exports[_0xf756('0x47')]=function(_0x2f5305,_0x1b4512){return db[_0xf756('0x29')][_0xf756('0x47')]()[_0xf756('0x23')](respondWithResult(_0x1b4512,null))[_0xf756('0x41')](handleError(_0x1b4512,null));};
\ No newline at end of file