Built motion from commit f738f9592c388b9f9eb3948f400a5c9d717a3561. Version 3.0.0...
[motion-next.git] / server / api / squareMessage / squareMessage.controller.js
index 0b7f639..6f7828b 100644 (file)
@@ -1 +1 @@
-const a704_0x14ee=['name','../../mysqldb','VIRTUAL','nolimit','update','merge','catch','fields','offset','index','create','filter','include','api','json','../../components/parsers/qs','send','sort','count','SquareMessage','Content-Range','undefined','params','model','show','key','sendStatus','order','stack','../../config/logger','filters','type','intersection','query','status','options','error','where','body','like','sequelize','keys','findOne','attributes','then','pick','length','rows','map','fieldName','limit','includeAll','destroy','lodash'];(function(_0x461fcc,_0x10abe2){const _0x14ee91=function(_0x242ef1){while(--_0x242ef1){_0x461fcc['push'](_0x461fcc['shift']());}};_0x14ee91(++_0x10abe2);}(a704_0x14ee,0x160));const a704_0x242e=function(_0x461fcc,_0x10abe2){_0x461fcc=_0x461fcc-0x17a;let _0x14ee91=a704_0x14ee[_0x461fcc];return _0x14ee91;};const a704_0x2a219b=a704_0x242e;'use strict';const _=require(a704_0x2a219b(0x193)),qs=require(a704_0x2a219b(0x1a3)),logger=require(a704_0x2a219b(0x17b))(a704_0x2a219b(0x1a1)),{db}=require(a704_0x2a219b(0x195)),{Op}=require(a704_0x2a219b(0x186));function respondWithResult(_0x4d0032,_0x132017){return _0x132017=_0x132017||0xc8,function(_0x4e5d56){const _0x2a6036=a704_0x242e;if(_0x4e5d56)return _0x4d0032[_0x2a6036(0x180)](_0x132017)['json'](_0x4e5d56);};}function respondWithFilteredResult(_0x51bcca,_0x528f9a){return function(_0x1e1c88){const _0x2f3fa1=a704_0x242e;if(_0x1e1c88){const _0x4ce689=_0x1e1c88[_0x2f3fa1(0x1a6)],_0x25dd11=_0x528f9a[_0x2f3fa1(0x19c)];let _0x82926e=_0x528f9a[_0x2f3fa1(0x19c)]+_0x528f9a['limit'],_0x512c11;return _0x82926e>=_0x4ce689?(_0x82926e=_0x4ce689,_0x512c11=0xc8):_0x512c11=0xce,_0x51bcca[_0x2f3fa1(0x180)](_0x512c11),_0x51bcca['set'](_0x2f3fa1(0x1a8),_0x25dd11+'-'+_0x82926e+'/'+_0x4ce689)[_0x2f3fa1(0x1a2)](_0x1e1c88);}return null;};}function saveUpdates(_0x252a43){return function(_0x6fe2be){const _0x5edc88=a704_0x242e;if(_0x6fe2be)return _0x6fe2be[_0x5edc88(0x198)](_0x252a43)[_0x5edc88(0x18a)](function(_0x375833){return _0x375833;});return null;};}function removeEntity(_0x1708a5){return function(_0x3d10e4){const _0x1dccf7=a704_0x242e;if(_0x3d10e4)return _0x3d10e4[_0x1dccf7(0x192)]()[_0x1dccf7(0x18a)](function(){_0x1708a5['status'](0xcc)['end']();});};}function handleEntityNotFound(_0x130d45){return function(_0x40b2db){const _0x67dfff=a704_0x242e;return!_0x40b2db&&_0x130d45[_0x67dfff(0x1ae)](0x194),_0x40b2db;};}function handleError(_0x315f90,_0x317a50){return _0x317a50=_0x317a50||0x1f4,function(_0x397067){const _0x533e53=a704_0x242e;logger[_0x533e53(0x182)](_0x397067[_0x533e53(0x17a)]),_0x397067[_0x533e53(0x194)]&&delete _0x397067['name'],_0x315f90[_0x533e53(0x180)](_0x317a50)[_0x533e53(0x1a4)](_0x397067);};}exports[a704_0x2a219b(0x19d)]=function(_0x50b730,_0x32fbc2){const _0x5d94f0=a704_0x2a219b;let _0x480363={};const _0xd35a97={},_0x20ebe9={'count':0x0,'rows':[]},_0x2e6d9d=_[_0x5d94f0(0x18e)](db['SquareMessage']['rawAttributes'],function(_0x5c5402){const _0x1f4180=_0x5d94f0;return{'name':_0x5c5402[_0x1f4180(0x18f)],'type':_0x5c5402[_0x1f4180(0x17d)][_0x1f4180(0x1ad)]};});_0xd35a97[_0x5d94f0(0x1ab)]=_[_0x5d94f0(0x18e)](_0x2e6d9d,_0x5d94f0(0x194)),_0xd35a97[_0x5d94f0(0x17f)]=_[_0x5d94f0(0x187)](_0x50b730['query']),_0xd35a97[_0x5d94f0(0x17c)]=_[_0x5d94f0(0x17e)](_0xd35a97[_0x5d94f0(0x1ab)],_0xd35a97['query']),_0x480363[_0x5d94f0(0x189)]=_['intersection'](_0xd35a97[_0x5d94f0(0x1ab)],qs[_0x5d94f0(0x19b)](_0x50b730[_0x5d94f0(0x17f)][_0x5d94f0(0x19b)])),_0x480363[_0x5d94f0(0x189)]=_0x480363['attributes'][_0x5d94f0(0x18c)]?_0x480363['attributes']:_0xd35a97[_0x5d94f0(0x1ab)];typeof _0x50b730[_0x5d94f0(0x17f)][_0x5d94f0(0x197)]===_0x5d94f0(0x1a9)&&(_0x480363[_0x5d94f0(0x190)]=qs[_0x5d94f0(0x190)](_0x50b730[_0x5d94f0(0x17f)][_0x5d94f0(0x190)]),_0x480363[_0x5d94f0(0x19c)]=qs[_0x5d94f0(0x19c)](_0x50b730[_0x5d94f0(0x17f)][_0x5d94f0(0x19c)]));_0x480363[_0x5d94f0(0x1af)]=qs[_0x5d94f0(0x1a5)](_0x50b730[_0x5d94f0(0x17f)][_0x5d94f0(0x1a5)]),_0x480363[_0x5d94f0(0x183)]=qs[_0x5d94f0(0x17c)](_[_0x5d94f0(0x18b)](_0x50b730[_0x5d94f0(0x17f)],_0xd35a97['filters']),_0x2e6d9d);_0x50b730[_0x5d94f0(0x17f)][_0x5d94f0(0x19f)]&&(_0x480363[_0x5d94f0(0x183)]=_['merge'](_0x480363[_0x5d94f0(0x183)],{[Op['or']]:_[_0x5d94f0(0x18e)](_0x2e6d9d,function(_0x2a0da5){const _0x37863e=_0x5d94f0;if(_0x2a0da5[_0x37863e(0x17d)]!==_0x37863e(0x196)){const _0x89f51f={};return _0x89f51f[_0x2a0da5[_0x37863e(0x194)]]={[Op[_0x37863e(0x185)]]:'%'+_0x50b730[_0x37863e(0x17f)][_0x37863e(0x19f)]+'%'},_0x89f51f;}})}));_0x480363=_[_0x5d94f0(0x199)]({},_0x480363,_0x50b730[_0x5d94f0(0x181)]);const _0x585569={'where':_0x480363['where']};return db[_0x5d94f0(0x1a7)]['count'](_0x585569)[_0x5d94f0(0x18a)](function(_0x321066){const _0x5bd735=_0x5d94f0;return _0x20ebe9[_0x5bd735(0x1a6)]=_0x321066,_0x50b730[_0x5bd735(0x17f)][_0x5bd735(0x191)]&&(_0x480363[_0x5bd735(0x1a0)]=[{'all':!![]}]),db['SquareMessage']['findAll'](_0x480363);})[_0x5d94f0(0x18a)](function(_0x528f55){const _0x488631=_0x5d94f0;return _0x20ebe9[_0x488631(0x18d)]=_0x528f55,_0x20ebe9;})[_0x5d94f0(0x18a)](respondWithFilteredResult(_0x32fbc2,_0x480363))['catch'](handleError(_0x32fbc2,null));},exports[a704_0x2a219b(0x1ac)]=function(_0x474557,_0x2eafe6){const _0x4ed370=a704_0x2a219b;let _0x8dfda6={'raw':!![],'where':{'id':_0x474557[_0x4ed370(0x1aa)]['id']}};const _0x9b4bb7={};return _0x9b4bb7[_0x4ed370(0x1ab)]=_['keys'](db[_0x4ed370(0x1a7)]['rawAttributes']),_0x9b4bb7['query']=_[_0x4ed370(0x187)](_0x474557[_0x4ed370(0x17f)]),_0x9b4bb7['filters']=_['intersection'](_0x9b4bb7['model'],_0x9b4bb7['query']),_0x8dfda6[_0x4ed370(0x189)]=_[_0x4ed370(0x17e)](_0x9b4bb7[_0x4ed370(0x1ab)],qs[_0x4ed370(0x19b)](_0x474557[_0x4ed370(0x17f)]['fields'])),_0x8dfda6[_0x4ed370(0x189)]=_0x8dfda6[_0x4ed370(0x189)][_0x4ed370(0x18c)]?_0x8dfda6[_0x4ed370(0x189)]:_0x9b4bb7['model'],_0x474557[_0x4ed370(0x17f)][_0x4ed370(0x191)]&&(_0x8dfda6['include']=[{'all':!![]}]),_0x8dfda6=_[_0x4ed370(0x199)]({},_0x8dfda6,_0x474557[_0x4ed370(0x181)]),db[_0x4ed370(0x1a7)][_0x4ed370(0x188)](_0x8dfda6)[_0x4ed370(0x18a)](handleEntityNotFound(_0x2eafe6,null))[_0x4ed370(0x18a)](respondWithResult(_0x2eafe6,null))[_0x4ed370(0x19a)](handleError(_0x2eafe6,null));},exports[a704_0x2a219b(0x19e)]=function(_0x12a431,_0x1dfcf4){const _0x408a5f=a704_0x2a219b;return db[_0x408a5f(0x1a7)][_0x408a5f(0x19e)](_0x12a431[_0x408a5f(0x184)],{})['then'](respondWithResult(_0x1dfcf4,0xc9))['catch'](handleError(_0x1dfcf4,null));},exports[a704_0x2a219b(0x198)]=function(_0x3a83f6,_0x5628fc){const _0x885bec=a704_0x2a219b;return _0x3a83f6[_0x885bec(0x184)]['id']&&delete _0x3a83f6[_0x885bec(0x184)]['id'],db[_0x885bec(0x1a7)]['findOne']({'where':{'id':_0x3a83f6[_0x885bec(0x1aa)]['id']}})[_0x885bec(0x18a)](handleEntityNotFound(_0x5628fc,null))['then'](saveUpdates(_0x3a83f6[_0x885bec(0x184)],null))[_0x885bec(0x18a)](respondWithResult(_0x5628fc,null))['catch'](handleError(_0x5628fc,null));},exports[a704_0x2a219b(0x192)]=function(_0x2aa79d,_0x4c9aec){const _0x31911c=a704_0x2a219b;return db['SquareMessage'][_0x31911c(0x188)]({'where':{'id':_0x2aa79d[_0x31911c(0x1aa)]['id']}})[_0x31911c(0x18a)](handleEntityNotFound(_0x4c9aec,null))[_0x31911c(0x18a)](removeEntity(_0x4c9aec,null))['catch'](handleError(_0x4c9aec,null));};
\ No newline at end of file
+const a704_0xb440=['status','key','SquareMessage','name','VIRTUAL','type','merge','order','set','filters','../../components/parsers/qs','fieldName','end','catch','filter','../../config/logger','then','keys','attributes','limit','rawAttributes','params','body','where','index','query','lodash','findOne','offset','include','map','count','model','intersection','json','options','length','show','rows','../../mysqldb','nolimit','create','update','undefined','pick','api','fields','Content-Range'];(function(_0x37f5cf,_0x23ca48){const _0xb440d1=function(_0xf70779){while(--_0xf70779){_0x37f5cf['push'](_0x37f5cf['shift']());}};_0xb440d1(++_0x23ca48);}(a704_0xb440,0x1a3));const a704_0xf707=function(_0x37f5cf,_0x23ca48){_0x37f5cf=_0x37f5cf-0xdd;let _0xb440d1=a704_0xb440[_0x37f5cf];return _0xb440d1;};const a704_0x2e3bd4=a704_0xf707;'use strict';const _=require(a704_0x2e3bd4(0x104)),qs=require(a704_0x2e3bd4(0xf4)),logger=require(a704_0x2e3bd4(0xf9))(a704_0x2e3bd4(0xe7)),{db}=require(a704_0x2e3bd4(0xe1)),{Op}=require('sequelize');function respondWithResult(_0x35bb7c,_0x4be0b0){return _0x4be0b0=_0x4be0b0||0xc8,function(_0x39be82){const _0x1e2d6f=a704_0xf707;if(_0x39be82)return _0x35bb7c[_0x1e2d6f(0xea)](_0x4be0b0)[_0x1e2d6f(0x10c)](_0x39be82);};}function respondWithFilteredResult(_0x3e5d24,_0x8cfc68){return function(_0x37d8d7){const _0x516fa4=a704_0xf707;if(_0x37d8d7){const _0x1911c4=_0x37d8d7['count'],_0x550287=_0x8cfc68[_0x516fa4(0x106)];let _0x33f76b=_0x8cfc68['offset']+_0x8cfc68[_0x516fa4(0xfd)],_0x13d666;return _0x33f76b>=_0x1911c4?(_0x33f76b=_0x1911c4,_0x13d666=0xc8):_0x13d666=0xce,_0x3e5d24[_0x516fa4(0xea)](_0x13d666),_0x3e5d24[_0x516fa4(0xf2)](_0x516fa4(0xe9),_0x550287+'-'+_0x33f76b+'/'+_0x1911c4)[_0x516fa4(0x10c)](_0x37d8d7);}return null;};}function saveUpdates(_0x42072d){return function(_0x298c7e){const _0x150efe=a704_0xf707;if(_0x298c7e)return _0x298c7e[_0x150efe(0xe4)](_0x42072d)[_0x150efe(0xfa)](function(_0x2bbb01){return _0x2bbb01;});return null;};}function removeEntity(_0x234dd4){return function(_0x57d681){if(_0x57d681)return _0x57d681['destroy']()['then'](function(){const _0x5c251d=a704_0xf707;_0x234dd4[_0x5c251d(0xea)](0xcc)[_0x5c251d(0xf6)]();});};}function handleEntityNotFound(_0x42e35d){return function(_0x5d1586){return!_0x5d1586&&_0x42e35d['sendStatus'](0x194),_0x5d1586;};}function handleError(_0x495f9a,_0x13cc8f){return _0x13cc8f=_0x13cc8f||0x1f4,function(_0x1f4010){const _0x3d7d24=a704_0xf707;logger['error'](_0x1f4010['stack']),_0x1f4010[_0x3d7d24(0xed)]&&delete _0x1f4010[_0x3d7d24(0xed)],_0x495f9a[_0x3d7d24(0xea)](_0x13cc8f)['send'](_0x1f4010);};}exports[a704_0x2e3bd4(0x102)]=function(_0x52f456,_0x1727a1){const _0x2e5a92=a704_0x2e3bd4;let _0x1e24d9={};const _0x419190={},_0x3d2a8b={'count':0x0,'rows':[]},_0x3b2729=_[_0x2e5a92(0x108)](db['SquareMessage'][_0x2e5a92(0xfe)],function(_0x3f5982){const _0x225631=_0x2e5a92;return{'name':_0x3f5982[_0x225631(0xf5)],'type':_0x3f5982['type'][_0x225631(0xeb)]};});_0x419190['model']=_['map'](_0x3b2729,_0x2e5a92(0xed)),_0x419190['query']=_[_0x2e5a92(0xfb)](_0x52f456[_0x2e5a92(0x103)]),_0x419190['filters']=_[_0x2e5a92(0x10b)](_0x419190[_0x2e5a92(0x10a)],_0x419190[_0x2e5a92(0x103)]),_0x1e24d9[_0x2e5a92(0xfc)]=_[_0x2e5a92(0x10b)](_0x419190['model'],qs[_0x2e5a92(0xe8)](_0x52f456['query'][_0x2e5a92(0xe8)])),_0x1e24d9[_0x2e5a92(0xfc)]=_0x1e24d9['attributes'][_0x2e5a92(0xde)]?_0x1e24d9[_0x2e5a92(0xfc)]:_0x419190['model'];typeof _0x52f456[_0x2e5a92(0x103)][_0x2e5a92(0xe2)]===_0x2e5a92(0xe5)&&(_0x1e24d9[_0x2e5a92(0xfd)]=qs[_0x2e5a92(0xfd)](_0x52f456[_0x2e5a92(0x103)][_0x2e5a92(0xfd)]),_0x1e24d9['offset']=qs[_0x2e5a92(0x106)](_0x52f456[_0x2e5a92(0x103)][_0x2e5a92(0x106)]));_0x1e24d9[_0x2e5a92(0xf1)]=qs['sort'](_0x52f456['query']['sort']),_0x1e24d9[_0x2e5a92(0x101)]=qs[_0x2e5a92(0xf3)](_[_0x2e5a92(0xe6)](_0x52f456[_0x2e5a92(0x103)],_0x419190['filters']),_0x3b2729);_0x52f456['query'][_0x2e5a92(0xf8)]&&(_0x1e24d9[_0x2e5a92(0x101)]=_[_0x2e5a92(0xf0)](_0x1e24d9[_0x2e5a92(0x101)],{[Op['or']]:_[_0x2e5a92(0x108)](_0x3b2729,function(_0x421c6e){const _0x59f673=_0x2e5a92;if(_0x421c6e[_0x59f673(0xef)]!==_0x59f673(0xee)){const _0x59fe18={};return _0x59fe18[_0x421c6e['name']]={[Op['like']]:'%'+_0x52f456['query'][_0x59f673(0xf8)]+'%'},_0x59fe18;}})}));_0x1e24d9=_[_0x2e5a92(0xf0)]({},_0x1e24d9,_0x52f456['options']);const _0x3c3909={'where':_0x1e24d9[_0x2e5a92(0x101)]};return db[_0x2e5a92(0xec)]['count'](_0x3c3909)['then'](function(_0x5d08f2){const _0x4828cd=_0x2e5a92;return _0x3d2a8b[_0x4828cd(0x109)]=_0x5d08f2,_0x52f456[_0x4828cd(0x103)]['includeAll']&&(_0x1e24d9['include']=[{'all':!![]}]),db['SquareMessage']['findAll'](_0x1e24d9);})['then'](function(_0x4e68e0){const _0x44be49=_0x2e5a92;return _0x3d2a8b[_0x44be49(0xe0)]=_0x4e68e0,_0x3d2a8b;})[_0x2e5a92(0xfa)](respondWithFilteredResult(_0x1727a1,_0x1e24d9))[_0x2e5a92(0xf7)](handleError(_0x1727a1,null));},exports[a704_0x2e3bd4(0xdf)]=function(_0x2f7f09,_0x3d3baf){const _0x4df152=a704_0x2e3bd4;let _0x217b20={'raw':!![],'where':{'id':_0x2f7f09['params']['id']}};const _0x15ff96={};return _0x15ff96['model']=_['keys'](db[_0x4df152(0xec)][_0x4df152(0xfe)]),_0x15ff96[_0x4df152(0x103)]=_[_0x4df152(0xfb)](_0x2f7f09['query']),_0x15ff96['filters']=_[_0x4df152(0x10b)](_0x15ff96[_0x4df152(0x10a)],_0x15ff96['query']),_0x217b20[_0x4df152(0xfc)]=_[_0x4df152(0x10b)](_0x15ff96[_0x4df152(0x10a)],qs[_0x4df152(0xe8)](_0x2f7f09[_0x4df152(0x103)][_0x4df152(0xe8)])),_0x217b20[_0x4df152(0xfc)]=_0x217b20[_0x4df152(0xfc)]['length']?_0x217b20[_0x4df152(0xfc)]:_0x15ff96['model'],_0x2f7f09[_0x4df152(0x103)]['includeAll']&&(_0x217b20[_0x4df152(0x107)]=[{'all':!![]}]),_0x217b20=_[_0x4df152(0xf0)]({},_0x217b20,_0x2f7f09[_0x4df152(0xdd)]),db[_0x4df152(0xec)][_0x4df152(0x105)](_0x217b20)[_0x4df152(0xfa)](handleEntityNotFound(_0x3d3baf,null))[_0x4df152(0xfa)](respondWithResult(_0x3d3baf,null))['catch'](handleError(_0x3d3baf,null));},exports[a704_0x2e3bd4(0xe3)]=function(_0x308367,_0x201a9a){const _0x450973=a704_0x2e3bd4;return db['SquareMessage'][_0x450973(0xe3)](_0x308367[_0x450973(0x100)],{})[_0x450973(0xfa)](respondWithResult(_0x201a9a,0xc9))[_0x450973(0xf7)](handleError(_0x201a9a,null));},exports[a704_0x2e3bd4(0xe4)]=function(_0x863168,_0x35a602){const _0x3bc90b=a704_0x2e3bd4;return _0x863168['body']['id']&&delete _0x863168[_0x3bc90b(0x100)]['id'],db[_0x3bc90b(0xec)]['findOne']({'where':{'id':_0x863168[_0x3bc90b(0xff)]['id']}})[_0x3bc90b(0xfa)](handleEntityNotFound(_0x35a602,null))['then'](saveUpdates(_0x863168['body'],null))[_0x3bc90b(0xfa)](respondWithResult(_0x35a602,null))[_0x3bc90b(0xf7)](handleError(_0x35a602,null));},exports['destroy']=function(_0x3f5da2,_0x3be07c){const _0x1e4510=a704_0x2e3bd4;return db[_0x1e4510(0xec)][_0x1e4510(0x105)]({'where':{'id':_0x3f5da2[_0x1e4510(0xff)]['id']}})[_0x1e4510(0xfa)](handleEntityNotFound(_0x3be07c,null))[_0x1e4510(0xfa)](removeEntity(_0x3be07c,null))[_0x1e4510(0xf7)](handleError(_0x3be07c,null));};
\ No newline at end of file