Built motion from commit ecf5ab8ec560fd4c6972692268e350fcef2f38e7. Version 3.0.0...
[motion-next.git] / server / api / faxApplication / faxApplication.controller.js
1 const a193_0x2246=['../../config/logger','set','options','undefined','where','stack','pick','model','query','name','filter','end','map','attributes','FaxApplication','offset','create','rawAttributes','json','status','../../components/parsers/qs','sequelize','show','nolimit','then','destroy','keys','count','body','type','merge','intersection','key','sendStatus','VIRTUAL','catch','index','fields','includeAll','length','update','params','limit','findOne','rows','include','filters','sort'];(function(_0x237c15,_0x2246eb){const _0xb435=function(_0x1d641c){while(--_0x1d641c){_0x237c15['push'](_0x237c15['shift']());}};_0xb435(++_0x2246eb);}(a193_0x2246,0x17d));const a193_0xb435=function(_0x237c15,_0x2246eb){_0x237c15=_0x237c15-0x0;let _0xb435=a193_0x2246[_0x237c15];return _0xb435;};const _0xf3a3ce=a193_0xb435;'use strict';const _=require('lodash'),qs=require(_0xf3a3ce('0x17')),logger=require(_0xf3a3ce('0x3'))('api'),db=require('../../mysqldb')['db'],{Op}=require(_0xf3a3ce('0x18'));function respondWithResult(_0x1d641c,_0x15f5d3){return _0x15f5d3=_0x15f5d3||0xc8,function(_0x7d61c4){const _0x129b5a=a193_0xb435;if(_0x7d61c4)return _0x1d641c['status'](_0x15f5d3)[_0x129b5a('0x15')](_0x7d61c4);};}function respondWithFilteredResult(_0x18589e,_0x4075be){return function(_0x51d49b){const _0x12edd7=a193_0xb435;if(_0x51d49b){const _0x40e79f=_0x51d49b[_0x12edd7('0x1e')],_0x322dd7=_0x4075be['offset'];let _0x53fdd3=_0x4075be[_0x12edd7('0x12')]+_0x4075be['limit'],_0x3d1b3a;return _0x53fdd3>=_0x40e79f?(_0x53fdd3=_0x40e79f,_0x3d1b3a=0xc8):_0x3d1b3a=0xce,_0x18589e['status'](_0x3d1b3a),_0x18589e[_0x12edd7('0x4')]('Content-Range',_0x322dd7+'-'+_0x53fdd3+'/'+_0x40e79f)['json'](_0x51d49b);}return null;};}function saveUpdates(_0x299292){return function(_0x4e7f4a){const _0x4c6bd3=a193_0xb435;if(_0x4e7f4a)return _0x4e7f4a['update'](_0x299292)[_0x4c6bd3('0x1b')](function(_0xf57f3b){return _0xf57f3b;});return null;};}function removeEntity(_0x178a2e){return function(_0x2b6e7f){const _0x2fe754=a193_0xb435;if(_0x2b6e7f)return _0x2b6e7f[_0x2fe754('0x1c')]()[_0x2fe754('0x1b')](function(){const _0x42eb28=_0x2fe754;_0x178a2e[_0x42eb28('0x16')](0xcc)[_0x42eb28('0xe')]();});};}function handleEntityNotFound(_0x5a3d0e){return function(_0x165879){const _0x1b4b72=a193_0xb435;return!_0x165879&&_0x5a3d0e[_0x1b4b72('0x24')](0x194),_0x165879;};}function handleError(_0x424063,_0x3be48d){return _0x3be48d=_0x3be48d||0x1f4,function(_0x36ffea){const _0x16caaf=a193_0xb435;logger['error'](_0x36ffea[_0x16caaf('0x8')]),_0x36ffea[_0x16caaf('0xc')]&&delete _0x36ffea['name'],_0x424063['status'](_0x3be48d)['send'](_0x36ffea);};}exports[_0xf3a3ce('0x27')]=function(_0x3af0dd,_0x5a3472){const _0x3bf51d=_0xf3a3ce;let _0x32a1ae={};const _0xd3ffdb={},_0x5a8abc={'count':0x0,'rows':[]},_0x27e6eb=_[_0x3bf51d('0xf')](db[_0x3bf51d('0x11')]['rawAttributes'],function(_0x8282f6){const _0x4672bc=_0x3bf51d;return{'name':_0x8282f6['fieldName'],'type':_0x8282f6['type'][_0x4672bc('0x23')]};});_0xd3ffdb[_0x3bf51d('0xa')]=_['map'](_0x27e6eb,_0x3bf51d('0xc')),_0xd3ffdb[_0x3bf51d('0xb')]=_[_0x3bf51d('0x1d')](_0x3af0dd[_0x3bf51d('0xb')]),_0xd3ffdb[_0x3bf51d('0x1')]=_['intersection'](_0xd3ffdb['model'],_0xd3ffdb[_0x3bf51d('0xb')]),_0x32a1ae[_0x3bf51d('0x10')]=_[_0x3bf51d('0x22')](_0xd3ffdb[_0x3bf51d('0xa')],qs[_0x3bf51d('0x28')](_0x3af0dd[_0x3bf51d('0xb')][_0x3bf51d('0x28')])),_0x32a1ae[_0x3bf51d('0x10')]=_0x32a1ae[_0x3bf51d('0x10')]['length']?_0x32a1ae[_0x3bf51d('0x10')]:_0xd3ffdb[_0x3bf51d('0xa')];typeof _0x3af0dd['query'][_0x3bf51d('0x1a')]===_0x3bf51d('0x6')&&(_0x32a1ae[_0x3bf51d('0x2d')]=qs['limit'](_0x3af0dd[_0x3bf51d('0xb')][_0x3bf51d('0x2d')]),_0x32a1ae[_0x3bf51d('0x12')]=qs[_0x3bf51d('0x12')](_0x3af0dd['query']['offset']));_0x32a1ae['order']=qs[_0x3bf51d('0x2')](_0x3af0dd[_0x3bf51d('0xb')][_0x3bf51d('0x2')]),_0x32a1ae[_0x3bf51d('0x7')]=qs[_0x3bf51d('0x1')](_[_0x3bf51d('0x9')](_0x3af0dd['query'],_0xd3ffdb[_0x3bf51d('0x1')]),_0x27e6eb);_0x3af0dd[_0x3bf51d('0xb')]['filter']&&(_0x32a1ae[_0x3bf51d('0x7')]=_[_0x3bf51d('0x21')](_0x32a1ae[_0x3bf51d('0x7')],{[Op['or']]:_['map'](_0x27e6eb,function(_0x11c084){const _0x388772=_0x3bf51d;if(_0x11c084[_0x388772('0x20')]!==_0x388772('0x25')){const _0x5b4542={};return _0x5b4542[_0x11c084[_0x388772('0xc')]]={[Op['like']]:'%'+_0x3af0dd[_0x388772('0xb')][_0x388772('0xd')]+'%'},_0x5b4542;}})}));_0x32a1ae=_[_0x3bf51d('0x21')]({},_0x32a1ae,_0x3af0dd[_0x3bf51d('0x5')]);const _0xd3241f={'where':_0x32a1ae[_0x3bf51d('0x7')]};return db[_0x3bf51d('0x11')][_0x3bf51d('0x1e')](_0xd3241f)[_0x3bf51d('0x1b')](function(_0x2d39c4){const _0x18e2ba=_0x3bf51d;return _0x5a8abc[_0x18e2ba('0x1e')]=_0x2d39c4,_0x3af0dd[_0x18e2ba('0xb')][_0x18e2ba('0x29')]&&(_0x32a1ae['include']=[{'all':!![]}]),db['FaxApplication']['findAll'](_0x32a1ae);})[_0x3bf51d('0x1b')](function(_0x5d9928){const _0x40fb54=_0x3bf51d;return _0x5a8abc[_0x40fb54('0x2f')]=_0x5d9928,_0x5a8abc;})[_0x3bf51d('0x1b')](respondWithFilteredResult(_0x5a3472,_0x32a1ae))[_0x3bf51d('0x26')](handleError(_0x5a3472,null));},exports[_0xf3a3ce('0x19')]=function(_0x53edcc,_0x41d292){const _0x248805=_0xf3a3ce;let _0x224fd1={'raw':!![],'where':{'id':_0x53edcc[_0x248805('0x2c')]['id']}};const _0x20e3d2={};return _0x20e3d2[_0x248805('0xa')]=_[_0x248805('0x1d')](db['FaxApplication'][_0x248805('0x14')]),_0x20e3d2[_0x248805('0xb')]=_[_0x248805('0x1d')](_0x53edcc[_0x248805('0xb')]),_0x20e3d2[_0x248805('0x1')]=_[_0x248805('0x22')](_0x20e3d2[_0x248805('0xa')],_0x20e3d2[_0x248805('0xb')]),_0x224fd1[_0x248805('0x10')]=_[_0x248805('0x22')](_0x20e3d2[_0x248805('0xa')],qs[_0x248805('0x28')](_0x53edcc['query'][_0x248805('0x28')])),_0x224fd1[_0x248805('0x10')]=_0x224fd1['attributes'][_0x248805('0x2a')]?_0x224fd1[_0x248805('0x10')]:_0x20e3d2[_0x248805('0xa')],_0x53edcc['query'][_0x248805('0x29')]&&(_0x224fd1[_0x248805('0x0')]=[{'all':!![]}]),_0x224fd1=_['merge']({},_0x224fd1,_0x53edcc[_0x248805('0x5')]),db['FaxApplication'][_0x248805('0x2e')](_0x224fd1)[_0x248805('0x1b')](handleEntityNotFound(_0x41d292,null))[_0x248805('0x1b')](respondWithResult(_0x41d292,null))[_0x248805('0x26')](handleError(_0x41d292,null));},exports['create']=function(_0x1b0210,_0x15e77){const _0x1bc8f7=_0xf3a3ce;return db[_0x1bc8f7('0x11')][_0x1bc8f7('0x13')](_0x1b0210[_0x1bc8f7('0x1f')],{})['then'](respondWithResult(_0x15e77,0xc9))['catch'](handleError(_0x15e77,null));},exports[_0xf3a3ce('0x2b')]=function(_0x2fa604,_0x260ebf){const _0x336f30=_0xf3a3ce;return _0x2fa604[_0x336f30('0x1f')]['id']&&delete _0x2fa604[_0x336f30('0x1f')]['id'],db[_0x336f30('0x11')][_0x336f30('0x2e')]({'where':{'id':_0x2fa604[_0x336f30('0x2c')]['id']}})[_0x336f30('0x1b')](handleEntityNotFound(_0x260ebf,null))['then'](saveUpdates(_0x2fa604[_0x336f30('0x1f')],null))[_0x336f30('0x1b')](respondWithResult(_0x260ebf,null))[_0x336f30('0x26')](handleError(_0x260ebf,null));},exports[_0xf3a3ce('0x1c')]=function(_0xbca574,_0xe33019){const _0x347c82=_0xf3a3ce;return db[_0x347c82('0x11')]['findOne']({'where':{'id':_0xbca574['params']['id']}})[_0x347c82('0x1b')](handleEntityNotFound(_0xe33019,null))[_0x347c82('0x1b')](removeEntity(_0xe33019,null))[_0x347c82('0x26')](handleError(_0xe33019,null));};