Built motion from commit (unavailable).|2.5.15
[motion2.git] / server / api / faxApplication / faxApplication.controller.js
index 448928d..904d40a 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xa37e=['includeAll','findAll','show','params','keys','include','find','catch','create','body','destroy','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','util','path','sox','lodash','jsforce','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','json','count','offset','limit','set','Content-Range','apply','reject','save','update','then','end','stack','name','send','index','map','FaxApplication','rawAttributes','fieldName','type','key','model','query','attributes','intersection','fields','length','nolimit','order','sort','where','filters','pick','filter','merge','options'];(function(_0x83a6e2,_0x255d1a){var _0x255e9f=function(_0x39f38d){while(--_0x39f38d){_0x83a6e2['push'](_0x83a6e2['shift']());}};_0x255e9f(++_0x255d1a);}(_0xa37e,0x97));var _0xea37=function(_0xef3b3a,_0x365898){_0xef3b3a=_0xef3b3a-0x0;var _0x49684b=_0xa37e[_0xef3b3a];return _0x49684b;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0xea37('0x0'));var zipdir=require(_0xea37('0x1'));var jsonpatch=require(_0xea37('0x2'));var rp=require(_0xea37('0x3'));var moment=require('moment');var BPromise=require(_0xea37('0x4'));var Mustache=require('mustache');var util=require(_0xea37('0x5'));var path=require(_0xea37('0x6'));var sox=require(_0xea37('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0xea37('0x8'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xea37('0x9'));var deskjs=require(_0xea37('0xa'));var toCsv=require(_0xea37('0xb'));var querystring=require(_0xea37('0xc'));var Papa=require('papaparse');var Redis=require(_0xea37('0xd'));var authService=require(_0xea37('0xe'));var qs=require(_0xea37('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xea37('0x10'))(_0xea37('0x11'));var utils=require(_0xea37('0x12'));var config=require('../../config/environment');var db=require(_0xea37('0x13'))['db'];function respondWithStatusCode(_0x2a0460,_0x2a2bcd){_0x2a2bcd=_0x2a2bcd||0xcc;return function(_0x589a61){if(_0x589a61){return _0x2a0460[_0xea37('0x14')](_0x2a2bcd);}return _0x2a0460[_0xea37('0x15')](_0x2a2bcd)['end']();};}function respondWithResult(_0x41e9be,_0x556a64){_0x556a64=_0x556a64||0xc8;return function(_0xd7d4e7){if(_0xd7d4e7){return _0x41e9be['status'](_0x556a64)[_0xea37('0x16')](_0xd7d4e7);}};}function respondWithFilteredResult(_0x138ff4,_0x168e80){return function(_0x46aaf0){if(_0x46aaf0){var _0x5b38aa=_0x46aaf0[_0xea37('0x17')],_0x18e4b8=_0x168e80['offset'],_0x58f979=_0x168e80[_0xea37('0x18')]+_0x168e80[_0xea37('0x19')],_0x49604a;if(_0x58f979>=_0x5b38aa){_0x58f979=_0x5b38aa;_0x49604a=0xc8;}else{_0x49604a=0xce;}_0x138ff4['status'](_0x49604a);return _0x138ff4[_0xea37('0x1a')](_0xea37('0x1b'),_0x18e4b8+'-'+_0x58f979+'/'+_0x5b38aa)['json'](_0x46aaf0);}return null;};}function patchUpdates(_0x786ee5){return function(_0x3f5ebc){try{jsonpatch[_0xea37('0x1c')](_0x3f5ebc,_0x786ee5,!![]);}catch(_0x4063ab){return BPromise[_0xea37('0x1d')](_0x4063ab);}return _0x3f5ebc[_0xea37('0x1e')]();};}function saveUpdates(_0x121812,_0x238567){return function(_0x28ed44){if(_0x28ed44){return _0x28ed44[_0xea37('0x1f')](_0x121812)['then'](function(_0x23bb57){return _0x23bb57;});}return null;};}function removeEntity(_0x2a81f5,_0x356f04){return function(_0x536eff){if(_0x536eff){return _0x536eff['destroy']()[_0xea37('0x20')](function(){_0x2a81f5[_0xea37('0x15')](0xcc)[_0xea37('0x21')]();});}};}function handleEntityNotFound(_0x4302ca,_0x4996e9){return function(_0x25042e){if(!_0x25042e){_0x4302ca['sendStatus'](0x194);}return _0x25042e;};}function handleError(_0x5907ce,_0x5503f1){_0x5503f1=_0x5503f1||0x1f4;return function(_0x32c116){logger['error'](_0x32c116[_0xea37('0x22')]);if(_0x32c116[_0xea37('0x23')]){delete _0x32c116[_0xea37('0x23')];}_0x5907ce[_0xea37('0x15')](_0x5503f1)[_0xea37('0x24')](_0x32c116);};}exports[_0xea37('0x25')]=function(_0x49cb6c,_0x57a7cc){var _0x55880c={},_0x477e25={},_0x3e272e={'count':0x0,'rows':[]};var _0x4ffcf1=_[_0xea37('0x26')](db[_0xea37('0x27')][_0xea37('0x28')],function(_0x4e2a65){return{'name':_0x4e2a65[_0xea37('0x29')],'type':_0x4e2a65[_0xea37('0x2a')][_0xea37('0x2b')]};});_0x477e25[_0xea37('0x2c')]=_['map'](_0x4ffcf1,_0xea37('0x23'));_0x477e25['query']=_['keys'](_0x49cb6c[_0xea37('0x2d')]);_0x477e25['filters']=_['intersection'](_0x477e25['model'],_0x477e25[_0xea37('0x2d')]);_0x55880c[_0xea37('0x2e')]=_[_0xea37('0x2f')](_0x477e25[_0xea37('0x2c')],qs[_0xea37('0x30')](_0x49cb6c[_0xea37('0x2d')]['fields']));_0x55880c[_0xea37('0x2e')]=_0x55880c[_0xea37('0x2e')][_0xea37('0x31')]?_0x55880c[_0xea37('0x2e')]:_0x477e25[_0xea37('0x2c')];if(!_0x49cb6c[_0xea37('0x2d')]['hasOwnProperty'](_0xea37('0x32'))){_0x55880c['limit']=qs[_0xea37('0x19')](_0x49cb6c[_0xea37('0x2d')][_0xea37('0x19')]);_0x55880c[_0xea37('0x18')]=qs[_0xea37('0x18')](_0x49cb6c[_0xea37('0x2d')][_0xea37('0x18')]);}_0x55880c[_0xea37('0x33')]=qs['sort'](_0x49cb6c[_0xea37('0x2d')][_0xea37('0x34')]);_0x55880c[_0xea37('0x35')]=qs[_0xea37('0x36')](_[_0xea37('0x37')](_0x49cb6c[_0xea37('0x2d')],_0x477e25['filters']));if(_0x49cb6c['query']['filter']){_0x55880c[_0xea37('0x35')]=_['merge'](_0x55880c[_0xea37('0x35')],{'$or':_['map'](_0x4ffcf1,function(_0x5e91ef){if(_0x5e91ef['type']!=='VIRTUAL'){var _0x3ceede={};_0x3ceede[_0x5e91ef[_0xea37('0x23')]]={'$like':'%'+_0x49cb6c[_0xea37('0x2d')][_0xea37('0x38')]+'%'};return _0x3ceede;}})});}_0x55880c=_[_0xea37('0x39')]({},_0x55880c,_0x49cb6c[_0xea37('0x3a')]);var _0x18da6e={'where':_0x55880c[_0xea37('0x35')]};return db[_0xea37('0x27')]['count'](_0x18da6e)[_0xea37('0x20')](function(_0x565c66){_0x3e272e[_0xea37('0x17')]=_0x565c66;if(_0x49cb6c[_0xea37('0x2d')][_0xea37('0x3b')]){_0x55880c['include']=[{'all':!![]}];}return db[_0xea37('0x27')][_0xea37('0x3c')](_0x55880c);})[_0xea37('0x20')](function(_0x457b77){_0x3e272e['rows']=_0x457b77;return _0x3e272e;})[_0xea37('0x20')](respondWithFilteredResult(_0x57a7cc,_0x55880c))['catch'](handleError(_0x57a7cc,null));};exports[_0xea37('0x3d')]=function(_0x383101,_0x30c247){var _0x847051={'raw':!![],'where':{'id':_0x383101[_0xea37('0x3e')]['id']}},_0x3c1b8a={};_0x3c1b8a['model']=_[_0xea37('0x3f')](db[_0xea37('0x27')]['rawAttributes']);_0x3c1b8a[_0xea37('0x2d')]=_[_0xea37('0x3f')](_0x383101[_0xea37('0x2d')]);_0x3c1b8a[_0xea37('0x36')]=_[_0xea37('0x2f')](_0x3c1b8a[_0xea37('0x2c')],_0x3c1b8a[_0xea37('0x2d')]);_0x847051[_0xea37('0x2e')]=_[_0xea37('0x2f')](_0x3c1b8a[_0xea37('0x2c')],qs[_0xea37('0x30')](_0x383101[_0xea37('0x2d')][_0xea37('0x30')]));_0x847051[_0xea37('0x2e')]=_0x847051[_0xea37('0x2e')][_0xea37('0x31')]?_0x847051[_0xea37('0x2e')]:_0x3c1b8a['model'];if(_0x383101[_0xea37('0x2d')][_0xea37('0x3b')]){_0x847051[_0xea37('0x40')]=[{'all':!![]}];}_0x847051=_[_0xea37('0x39')]({},_0x847051,_0x383101[_0xea37('0x3a')]);return db['FaxApplication'][_0xea37('0x41')](_0x847051)[_0xea37('0x20')](handleEntityNotFound(_0x30c247,null))[_0xea37('0x20')](respondWithResult(_0x30c247,null))[_0xea37('0x42')](handleError(_0x30c247,null));};exports[_0xea37('0x43')]=function(_0x1124cf,_0x4f3222){return db[_0xea37('0x27')][_0xea37('0x43')](_0x1124cf[_0xea37('0x44')],{})[_0xea37('0x20')](respondWithResult(_0x4f3222,0xc9))[_0xea37('0x42')](handleError(_0x4f3222,null));};exports[_0xea37('0x1f')]=function(_0x2cd612,_0x3dd82b){if(_0x2cd612['body']['id']){delete _0x2cd612[_0xea37('0x44')]['id'];}return db[_0xea37('0x27')]['find']({'where':{'id':_0x2cd612[_0xea37('0x3e')]['id']}})[_0xea37('0x20')](handleEntityNotFound(_0x3dd82b,null))[_0xea37('0x20')](saveUpdates(_0x2cd612[_0xea37('0x44')],null))[_0xea37('0x20')](respondWithResult(_0x3dd82b,null))[_0xea37('0x42')](handleError(_0x3dd82b,null));};exports[_0xea37('0x45')]=function(_0x174a77,_0x483d1a){return db[_0xea37('0x27')]['find']({'where':{'id':_0x174a77[_0xea37('0x3e')]['id']}})['then'](handleEntityNotFound(_0x483d1a,null))[_0xea37('0x20')](removeEntity(_0x483d1a,null))[_0xea37('0x42')](handleError(_0x483d1a,null));};
\ No newline at end of file
+var _0xb3fe=['papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/license/util','status','end','count','offset','limit','set','json','apply','reject','save','then','destroy','sendStatus','error','stack','name','index','FaxApplication','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','where','pick','filter','VIRTUAL','merge','includeAll','include','findAll','rows','catch','params','options','create','body','update','find','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','squel','jsforce','desk.js','querystring'];(function(_0x277cbd,_0x2cd973){var _0x2231ec=function(_0x2a19a8){while(--_0x2a19a8){_0x277cbd['push'](_0x277cbd['shift']());}};_0x2231ec(++_0x2cd973);}(_0xb3fe,0x84));var _0xeb3f=function(_0x37f1c5,_0x24bb5a){_0x37f1c5=_0x37f1c5-0x0;var _0x4488f6=_0xb3fe[_0x37f1c5];return _0x4488f6;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0xeb3f('0x0'));var zipdir=require(_0xeb3f('0x1'));var jsonpatch=require(_0xeb3f('0x2'));var rp=require(_0xeb3f('0x3'));var moment=require(_0xeb3f('0x4'));var BPromise=require(_0xeb3f('0x5'));var Mustache=require(_0xeb3f('0x6'));var util=require(_0xeb3f('0x7'));var path=require(_0xeb3f('0x8'));var sox=require('sox');var csv=require(_0xeb3f('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0xeb3f('0xa'));var crypto=require('crypto');var jsforce=require(_0xeb3f('0xb'));var deskjs=require(_0xeb3f('0xc'));var toCsv=require(_0xeb3f('0x9'));var querystring=require(_0xeb3f('0xd'));var Papa=require(_0xeb3f('0xe'));var Redis=require(_0xeb3f('0xf'));var authService=require(_0xeb3f('0x10'));var qs=require(_0xeb3f('0x11'));var as=require(_0xeb3f('0x12'));var hardwareService=require(_0xeb3f('0x13'));var logger=require(_0xeb3f('0x14'))(_0xeb3f('0x15'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xeb3f('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x51f654,_0x5eaf82){_0x5eaf82=_0x5eaf82||0xcc;return function(_0x41bb06){if(_0x41bb06){return _0x51f654['sendStatus'](_0x5eaf82);}return _0x51f654[_0xeb3f('0x17')](_0x5eaf82)[_0xeb3f('0x18')]();};}function respondWithResult(_0x2a2cc4,_0xe12570){_0xe12570=_0xe12570||0xc8;return function(_0x2bf6ae){if(_0x2bf6ae){return _0x2a2cc4[_0xeb3f('0x17')](_0xe12570)['json'](_0x2bf6ae);}};}function respondWithFilteredResult(_0x42a7e0,_0x2895d9){return function(_0x5bf8c8){if(_0x5bf8c8){var _0x4d434d=_0x5bf8c8[_0xeb3f('0x19')],_0x27138a=_0x2895d9[_0xeb3f('0x1a')],_0x4f0582=_0x2895d9['offset']+_0x2895d9[_0xeb3f('0x1b')],_0x3afbde;if(_0x4f0582>=_0x4d434d){_0x4f0582=_0x4d434d;_0x3afbde=0xc8;}else{_0x3afbde=0xce;}_0x42a7e0['status'](_0x3afbde);return _0x42a7e0[_0xeb3f('0x1c')]('Content-Range',_0x27138a+'-'+_0x4f0582+'/'+_0x4d434d)[_0xeb3f('0x1d')](_0x5bf8c8);}return null;};}function patchUpdates(_0x580164){return function(_0x4ba50b){try{jsonpatch[_0xeb3f('0x1e')](_0x4ba50b,_0x580164,!![]);}catch(_0x1a1519){return BPromise[_0xeb3f('0x1f')](_0x1a1519);}return _0x4ba50b[_0xeb3f('0x20')]();};}function saveUpdates(_0x5093d3,_0x5c4a73){return function(_0x572a84){if(_0x572a84){return _0x572a84['update'](_0x5093d3)[_0xeb3f('0x21')](function(_0x3f4931){return _0x3f4931;});}return null;};}function removeEntity(_0x317dcf,_0x5602a6){return function(_0x11bbce){if(_0x11bbce){return _0x11bbce[_0xeb3f('0x22')]()[_0xeb3f('0x21')](function(){_0x317dcf[_0xeb3f('0x17')](0xcc)[_0xeb3f('0x18')]();});}};}function handleEntityNotFound(_0x485c8e,_0x1d2b6f){return function(_0x1d9b61){if(!_0x1d9b61){_0x485c8e[_0xeb3f('0x23')](0x194);}return _0x1d9b61;};}function handleError(_0xa138ec,_0x4c543d){_0x4c543d=_0x4c543d||0x1f4;return function(_0x5b8fc1){logger[_0xeb3f('0x24')](_0x5b8fc1[_0xeb3f('0x25')]);if(_0x5b8fc1['name']){delete _0x5b8fc1[_0xeb3f('0x26')];}_0xa138ec[_0xeb3f('0x17')](_0x4c543d)['send'](_0x5b8fc1);};}exports[_0xeb3f('0x27')]=function(_0x183fe4,_0x3f177c){var _0x973837={},_0x1f8a30={},_0x4df96b={'count':0x0,'rows':[]};var _0x3b2853=_['map'](db[_0xeb3f('0x28')][_0xeb3f('0x29')],function(_0x2a2e40){return{'name':_0x2a2e40[_0xeb3f('0x2a')],'type':_0x2a2e40[_0xeb3f('0x2b')][_0xeb3f('0x2c')]};});_0x1f8a30[_0xeb3f('0x2d')]=_[_0xeb3f('0x2e')](_0x3b2853,_0xeb3f('0x26'));_0x1f8a30[_0xeb3f('0x2f')]=_[_0xeb3f('0x30')](_0x183fe4['query']);_0x1f8a30[_0xeb3f('0x31')]=_[_0xeb3f('0x32')](_0x1f8a30[_0xeb3f('0x2d')],_0x1f8a30['query']);_0x973837[_0xeb3f('0x33')]=_['intersection'](_0x1f8a30[_0xeb3f('0x2d')],qs[_0xeb3f('0x34')](_0x183fe4[_0xeb3f('0x2f')]['fields']));_0x973837[_0xeb3f('0x33')]=_0x973837['attributes'][_0xeb3f('0x35')]?_0x973837[_0xeb3f('0x33')]:_0x1f8a30[_0xeb3f('0x2d')];if(!_0x183fe4[_0xeb3f('0x2f')][_0xeb3f('0x36')](_0xeb3f('0x37'))){_0x973837['limit']=qs[_0xeb3f('0x1b')](_0x183fe4[_0xeb3f('0x2f')][_0xeb3f('0x1b')]);_0x973837['offset']=qs[_0xeb3f('0x1a')](_0x183fe4[_0xeb3f('0x2f')][_0xeb3f('0x1a')]);}_0x973837[_0xeb3f('0x38')]=qs['sort'](_0x183fe4[_0xeb3f('0x2f')]['sort']);_0x973837[_0xeb3f('0x39')]=qs[_0xeb3f('0x31')](_[_0xeb3f('0x3a')](_0x183fe4['query'],_0x1f8a30['filters']),_0x3b2853);if(_0x183fe4[_0xeb3f('0x2f')][_0xeb3f('0x3b')]){_0x973837[_0xeb3f('0x39')]=_['merge'](_0x973837[_0xeb3f('0x39')],{'$or':_[_0xeb3f('0x2e')](_0x3b2853,function(_0x3a8b93){if(_0x3a8b93[_0xeb3f('0x2b')]!==_0xeb3f('0x3c')){var _0x2c1e97={};_0x2c1e97[_0x3a8b93[_0xeb3f('0x26')]]={'$like':'%'+_0x183fe4[_0xeb3f('0x2f')][_0xeb3f('0x3b')]+'%'};return _0x2c1e97;}})});}_0x973837=_[_0xeb3f('0x3d')]({},_0x973837,_0x183fe4['options']);var _0x136981={'where':_0x973837[_0xeb3f('0x39')]};return db[_0xeb3f('0x28')][_0xeb3f('0x19')](_0x136981)[_0xeb3f('0x21')](function(_0x195228){_0x4df96b[_0xeb3f('0x19')]=_0x195228;if(_0x183fe4[_0xeb3f('0x2f')][_0xeb3f('0x3e')]){_0x973837[_0xeb3f('0x3f')]=[{'all':!![]}];}return db[_0xeb3f('0x28')][_0xeb3f('0x40')](_0x973837);})[_0xeb3f('0x21')](function(_0x33a2fc){_0x4df96b[_0xeb3f('0x41')]=_0x33a2fc;return _0x4df96b;})[_0xeb3f('0x21')](respondWithFilteredResult(_0x3f177c,_0x973837))[_0xeb3f('0x42')](handleError(_0x3f177c,null));};exports['show']=function(_0x3690c5,_0x549015){var _0x30d7d2={'raw':!![],'where':{'id':_0x3690c5[_0xeb3f('0x43')]['id']}},_0x27c4b0={};_0x27c4b0[_0xeb3f('0x2d')]=_[_0xeb3f('0x30')](db[_0xeb3f('0x28')][_0xeb3f('0x29')]);_0x27c4b0[_0xeb3f('0x2f')]=_['keys'](_0x3690c5[_0xeb3f('0x2f')]);_0x27c4b0[_0xeb3f('0x31')]=_['intersection'](_0x27c4b0[_0xeb3f('0x2d')],_0x27c4b0[_0xeb3f('0x2f')]);_0x30d7d2[_0xeb3f('0x33')]=_['intersection'](_0x27c4b0[_0xeb3f('0x2d')],qs[_0xeb3f('0x34')](_0x3690c5['query'][_0xeb3f('0x34')]));_0x30d7d2['attributes']=_0x30d7d2['attributes'][_0xeb3f('0x35')]?_0x30d7d2[_0xeb3f('0x33')]:_0x27c4b0['model'];if(_0x3690c5['query'][_0xeb3f('0x3e')]){_0x30d7d2['include']=[{'all':!![]}];}_0x30d7d2=_[_0xeb3f('0x3d')]({},_0x30d7d2,_0x3690c5[_0xeb3f('0x44')]);return db['FaxApplication']['find'](_0x30d7d2)['then'](handleEntityNotFound(_0x549015,null))[_0xeb3f('0x21')](respondWithResult(_0x549015,null))[_0xeb3f('0x42')](handleError(_0x549015,null));};exports[_0xeb3f('0x45')]=function(_0x4a0846,_0x537bae){return db[_0xeb3f('0x28')][_0xeb3f('0x45')](_0x4a0846[_0xeb3f('0x46')],{})['then'](respondWithResult(_0x537bae,0xc9))['catch'](handleError(_0x537bae,null));};exports[_0xeb3f('0x47')]=function(_0x3faacd,_0x3b24bf){if(_0x3faacd[_0xeb3f('0x46')]['id']){delete _0x3faacd[_0xeb3f('0x46')]['id'];}return db[_0xeb3f('0x28')][_0xeb3f('0x48')]({'where':{'id':_0x3faacd[_0xeb3f('0x43')]['id']}})[_0xeb3f('0x21')](handleEntityNotFound(_0x3b24bf,null))[_0xeb3f('0x21')](saveUpdates(_0x3faacd[_0xeb3f('0x46')],null))['then'](respondWithResult(_0x3b24bf,null))[_0xeb3f('0x42')](handleError(_0x3b24bf,null));};exports[_0xeb3f('0x22')]=function(_0x482edc,_0x527d64){return db[_0xeb3f('0x28')][_0xeb3f('0x48')]({'where':{'id':_0x482edc[_0xeb3f('0x43')]['id']}})['then'](handleEntityNotFound(_0x527d64,null))[_0xeb3f('0x21')](removeEntity(_0x527d64,null))['catch'](handleError(_0x527d64,null));};
\ No newline at end of file