Built motion from commit b517aaa2a6638133380e4d135c64a80893061362. Version 3.0.0...
[motion-next.git] / server / api / mailSubstatus / mailSubstatus.controller.js
1 const a440_0x550f=['sendStatus','MailSubstatus','fieldName','length','findOne','pick','model','rawAttributes','findAll','params','body','update','filter','include','stack','destroy','order','name','map','status','query','merge','includeAll','limit','sort','key','show','sequelize','then','../../config/logger','count','intersection','describe','Content-Range','fields','rows','send','catch','where','options','keys','offset','set','filters','type','nolimit','error','create','../../mysqldb','api','json','attributes'];(function(_0x63fcfc,_0x550f92){const _0x38e966=function(_0x178d59){while(--_0x178d59){_0x63fcfc['push'](_0x63fcfc['shift']());}};_0x38e966(++_0x550f92);}(a440_0x550f,0x10d));const a440_0x38e9=function(_0x63fcfc,_0x550f92){_0x63fcfc=_0x63fcfc-0x0;let _0x38e966=a440_0x550f[_0x63fcfc];return _0x38e966;};const _0x4e5fd2=a440_0x38e9;'use strict';const _=require('lodash'),qs=require('../../components/parsers/qs'),logger=require(_0x4e5fd2('0x14'))(_0x4e5fd2('0x28')),db=require(_0x4e5fd2('0x27'))['db'],{Op}=require(_0x4e5fd2('0x12'));function respondWithResult(_0x178d59,_0x429dae){return _0x429dae=_0x429dae||0xc8,function(_0x5742fe){if(_0x5742fe)return _0x178d59['status'](_0x429dae)['json'](_0x5742fe);};}function respondWithFilteredResult(_0x55f40e,_0x2d31bb){return function(_0x557d1c){const _0x14e35d=a440_0x38e9;if(_0x557d1c){const _0x2eecb4=_0x557d1c['count'],_0x28c164=_0x2d31bb[_0x14e35d('0x20')];let _0x4fe6fc=_0x2d31bb[_0x14e35d('0x20')]+_0x2d31bb[_0x14e35d('0xe')],_0x1f6212;return _0x4fe6fc>=_0x2eecb4?(_0x4fe6fc=_0x2eecb4,_0x1f6212=0xc8):_0x1f6212=0xce,_0x55f40e[_0x14e35d('0xa')](_0x1f6212),_0x55f40e[_0x14e35d('0x21')](_0x14e35d('0x18'),_0x28c164+'-'+_0x4fe6fc+'/'+_0x2eecb4)[_0x14e35d('0x29')](_0x557d1c);}return null;};}function saveUpdates(_0x4fc024){return function(_0x2f4465){const _0x4ca504=a440_0x38e9;if(_0x2f4465)return _0x2f4465[_0x4ca504('0x2')](_0x4fc024)[_0x4ca504('0x13')](function(_0x348bf5){return _0x348bf5;});return null;};}function removeEntity(_0x263ac5){return function(_0x3639cb){const _0x20e498=a440_0x38e9;if(_0x3639cb)return _0x3639cb[_0x20e498('0x6')]()[_0x20e498('0x13')](function(){_0x263ac5['status'](0xcc)['end']();});};}function handleEntityNotFound(_0x12bbab){return function(_0x117ca5){const _0x501982=a440_0x38e9;return!_0x117ca5&&_0x12bbab[_0x501982('0x2b')](0x194),_0x117ca5;};}function handleError(_0x5e2919,_0x513344){return _0x513344=_0x513344||0x1f4,function(_0x5bed1d){const _0x148bf9=a440_0x38e9;logger[_0x148bf9('0x25')](_0x5bed1d[_0x148bf9('0x5')]),_0x5bed1d[_0x148bf9('0x8')]&&delete _0x5bed1d[_0x148bf9('0x8')],_0x5e2919['status'](_0x513344)[_0x148bf9('0x1b')](_0x5bed1d);};}exports['index']=function(_0x412b1e,_0x445091){const _0x7fc67c=_0x4e5fd2;let _0xf95e62={};const _0x2c6c83={},_0x121726={'count':0x0,'rows':[]},_0x3b35cc=_[_0x7fc67c('0x9')](db[_0x7fc67c('0x2c')][_0x7fc67c('0x32')],function(_0xd99cc8){const _0x198702=_0x7fc67c;return{'name':_0xd99cc8[_0x198702('0x2d')],'type':_0xd99cc8[_0x198702('0x23')][_0x198702('0x10')]};});_0x2c6c83[_0x7fc67c('0x31')]=_[_0x7fc67c('0x9')](_0x3b35cc,_0x7fc67c('0x8')),_0x2c6c83[_0x7fc67c('0xb')]=_[_0x7fc67c('0x1f')](_0x412b1e[_0x7fc67c('0xb')]),_0x2c6c83[_0x7fc67c('0x22')]=_[_0x7fc67c('0x16')](_0x2c6c83[_0x7fc67c('0x31')],_0x2c6c83[_0x7fc67c('0xb')]),_0xf95e62[_0x7fc67c('0x2a')]=_['intersection'](_0x2c6c83[_0x7fc67c('0x31')],qs[_0x7fc67c('0x19')](_0x412b1e[_0x7fc67c('0xb')][_0x7fc67c('0x19')])),_0xf95e62['attributes']=_0xf95e62[_0x7fc67c('0x2a')]['length']?_0xf95e62[_0x7fc67c('0x2a')]:_0x2c6c83[_0x7fc67c('0x31')];typeof _0x412b1e[_0x7fc67c('0xb')][_0x7fc67c('0x24')]==='undefined'&&(_0xf95e62['limit']=qs[_0x7fc67c('0xe')](_0x412b1e[_0x7fc67c('0xb')][_0x7fc67c('0xe')]),_0xf95e62[_0x7fc67c('0x20')]=qs[_0x7fc67c('0x20')](_0x412b1e['query'][_0x7fc67c('0x20')]));_0xf95e62[_0x7fc67c('0x7')]=qs[_0x7fc67c('0xf')](_0x412b1e['query']['sort']),_0xf95e62['where']=qs[_0x7fc67c('0x22')](_[_0x7fc67c('0x30')](_0x412b1e[_0x7fc67c('0xb')],_0x2c6c83[_0x7fc67c('0x22')]),_0x3b35cc);_0x412b1e[_0x7fc67c('0xb')][_0x7fc67c('0x3')]&&(_0xf95e62[_0x7fc67c('0x1d')]=_[_0x7fc67c('0xc')](_0xf95e62[_0x7fc67c('0x1d')],{[Op['or']]:_[_0x7fc67c('0x9')](_0x3b35cc,function(_0x5a8d37){const _0x11108f=_0x7fc67c;if(_0x5a8d37[_0x11108f('0x23')]!=='VIRTUAL'){const _0xa1016a={};return _0xa1016a[_0x5a8d37[_0x11108f('0x8')]]={[Op['like']]:'%'+_0x412b1e['query']['filter']+'%'},_0xa1016a;}})}));_0xf95e62=_[_0x7fc67c('0xc')]({},_0xf95e62,_0x412b1e['options']);const _0x36faf1={'where':_0xf95e62[_0x7fc67c('0x1d')]};return db[_0x7fc67c('0x2c')][_0x7fc67c('0x15')](_0x36faf1)[_0x7fc67c('0x13')](function(_0x149cfe){const _0x4912a1=_0x7fc67c;return _0x121726[_0x4912a1('0x15')]=_0x149cfe,_0x412b1e['query']['includeAll']&&(_0xf95e62[_0x4912a1('0x4')]=[{'all':!![]}]),db['MailSubstatus'][_0x4912a1('0x33')](_0xf95e62);})[_0x7fc67c('0x13')](function(_0x5389e5){const _0x3491e8=_0x7fc67c;return _0x121726[_0x3491e8('0x1a')]=_0x5389e5,_0x121726;})['then'](respondWithFilteredResult(_0x445091,_0xf95e62))[_0x7fc67c('0x1c')](handleError(_0x445091,null));},exports[_0x4e5fd2('0x11')]=function(_0x333fd3,_0x24df11){const _0x563552=_0x4e5fd2;let _0x5b912e={'raw':!![],'where':{'id':_0x333fd3[_0x563552('0x0')]['id']}};const _0x11c1bb={};return _0x11c1bb[_0x563552('0x31')]=_[_0x563552('0x1f')](db['MailSubstatus'][_0x563552('0x32')]),_0x11c1bb[_0x563552('0xb')]=_['keys'](_0x333fd3[_0x563552('0xb')]),_0x11c1bb['filters']=_['intersection'](_0x11c1bb[_0x563552('0x31')],_0x11c1bb[_0x563552('0xb')]),_0x5b912e[_0x563552('0x2a')]=_[_0x563552('0x16')](_0x11c1bb[_0x563552('0x31')],qs[_0x563552('0x19')](_0x333fd3['query'][_0x563552('0x19')])),_0x5b912e[_0x563552('0x2a')]=_0x5b912e[_0x563552('0x2a')][_0x563552('0x2e')]?_0x5b912e['attributes']:_0x11c1bb[_0x563552('0x31')],_0x333fd3[_0x563552('0xb')][_0x563552('0xd')]&&(_0x5b912e[_0x563552('0x4')]=[{'all':!![]}]),_0x5b912e=_[_0x563552('0xc')]({},_0x5b912e,_0x333fd3[_0x563552('0x1e')]),db[_0x563552('0x2c')][_0x563552('0x2f')](_0x5b912e)[_0x563552('0x13')](handleEntityNotFound(_0x24df11,null))[_0x563552('0x13')](respondWithResult(_0x24df11,null))['catch'](handleError(_0x24df11,null));},exports[_0x4e5fd2('0x26')]=function(_0x413018,_0x2ec307){const _0x16a428=_0x4e5fd2;return db['MailSubstatus'][_0x16a428('0x26')](_0x413018[_0x16a428('0x1')],{})[_0x16a428('0x13')](respondWithResult(_0x2ec307,0xc9))[_0x16a428('0x1c')](handleError(_0x2ec307,null));},exports['update']=function(_0x5e89ae,_0x322bc3){const _0x51a6d1=_0x4e5fd2;return _0x5e89ae[_0x51a6d1('0x1')]['id']&&delete _0x5e89ae[_0x51a6d1('0x1')]['id'],db[_0x51a6d1('0x2c')][_0x51a6d1('0x2f')]({'where':{'id':_0x5e89ae['params']['id']}})[_0x51a6d1('0x13')](handleEntityNotFound(_0x322bc3,null))['then'](saveUpdates(_0x5e89ae['body'],null))[_0x51a6d1('0x13')](respondWithResult(_0x322bc3,null))['catch'](handleError(_0x322bc3,null));},exports['destroy']=function(_0x2def0a,_0x230899){const _0x121400=_0x4e5fd2;return db['MailSubstatus'][_0x121400('0x2f')]({'where':{'id':_0x2def0a[_0x121400('0x0')]['id']}})[_0x121400('0x13')](handleEntityNotFound(_0x230899,null))[_0x121400('0x13')](removeEntity(_0x230899,null))[_0x121400('0x1c')](handleError(_0x230899,null));},exports['describe']=function(_0x43f34d,_0x3972b8){const _0x398f4e=_0x4e5fd2;return db['MailSubstatus'][_0x398f4e('0x17')]()[_0x398f4e('0x13')](respondWithResult(_0x3972b8,null))[_0x398f4e('0x1c')](handleError(_0x3972b8,null));};