Built motion from commit 775e2a94.|2.6.3
[motion2.git] / server / api / faxApplication / faxApplication.controller.js
index 448928d..9811285 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 _0xed9b=['sort','where','pick','filter','merge','VIRTUAL','options','then','findAll','catch','show','params','rawAttributes','includeAll','include','find','create','body','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','undefined','limit','count','offset','set','Content-Range','apply','reject','save','update','destroy','end','stack','name','index','map','FaxApplication','fieldName','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order'];(function(_0x37dbe8,_0x10e968){var _0x2416b6=function(_0xd39957){while(--_0xd39957){_0x37dbe8['push'](_0x37dbe8['shift']());}};_0x2416b6(++_0x10e968);}(_0xed9b,0x193));var _0xbed9=function(_0x2ff762,_0x342c0b){_0x2ff762=_0x2ff762-0x0;var _0x158b02=_0xed9b[_0x2ff762];return _0x158b02;};'use strict';var emlformat=require(_0xbed9('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xbed9('0x1'));var jsonpatch=require(_0xbed9('0x2'));var rp=require(_0xbed9('0x3'));var moment=require(_0xbed9('0x4'));var BPromise=require(_0xbed9('0x5'));var Mustache=require(_0xbed9('0x6'));var util=require(_0xbed9('0x7'));var path=require(_0xbed9('0x8'));var sox=require(_0xbed9('0x9'));var csv=require('to-csv');var ejs=require(_0xbed9('0xa'));var fs=require('fs');var fs_extra=require(_0xbed9('0xb'));var _=require(_0xbed9('0xc'));var squel=require(_0xbed9('0xd'));var crypto=require(_0xbed9('0xe'));var jsforce=require(_0xbed9('0xf'));var deskjs=require('desk.js');var toCsv=require(_0xbed9('0x10'));var querystring=require(_0xbed9('0x11'));var Papa=require(_0xbed9('0x12'));var Redis=require(_0xbed9('0x13'));var authService=require(_0xbed9('0x14'));var qs=require('../../components/parsers/qs');var as=require(_0xbed9('0x15'));var hardwareService=require(_0xbed9('0x16'));var logger=require(_0xbed9('0x17'))('api');var utils=require('../../config/utils');var config=require(_0xbed9('0x18'));var licenseUtil=require(_0xbed9('0x19'));var db=require(_0xbed9('0x1a'))['db'];function respondWithStatusCode(_0x364bbb,_0x2f10c0){_0x2f10c0=_0x2f10c0||0xcc;return function(_0x34face){if(_0x34face){return _0x364bbb[_0xbed9('0x1b')](_0x2f10c0);}return _0x364bbb[_0xbed9('0x1c')](_0x2f10c0)['end']();};}function respondWithResult(_0x166195,_0x16a30f){_0x16a30f=_0x16a30f||0xc8;return function(_0x22641b){if(_0x22641b){return _0x166195[_0xbed9('0x1c')](_0x16a30f)[_0xbed9('0x1d')](_0x22641b);}};}function respondWithFilteredResult(_0x52b0b0,_0x29fc03){return function(_0x3ae001){if(_0x3ae001){var _0x19be0f=typeof _0x29fc03['offset']===_0xbed9('0x1e')&&typeof _0x29fc03[_0xbed9('0x1f')]===_0xbed9('0x1e');var _0x32c611=_0x3ae001[_0xbed9('0x20')];var _0x3f6d8d=_0x19be0f?0x0:_0x29fc03['offset'];var _0x399a1a=_0x19be0f?_0x3ae001['count']:_0x29fc03[_0xbed9('0x21')]+_0x29fc03[_0xbed9('0x1f')];var _0x46062a;if(_0x399a1a>=_0x32c611){_0x399a1a=_0x32c611;_0x46062a=0xc8;}else{_0x46062a=0xce;}_0x52b0b0['status'](_0x46062a);return _0x52b0b0[_0xbed9('0x22')](_0xbed9('0x23'),_0x3f6d8d+'-'+_0x399a1a+'/'+_0x32c611)[_0xbed9('0x1d')](_0x3ae001);}return null;};}function patchUpdates(_0x6493d0){return function(_0x34672f){try{jsonpatch[_0xbed9('0x24')](_0x34672f,_0x6493d0,!![]);}catch(_0x5898bf){return BPromise[_0xbed9('0x25')](_0x5898bf);}return _0x34672f[_0xbed9('0x26')]();};}function saveUpdates(_0x3f197a,_0x4db180){return function(_0x5f015f){if(_0x5f015f){return _0x5f015f[_0xbed9('0x27')](_0x3f197a)['then'](function(_0x1510a0){return _0x1510a0;});}return null;};}function removeEntity(_0x240dc4,_0x22bbf2){return function(_0x5d1852){if(_0x5d1852){return _0x5d1852[_0xbed9('0x28')]()['then'](function(){_0x240dc4[_0xbed9('0x1c')](0xcc)[_0xbed9('0x29')]();});}};}function handleEntityNotFound(_0xce85c7,_0x3bee17){return function(_0x153bc1){if(!_0x153bc1){_0xce85c7[_0xbed9('0x1b')](0x194);}return _0x153bc1;};}function handleError(_0x623894,_0x5938c5){_0x5938c5=_0x5938c5||0x1f4;return function(_0x414d8f){logger['error'](_0x414d8f[_0xbed9('0x2a')]);if(_0x414d8f[_0xbed9('0x2b')]){delete _0x414d8f[_0xbed9('0x2b')];}_0x623894['status'](_0x5938c5)['send'](_0x414d8f);};}exports[_0xbed9('0x2c')]=function(_0x4e1705,_0x340ba0){var _0x3b0f0a={},_0x1e6701={},_0x26fd86={'count':0x0,'rows':[]};var _0x346191=_[_0xbed9('0x2d')](db[_0xbed9('0x2e')]['rawAttributes'],function(_0x3de4b7){return{'name':_0x3de4b7[_0xbed9('0x2f')],'type':_0x3de4b7['type']['key']};});_0x1e6701[_0xbed9('0x30')]=_['map'](_0x346191,_0xbed9('0x2b'));_0x1e6701[_0xbed9('0x31')]=_[_0xbed9('0x32')](_0x4e1705[_0xbed9('0x31')]);_0x1e6701[_0xbed9('0x33')]=_[_0xbed9('0x34')](_0x1e6701[_0xbed9('0x30')],_0x1e6701[_0xbed9('0x31')]);_0x3b0f0a[_0xbed9('0x35')]=_[_0xbed9('0x34')](_0x1e6701[_0xbed9('0x30')],qs[_0xbed9('0x36')](_0x4e1705[_0xbed9('0x31')][_0xbed9('0x36')]));_0x3b0f0a[_0xbed9('0x35')]=_0x3b0f0a[_0xbed9('0x35')][_0xbed9('0x37')]?_0x3b0f0a[_0xbed9('0x35')]:_0x1e6701[_0xbed9('0x30')];if(!_0x4e1705[_0xbed9('0x31')][_0xbed9('0x38')](_0xbed9('0x39'))){_0x3b0f0a['limit']=qs[_0xbed9('0x1f')](_0x4e1705['query'][_0xbed9('0x1f')]);_0x3b0f0a[_0xbed9('0x21')]=qs[_0xbed9('0x21')](_0x4e1705[_0xbed9('0x31')][_0xbed9('0x21')]);}_0x3b0f0a[_0xbed9('0x3a')]=qs[_0xbed9('0x3b')](_0x4e1705[_0xbed9('0x31')][_0xbed9('0x3b')]);_0x3b0f0a[_0xbed9('0x3c')]=qs['filters'](_[_0xbed9('0x3d')](_0x4e1705['query'],_0x1e6701[_0xbed9('0x33')]),_0x346191);if(_0x4e1705[_0xbed9('0x31')][_0xbed9('0x3e')]){_0x3b0f0a['where']=_[_0xbed9('0x3f')](_0x3b0f0a[_0xbed9('0x3c')],{'$or':_[_0xbed9('0x2d')](_0x346191,function(_0x3a8787){if(_0x3a8787['type']!==_0xbed9('0x40')){var _0x126ec2={};_0x126ec2[_0x3a8787['name']]={'$like':'%'+_0x4e1705[_0xbed9('0x31')][_0xbed9('0x3e')]+'%'};return _0x126ec2;}})});}_0x3b0f0a=_[_0xbed9('0x3f')]({},_0x3b0f0a,_0x4e1705[_0xbed9('0x41')]);var _0x31e6ba={'where':_0x3b0f0a[_0xbed9('0x3c')]};return db[_0xbed9('0x2e')][_0xbed9('0x20')](_0x31e6ba)[_0xbed9('0x42')](function(_0x553a4a){_0x26fd86[_0xbed9('0x20')]=_0x553a4a;if(_0x4e1705[_0xbed9('0x31')]['includeAll']){_0x3b0f0a['include']=[{'all':!![]}];}return db['FaxApplication'][_0xbed9('0x43')](_0x3b0f0a);})[_0xbed9('0x42')](function(_0x8f3185){_0x26fd86['rows']=_0x8f3185;return _0x26fd86;})[_0xbed9('0x42')](respondWithFilteredResult(_0x340ba0,_0x3b0f0a))[_0xbed9('0x44')](handleError(_0x340ba0,null));};exports[_0xbed9('0x45')]=function(_0x12df9b,_0x1266a0){var _0x4d79c8={'raw':!![],'where':{'id':_0x12df9b[_0xbed9('0x46')]['id']}},_0x3b2191={};_0x3b2191[_0xbed9('0x30')]=_['keys'](db['FaxApplication'][_0xbed9('0x47')]);_0x3b2191['query']=_[_0xbed9('0x32')](_0x12df9b['query']);_0x3b2191[_0xbed9('0x33')]=_['intersection'](_0x3b2191['model'],_0x3b2191['query']);_0x4d79c8[_0xbed9('0x35')]=_[_0xbed9('0x34')](_0x3b2191[_0xbed9('0x30')],qs[_0xbed9('0x36')](_0x12df9b['query']['fields']));_0x4d79c8[_0xbed9('0x35')]=_0x4d79c8[_0xbed9('0x35')]['length']?_0x4d79c8[_0xbed9('0x35')]:_0x3b2191[_0xbed9('0x30')];if(_0x12df9b['query'][_0xbed9('0x48')]){_0x4d79c8[_0xbed9('0x49')]=[{'all':!![]}];}_0x4d79c8=_[_0xbed9('0x3f')]({},_0x4d79c8,_0x12df9b[_0xbed9('0x41')]);return db[_0xbed9('0x2e')][_0xbed9('0x4a')](_0x4d79c8)[_0xbed9('0x42')](handleEntityNotFound(_0x1266a0,null))[_0xbed9('0x42')](respondWithResult(_0x1266a0,null))[_0xbed9('0x44')](handleError(_0x1266a0,null));};exports['create']=function(_0x5c03fe,_0x3f2695){return db['FaxApplication'][_0xbed9('0x4b')](_0x5c03fe[_0xbed9('0x4c')],{})[_0xbed9('0x42')](respondWithResult(_0x3f2695,0xc9))['catch'](handleError(_0x3f2695,null));};exports[_0xbed9('0x27')]=function(_0x4e908c,_0x49afd2){if(_0x4e908c[_0xbed9('0x4c')]['id']){delete _0x4e908c[_0xbed9('0x4c')]['id'];}return db[_0xbed9('0x2e')]['find']({'where':{'id':_0x4e908c['params']['id']}})[_0xbed9('0x42')](handleEntityNotFound(_0x49afd2,null))[_0xbed9('0x42')](saveUpdates(_0x4e908c[_0xbed9('0x4c')],null))[_0xbed9('0x42')](respondWithResult(_0x49afd2,null))[_0xbed9('0x44')](handleError(_0x49afd2,null));};exports['destroy']=function(_0x5c3297,_0x1e126c){return db[_0xbed9('0x2e')][_0xbed9('0x4a')]({'where':{'id':_0x5c3297['params']['id']}})[_0xbed9('0x42')](handleEntityNotFound(_0x1e126c,null))[_0xbed9('0x42')](removeEntity(_0x1e126c,null))[_0xbed9('0x44')](handleError(_0x1e126c,null));};
\ No newline at end of file