Built motion from commit ecf5ab8ec560fd4c6972692268e350fcef2f38e7. Version 3.0.0...
[motion-next.git] / server / api / chatApplication / chatApplication.controller.js
1 const a55_0x5459=['length','model','../../config/logger','update','includeAll','status','attributes','findOne','catch','end','query','api','show','keys','sendStatus','../../components/parsers/qs','include','intersection','error','lodash','fields','destroy','merge','send','name','options','filters','params','then','rawAttributes','body'];(function(_0x439ec7,_0x5459c1){const _0x48b4a2=function(_0x73db01){while(--_0x73db01){_0x439ec7['push'](_0x439ec7['shift']());}};_0x48b4a2(++_0x5459c1);}(a55_0x5459,0xac));const a55_0x48b4=function(_0x439ec7,_0x5459c1){_0x439ec7=_0x439ec7-0x0;let _0x48b4a2=a55_0x5459[_0x439ec7];return _0x48b4a2;};const _0x136ab8=a55_0x48b4;'use strict';const _=require(_0x136ab8('0x2')),qs=require(_0x136ab8('0x1d')),logger=require(_0x136ab8('0x10'))(_0x136ab8('0x19')),db=require('../../mysqldb')['db'];function respondWithResult(_0x73db01,_0x56bf4){return _0x56bf4=_0x56bf4||0xc8,function(_0x3e0af4){if(_0x3e0af4)return _0x73db01['status'](_0x56bf4)['json'](_0x3e0af4);};}function saveUpdates(_0x507cf7){return function(_0x3cef13){const _0x51f45=a55_0x48b4;if(_0x3cef13)return _0x3cef13[_0x51f45('0x11')](_0x507cf7)[_0x51f45('0xb')](function(_0x388b54){return _0x388b54;});return null;};}function removeEntity(_0x36203c){return function(_0x505122){const _0x1fd143=a55_0x48b4;if(_0x505122)return _0x505122[_0x1fd143('0x4')]()['then'](function(){const _0x3c3fee=_0x1fd143;_0x36203c[_0x3c3fee('0x13')](0xcc)[_0x3c3fee('0x17')]();});};}function handleEntityNotFound(_0x451074){return function(_0x38427c){const _0x443b80=a55_0x48b4;return!_0x38427c&&_0x451074[_0x443b80('0x1c')](0x194),_0x38427c;};}function handleError(_0x53851b,_0x4c5e9c){return _0x4c5e9c=_0x4c5e9c||0x1f4,function(_0x107353){const _0x12c2e0=a55_0x48b4;logger[_0x12c2e0('0x1')](_0x107353['stack']),_0x107353[_0x12c2e0('0x7')]&&delete _0x107353[_0x12c2e0('0x7')],_0x53851b[_0x12c2e0('0x13')](_0x4c5e9c)[_0x12c2e0('0x6')](_0x107353);};}exports[_0x136ab8('0x1a')]=function(_0x4a4449,_0x2cb244){const _0x41136f=_0x136ab8;let _0x136015={'raw':!![],'where':{'id':_0x4a4449['params']['id']}};const _0x4890fc={};return _0x4890fc[_0x41136f('0xf')]=_['keys'](db['ChatApplication'][_0x41136f('0xc')]),_0x4890fc[_0x41136f('0x18')]=_[_0x41136f('0x1b')](_0x4a4449['query']),_0x4890fc[_0x41136f('0x9')]=_[_0x41136f('0x0')](_0x4890fc[_0x41136f('0xf')],_0x4890fc[_0x41136f('0x18')]),_0x136015[_0x41136f('0x14')]=_[_0x41136f('0x0')](_0x4890fc[_0x41136f('0xf')],qs[_0x41136f('0x3')](_0x4a4449[_0x41136f('0x18')]['fields'])),_0x136015[_0x41136f('0x14')]=_0x136015[_0x41136f('0x14')][_0x41136f('0xe')]?_0x136015[_0x41136f('0x14')]:_0x4890fc[_0x41136f('0xf')],_0x4a4449['query'][_0x41136f('0x12')]&&(_0x136015[_0x41136f('0x1e')]=[{'all':!![]}]),_0x136015=_[_0x41136f('0x5')]({},_0x136015,_0x4a4449[_0x41136f('0x8')]),db['ChatApplication'][_0x41136f('0x15')](_0x136015)['then'](handleEntityNotFound(_0x2cb244,null))[_0x41136f('0xb')](respondWithResult(_0x2cb244,null))[_0x41136f('0x16')](handleError(_0x2cb244,null));},exports[_0x136ab8('0x11')]=function(_0x3c158b,_0x45303e){const _0x9878e6=_0x136ab8;return _0x3c158b['body']['id']&&delete _0x3c158b[_0x9878e6('0xd')]['id'],db['ChatApplication'][_0x9878e6('0x15')]({'where':{'id':_0x3c158b['params']['id']}})[_0x9878e6('0xb')](handleEntityNotFound(_0x45303e,null))[_0x9878e6('0xb')](saveUpdates(_0x3c158b[_0x9878e6('0xd')],null))[_0x9878e6('0xb')](respondWithResult(_0x45303e,null))[_0x9878e6('0x16')](handleError(_0x45303e,null));},exports[_0x136ab8('0x4')]=function(_0x1ebf72,_0xc9cb51){const _0x38de80=_0x136ab8;return db['ChatApplication'][_0x38de80('0x15')]({'where':{'id':_0x1ebf72[_0x38de80('0xa')]['id']}})[_0x38de80('0xb')](handleEntityNotFound(_0xc9cb51,null))[_0x38de80('0xb')](removeEntity(_0xc9cb51,null))[_0x38de80('0x16')](handleError(_0xc9cb51,null));};