Built motion from commit 4a18b36e645f5fa4a517d36f9783bde259878164. Version 3.0.0...
[motion-next.git] / server / api / mailTransferReport / mailTransferReport.controller.js
1 const a444_0x3c8c=['rows','params','fields','api','send','body','sort','pick','json','../../components/parsers/qs','index','includeAll','intersection','end','rawAttributes','model','../../mysqldb','count','update','set','length','sendStatus','where','undefined','type','../../config/logger','create','show','like','merge','options','lodash','catch','describe','order','Content-Range','filters','include','attributes','name','offset','query','keys','MailTransferReport','destroy','key','findOne','map','then','limit','fieldName','filter','status'];(function(_0x433aed,_0x3c8c9b){const _0x4b11e7=function(_0x3e4bf7){while(--_0x3e4bf7){_0x433aed['push'](_0x433aed['shift']());}};_0x4b11e7(++_0x3c8c9b);}(a444_0x3c8c,0x1a2));const a444_0x4b11=function(_0x433aed,_0x3c8c9b){_0x433aed=_0x433aed-0x0;let _0x4b11e7=a444_0x3c8c[_0x433aed];return _0x4b11e7;};const _0x596793=a444_0x4b11;'use strict';const _=require(_0x596793('0x25')),qs=require(_0x596793('0xf')),logger=require(_0x596793('0x1f'))(_0x596793('0x9')),db=require(_0x596793('0x16'))['db'],{Op}=require('sequelize');function respondWithResult(_0x3e4bf7,_0x2432c1){return _0x2432c1=_0x2432c1||0xc8,function(_0x238884){const _0x38c429=a444_0x4b11;if(_0x238884)return _0x3e4bf7[_0x38c429('0x5')](_0x2432c1)['json'](_0x238884);};}function respondWithFilteredResult(_0x1569c1,_0x14b010){return function(_0x32ed0a){const _0x10e4ee=a444_0x4b11;if(_0x32ed0a){const _0x1c4097=_0x32ed0a['count'],_0x3d14eb=_0x14b010[_0x10e4ee('0x2e')];let _0x27cd5b=_0x14b010[_0x10e4ee('0x2e')]+_0x14b010['limit'],_0x5e6e69;return _0x27cd5b>=_0x1c4097?(_0x27cd5b=_0x1c4097,_0x5e6e69=0xc8):_0x5e6e69=0xce,_0x1569c1['status'](_0x5e6e69),_0x1569c1[_0x10e4ee('0x19')](_0x10e4ee('0x29'),_0x3d14eb+'-'+_0x27cd5b+'/'+_0x1c4097)[_0x10e4ee('0xe')](_0x32ed0a);}return null;};}function saveUpdates(_0x403a77){return function(_0xb11d71){const _0x2641f5=a444_0x4b11;if(_0xb11d71)return _0xb11d71[_0x2641f5('0x18')](_0x403a77)[_0x2641f5('0x1')](function(_0x557f2e){return _0x557f2e;});return null;};}function removeEntity(_0x40e5fe){return function(_0x35fc76){const _0x3bb259=a444_0x4b11;if(_0x35fc76)return _0x35fc76[_0x3bb259('0x32')]()[_0x3bb259('0x1')](function(){const _0x27f092=_0x3bb259;_0x40e5fe[_0x27f092('0x5')](0xcc)[_0x27f092('0x13')]();});};}function handleEntityNotFound(_0x1a4c23){return function(_0x44f3a8){const _0x32c93c=a444_0x4b11;return!_0x44f3a8&&_0x1a4c23[_0x32c93c('0x1b')](0x194),_0x44f3a8;};}function handleError(_0x397e7f,_0x53e66b){return _0x53e66b=_0x53e66b||0x1f4,function(_0x4a0276){const _0x37eee8=a444_0x4b11;logger['error'](_0x4a0276['stack']),_0x4a0276[_0x37eee8('0x2d')]&&delete _0x4a0276['name'],_0x397e7f['status'](_0x53e66b)[_0x37eee8('0xa')](_0x4a0276);};}exports[_0x596793('0x10')]=function(_0x361842,_0xec01b1){const _0x592075=_0x596793;let _0x520f6b={};const _0x37a257={},_0x4eda84={'count':0x0,'rows':[]},_0x4de734=_[_0x592075('0x0')](db['MailTransferReport'][_0x592075('0x14')],function(_0xe132e7){const _0x26011e=_0x592075;return{'name':_0xe132e7[_0x26011e('0x3')],'type':_0xe132e7['type'][_0x26011e('0x33')]};});_0x37a257[_0x592075('0x15')]=_[_0x592075('0x0')](_0x4de734,_0x592075('0x2d')),_0x37a257[_0x592075('0x2f')]=_['keys'](_0x361842[_0x592075('0x2f')]),_0x37a257[_0x592075('0x2a')]=_['intersection'](_0x37a257[_0x592075('0x15')],_0x37a257[_0x592075('0x2f')]),_0x520f6b['attributes']=_[_0x592075('0x12')](_0x37a257[_0x592075('0x15')],qs[_0x592075('0x8')](_0x361842['query'][_0x592075('0x8')])),_0x520f6b[_0x592075('0x2c')]=_0x520f6b[_0x592075('0x2c')][_0x592075('0x1a')]?_0x520f6b[_0x592075('0x2c')]:_0x37a257[_0x592075('0x15')];typeof _0x361842[_0x592075('0x2f')]['nolimit']===_0x592075('0x1d')&&(_0x520f6b[_0x592075('0x2')]=qs[_0x592075('0x2')](_0x361842[_0x592075('0x2f')][_0x592075('0x2')]),_0x520f6b['offset']=qs[_0x592075('0x2e')](_0x361842[_0x592075('0x2f')][_0x592075('0x2e')]));_0x520f6b[_0x592075('0x28')]=qs[_0x592075('0xc')](_0x361842['query'][_0x592075('0xc')]),_0x520f6b[_0x592075('0x1c')]=qs[_0x592075('0x2a')](_[_0x592075('0xd')](_0x361842['query'],_0x37a257[_0x592075('0x2a')]),_0x4de734);_0x361842['query']['filter']&&(_0x520f6b[_0x592075('0x1c')]=_['merge'](_0x520f6b[_0x592075('0x1c')],{[Op['or']]:_[_0x592075('0x0')](_0x4de734,function(_0x257b83){const _0x3c9ce3=_0x592075;if(_0x257b83[_0x3c9ce3('0x1e')]!=='VIRTUAL'){const _0x29852b={};return _0x29852b[_0x257b83[_0x3c9ce3('0x2d')]]={[Op[_0x3c9ce3('0x22')]]:'%'+_0x361842['query'][_0x3c9ce3('0x4')]+'%'},_0x29852b;}})}));_0x520f6b=_['merge']({},_0x520f6b,_0x361842[_0x592075('0x24')]);const _0x14c10b={'where':_0x520f6b[_0x592075('0x1c')]};return db[_0x592075('0x31')][_0x592075('0x17')](_0x14c10b)[_0x592075('0x1')](function(_0x45c71e){const _0x2111cc=_0x592075;return _0x4eda84[_0x2111cc('0x17')]=_0x45c71e,_0x361842[_0x2111cc('0x2f')][_0x2111cc('0x11')]&&(_0x520f6b[_0x2111cc('0x2b')]=[{'all':!![]}]),db[_0x2111cc('0x31')]['findAll'](_0x520f6b);})[_0x592075('0x1')](function(_0x2da4df){const _0x2d2cd2=_0x592075;return _0x4eda84[_0x2d2cd2('0x6')]=_0x2da4df,_0x4eda84;})[_0x592075('0x1')](respondWithFilteredResult(_0xec01b1,_0x520f6b))[_0x592075('0x26')](handleError(_0xec01b1,null));},exports[_0x596793('0x21')]=function(_0x363637,_0x18b03b){const _0x4485f8=_0x596793;let _0x1bb741={'raw':!![],'where':{'id':_0x363637[_0x4485f8('0x7')]['id']}};const _0x3c1ae6={};return _0x3c1ae6['model']=_[_0x4485f8('0x30')](db[_0x4485f8('0x31')]['rawAttributes']),_0x3c1ae6[_0x4485f8('0x2f')]=_['keys'](_0x363637['query']),_0x3c1ae6[_0x4485f8('0x2a')]=_['intersection'](_0x3c1ae6[_0x4485f8('0x15')],_0x3c1ae6[_0x4485f8('0x2f')]),_0x1bb741['attributes']=_['intersection'](_0x3c1ae6['model'],qs[_0x4485f8('0x8')](_0x363637[_0x4485f8('0x2f')][_0x4485f8('0x8')])),_0x1bb741['attributes']=_0x1bb741['attributes'][_0x4485f8('0x1a')]?_0x1bb741[_0x4485f8('0x2c')]:_0x3c1ae6[_0x4485f8('0x15')],_0x363637[_0x4485f8('0x2f')][_0x4485f8('0x11')]&&(_0x1bb741[_0x4485f8('0x2b')]=[{'all':!![]}]),_0x1bb741=_[_0x4485f8('0x23')]({},_0x1bb741,_0x363637[_0x4485f8('0x24')]),db['MailTransferReport']['findOne'](_0x1bb741)['then'](handleEntityNotFound(_0x18b03b,null))[_0x4485f8('0x1')](respondWithResult(_0x18b03b,null))[_0x4485f8('0x26')](handleError(_0x18b03b,null));},exports[_0x596793('0x20')]=function(_0x587dde,_0x2c9170){const _0x4520e2=_0x596793;return db['MailTransferReport'][_0x4520e2('0x20')](_0x587dde[_0x4520e2('0xb')],{})[_0x4520e2('0x1')](respondWithResult(_0x2c9170,0xc9))[_0x4520e2('0x26')](handleError(_0x2c9170,null));},exports[_0x596793('0x18')]=function(_0x23c163,_0x39d562){const _0x177cde=_0x596793;return _0x23c163[_0x177cde('0xb')]['id']&&delete _0x23c163[_0x177cde('0xb')]['id'],db[_0x177cde('0x31')][_0x177cde('0x34')]({'where':{'id':_0x23c163[_0x177cde('0x7')]['id']}})[_0x177cde('0x1')](handleEntityNotFound(_0x39d562,null))['then'](saveUpdates(_0x23c163[_0x177cde('0xb')],null))[_0x177cde('0x1')](respondWithResult(_0x39d562,null))[_0x177cde('0x26')](handleError(_0x39d562,null));},exports['destroy']=function(_0x270e14,_0x31a7d9){const _0x5d76=_0x596793;return db[_0x5d76('0x31')][_0x5d76('0x34')]({'where':{'id':_0x270e14['params']['id']}})[_0x5d76('0x1')](handleEntityNotFound(_0x31a7d9,null))[_0x5d76('0x1')](removeEntity(_0x31a7d9,null))[_0x5d76('0x26')](handleError(_0x31a7d9,null));},exports[_0x596793('0x27')]=function(_0x372414,_0x204585){const _0x1c9b2c=_0x596793;return db['MailTransferReport'][_0x1c9b2c('0x27')]()[_0x1c9b2c('0x1')](respondWithResult(_0x204585,null))[_0x1c9b2c('0x26')](handleError(_0x204585,null));};