Built motion from commit df3e9871f6bcc3432fec345b2f4facbd4dba8b5c. Version 3.0.0...
[motion-next.git] / server / api / chatGroup / chatGroup.controller.js
index 8854bb1..bc8bad3 100644 (file)
@@ -1 +1 @@
-const a59_0x2c3d=['findOne','toInteger','status','rows','params','nolimit','name','type','stack','YYYY-MM-DD\x20HH:mm:ss','filters','filter','addMembers','undefined','getMembers','ChatGroup','error','destroy','catch','moment','keys','ids','show','like','Content-Range','fields','format','omit','fieldName','$gte','rawAttributes','sequelize','order','api','include','offset','intersection','update','query','length','addMessage','../../rediscache','then','split','ChatInternalMessage','getMessages','removeMembers','getUnread','limit','VIRTUAL','map','key','user','end','model','sort','includeAll','merge','register','pick','../../config/logger','where','set','count','findAll','body','send','sendStatus','create','attributes'];(function(_0x2f5cbf,_0x2c3d0c){const _0x328629=function(_0x351679){while(--_0x351679){_0x2f5cbf['push'](_0x2f5cbf['shift']());}};_0x328629(++_0x2c3d0c);}(a59_0x2c3d,0xe8));const a59_0x3286=function(_0x2f5cbf,_0x2c3d0c){_0x2f5cbf=_0x2f5cbf-0x0;let _0x328629=a59_0x2c3d[_0x2f5cbf];return _0x328629;};const _0x4f48bf=a59_0x3286;'use strict';const moment=require(_0x4f48bf('0x43')),_=require('lodash'),{getSocket}=require(_0x4f48bf('0x13')),qs=require('../../components/parsers/qs'),logger=require(_0x4f48bf('0x26'))(_0x4f48bf('0xb')),db=require('../../mysqldb')['db'],{Op}=require(_0x4f48bf('0x9')),socket=getSocket();require('./chatGroup.socket')[_0x4f48bf('0x24')](socket);function respondWithStatusCode(_0x351679,_0x413c34){return _0x413c34=_0x413c34||0xcc,function(_0x51accb){const _0xe07749=a59_0x3286;if(_0x51accb)return _0x351679[_0xe07749('0x2d')](_0x413c34);return _0x351679[_0xe07749('0x32')](_0x413c34)[_0xe07749('0x1f')]();};}function respondWithResult(_0x4ffcb3,_0x3d9187){return _0x3d9187=_0x3d9187||0xc8,function(_0x168213){const _0x51f284=a59_0x3286;if(_0x168213)return _0x4ffcb3[_0x51f284('0x32')](_0x3d9187)['json'](_0x168213);};}function respondWithFilteredResult(_0x1f2655,_0x584fbe){return function(_0x2fc233){const _0x3c4619=a59_0x3286;if(_0x2fc233){const _0x58f895=_0x2fc233['count'],_0x100f1b=_0x584fbe[_0x3c4619('0xd')];let _0x456094=_0x584fbe[_0x3c4619('0xd')]+_0x584fbe['limit'],_0x30b818;return _0x456094>=_0x58f895?(_0x456094=_0x58f895,_0x30b818=0xc8):_0x30b818=0xce,_0x1f2655[_0x3c4619('0x32')](_0x30b818),_0x1f2655[_0x3c4619('0x28')](_0x3c4619('0x2'),_0x100f1b+'-'+_0x456094+'/'+_0x58f895)['json'](_0x2fc233);}return null;};}function saveUpdates(_0x55cca3){return function(_0x586467){const _0x46a2d3=a59_0x3286;if(_0x586467)return _0x586467['update'](_0x55cca3)[_0x46a2d3('0x14')](function(_0x34d71e){return _0x34d71e;});return null;};}function removeEntity(_0x593d85){return function(_0x2b921d){const _0x2f89fc=a59_0x3286;if(_0x2b921d)return _0x2b921d[_0x2f89fc('0x41')]()[_0x2f89fc('0x14')](function(){const _0x136710=_0x2f89fc;_0x593d85['status'](0xcc)[_0x136710('0x1f')]();});};}function handleEntityNotFound(_0xa600d6){return function(_0x3de7e9){const _0x48b315=a59_0x3286;return!_0x3de7e9&&_0xa600d6[_0x48b315('0x2d')](0x194),_0x3de7e9;};}function handleError(_0x314ab0,_0x2c1119){return _0x2c1119=_0x2c1119||0x1f4,function(_0x47da1d){const _0x5900f2=a59_0x3286;logger[_0x5900f2('0x40')](_0x47da1d[_0x5900f2('0x38')]),_0x47da1d[_0x5900f2('0x36')]&&delete _0x47da1d[_0x5900f2('0x36')],_0x314ab0[_0x5900f2('0x32')](_0x2c1119)[_0x5900f2('0x2c')](_0x47da1d);};}exports['index']=function(_0x182c9b,_0x29dd96){const _0x3a2840=_0x4f48bf;let _0x427838={};const _0x1382a0={},_0x2afe29={'count':0x0,'rows':[]},_0xdfd654=_[_0x3a2840('0x1c')](db[_0x3a2840('0x3f')][_0x3a2840('0x8')],function(_0x1bfa02){const _0x4d86b4=_0x3a2840;return{'name':_0x1bfa02[_0x4d86b4('0x6')],'type':_0x1bfa02['type'][_0x4d86b4('0x1d')]};});_0x1382a0[_0x3a2840('0x20')]=_[_0x3a2840('0x1c')](_0xdfd654,_0x3a2840('0x36')),_0x1382a0[_0x3a2840('0x10')]=_[_0x3a2840('0x44')](_0x182c9b[_0x3a2840('0x10')]),_0x1382a0[_0x3a2840('0x3a')]=_[_0x3a2840('0xe')](_0x1382a0['model'],_0x1382a0[_0x3a2840('0x10')]),_0x427838[_0x3a2840('0x2f')]=_[_0x3a2840('0xe')](_0x1382a0[_0x3a2840('0x20')],qs['fields'](_0x182c9b[_0x3a2840('0x10')]['fields'])),_0x427838[_0x3a2840('0x2f')]=_0x427838[_0x3a2840('0x2f')][_0x3a2840('0x11')]?_0x427838[_0x3a2840('0x2f')]:_0x1382a0[_0x3a2840('0x20')];typeof _0x182c9b[_0x3a2840('0x10')][_0x3a2840('0x35')]===_0x3a2840('0x3d')&&(_0x427838[_0x3a2840('0x1a')]=qs[_0x3a2840('0x1a')](_0x182c9b[_0x3a2840('0x10')][_0x3a2840('0x1a')]),_0x427838['offset']=qs[_0x3a2840('0xd')](_0x182c9b[_0x3a2840('0x10')][_0x3a2840('0xd')]));_0x427838[_0x3a2840('0xa')]=qs[_0x3a2840('0x21')](_0x182c9b[_0x3a2840('0x10')]['sort']),_0x427838[_0x3a2840('0x27')]=qs[_0x3a2840('0x3a')](_[_0x3a2840('0x25')](_0x182c9b[_0x3a2840('0x10')],_0x1382a0[_0x3a2840('0x3a')]),_0xdfd654);_0x182c9b[_0x3a2840('0x10')][_0x3a2840('0x3b')]&&(_0x427838[_0x3a2840('0x27')]=_[_0x3a2840('0x23')](_0x427838[_0x3a2840('0x27')],{[Op['or']]:_[_0x3a2840('0x1c')](_0xdfd654,function(_0x4f6810){const _0x38f4b6=_0x3a2840;if(_0x4f6810[_0x38f4b6('0x37')]!==_0x38f4b6('0x1b')){const _0x479185={};return _0x479185[_0x4f6810[_0x38f4b6('0x36')]]={[Op[_0x38f4b6('0x1')]]:'%'+_0x182c9b[_0x38f4b6('0x10')][_0x38f4b6('0x3b')]+'%'},_0x479185;}})}));_0x427838=_[_0x3a2840('0x23')]({},_0x427838,_0x182c9b['options']);const _0x2e23b0={'where':_0x427838[_0x3a2840('0x27')]};return db['ChatGroup']['count'](_0x2e23b0)[_0x3a2840('0x14')](function(_0x8d4051){const _0x29cc4a=_0x3a2840;return _0x2afe29[_0x29cc4a('0x29')]=_0x8d4051,_0x182c9b[_0x29cc4a('0x10')][_0x29cc4a('0x22')]&&(_0x427838[_0x29cc4a('0xc')]=[{'all':!![]}]),db[_0x29cc4a('0x3f')][_0x29cc4a('0x2a')](_0x427838);})[_0x3a2840('0x14')](function(_0x4c3b4e){const _0x1c9d34=_0x3a2840;return _0x2afe29[_0x1c9d34('0x33')]=_0x4c3b4e,_0x2afe29;})[_0x3a2840('0x14')](respondWithFilteredResult(_0x29dd96,_0x427838))['catch'](handleError(_0x29dd96,null));},exports[_0x4f48bf('0x0')]=function(_0x545958,_0x3efd86){const _0x14c8fa=_0x4f48bf;let _0xa72301={'raw':!![],'where':{'id':_0x545958['params']['id']}};const _0x5c4e70={};return _0x5c4e70['model']=_['keys'](db[_0x14c8fa('0x3f')][_0x14c8fa('0x8')]),_0x5c4e70[_0x14c8fa('0x10')]=_['keys'](_0x545958[_0x14c8fa('0x10')]),_0x5c4e70[_0x14c8fa('0x3a')]=_['intersection'](_0x5c4e70[_0x14c8fa('0x20')],_0x5c4e70['query']),_0xa72301[_0x14c8fa('0x2f')]=_[_0x14c8fa('0xe')](_0x5c4e70['model'],qs[_0x14c8fa('0x3')](_0x545958[_0x14c8fa('0x10')][_0x14c8fa('0x3')])),_0xa72301['attributes']=_0xa72301[_0x14c8fa('0x2f')]['length']?_0xa72301[_0x14c8fa('0x2f')]:_0x5c4e70[_0x14c8fa('0x20')],_0x545958[_0x14c8fa('0x10')][_0x14c8fa('0x22')]&&(_0xa72301[_0x14c8fa('0xc')]=[{'all':!![]}]),_0xa72301=_[_0x14c8fa('0x23')]({},_0xa72301,_0x545958['options']),db['ChatGroup'][_0x14c8fa('0x30')](_0xa72301)[_0x14c8fa('0x14')](handleEntityNotFound(_0x3efd86,null))[_0x14c8fa('0x14')](respondWithResult(_0x3efd86,null))[_0x14c8fa('0x42')](handleError(_0x3efd86,null));},exports[_0x4f48bf('0x2e')]=function(_0x5e5f8d,_0xef1f5a){const _0x51b0ad=_0x4f48bf;return db['ChatGroup'][_0x51b0ad('0x2e')](_0x5e5f8d[_0x51b0ad('0x2b')],{})[_0x51b0ad('0x14')](respondWithResult(_0xef1f5a,0xc9))['catch'](handleError(_0xef1f5a,null));},exports[_0x4f48bf('0xf')]=function(_0x169b46,_0x4f15c1){const _0x872d73=_0x4f48bf;return _0x169b46[_0x872d73('0x2b')]['id']&&delete _0x169b46[_0x872d73('0x2b')]['id'],db[_0x872d73('0x3f')][_0x872d73('0x30')]({'where':{'id':_0x169b46[_0x872d73('0x34')]['id']}})[_0x872d73('0x14')](handleEntityNotFound(_0x4f15c1,null))[_0x872d73('0x14')](saveUpdates(_0x169b46[_0x872d73('0x2b')],null))[_0x872d73('0x14')](respondWithResult(_0x4f15c1,null))[_0x872d73('0x42')](handleError(_0x4f15c1,null));},exports[_0x4f48bf('0x41')]=function(_0x5d0c26,_0x5e762a){const _0x166b28=_0x4f48bf;return db[_0x166b28('0x3f')][_0x166b28('0x30')]({'where':{'id':_0x5d0c26['params']['id']}})[_0x166b28('0x14')](handleEntityNotFound(_0x5e762a,null))[_0x166b28('0x14')](removeEntity(_0x5e762a,null))[_0x166b28('0x42')](handleError(_0x5e762a,null));},exports['describe']=function(_0x423bc3,_0x3098d9){const _0x209380=_0x4f48bf;return db[_0x209380('0x3f')]['describe']()['then'](respondWithResult(_0x3098d9,null))[_0x209380('0x42')](handleError(_0x3098d9,null));},exports[_0x4f48bf('0x19')]=function(_0x58cd19,_0x301f6b){const _0x2de00b=_0x4f48bf;return db[_0x2de00b('0x16')][_0x2de00b('0x29')]({'where':{'ChatGroupId':_0x58cd19['params']['id'],'ToId':_0x58cd19[_0x2de00b('0x1e')]['id'],'read':![]}})[_0x2de00b('0x14')](function(_0x2bd369){const _0x134927=_0x2de00b;return{'id':_[_0x134927('0x31')](_0x58cd19[_0x134927('0x34')]['id']),'count':_0x2bd369};})[_0x2de00b('0x14')](respondWithResult(_0x301f6b,null))[_0x2de00b('0x42')](handleError(_0x301f6b,null));},exports[_0x4f48bf('0x3c')]=function(_0xa49920,_0x16f9ca){const _0x2b30a3=_0x4f48bf;return db[_0x2b30a3('0x3f')]['findOne']({'where':{'id':_0xa49920[_0x2b30a3('0x34')]['id']}})[_0x2b30a3('0x14')](function(_0x170839){const _0x2f7396=_0x2b30a3;if(_0x170839)return _0x170839[_0x2f7396('0x3c')](_0xa49920['body'][_0x2f7396('0x45')],{'through':_[_0x2f7396('0x5')](_0xa49920[_0x2f7396('0x2b')],[_0x2f7396('0x45'),'id'])});})[_0x2b30a3('0x14')](respondWithResult(_0x16f9ca,null))[_0x2b30a3('0x42')](handleError(_0x16f9ca,null));},exports[_0x4f48bf('0x3e')]=function(_0x4bdcb3,_0x47e642){const _0x281e21=_0x4f48bf;let _0x2436ff={};const _0x56dc6f={};let _0xf56960,_0x1baa5e;return db[_0x281e21('0x3f')][_0x281e21('0x30')]({'where':{'id':_0x4bdcb3['params']['id']}})[_0x281e21('0x14')](handleEntityNotFound(_0x47e642,null))['then'](function(_0x5272d3){const _0x44b627=_0x281e21;if(_0x5272d3)return _0xf56960=_0x5272d3,_0x56dc6f[_0x44b627('0x20')]=_[_0x44b627('0x44')](db['User'][_0x44b627('0x8')]),_0x56dc6f[_0x44b627('0x10')]=_[_0x44b627('0x44')](_0x4bdcb3['query']),_0x56dc6f[_0x44b627('0x3a')]=_[_0x44b627('0xe')](_0x56dc6f[_0x44b627('0x20')],_0x56dc6f[_0x44b627('0x10')]),_0x2436ff[_0x44b627('0x2f')]=_['intersection'](_0x56dc6f[_0x44b627('0x20')],qs['fields'](_0x4bdcb3[_0x44b627('0x10')]['fields'])),_0x2436ff['attributes']=_0x2436ff[_0x44b627('0x2f')][_0x44b627('0x11')]?_0x2436ff['attributes']:_0x56dc6f[_0x44b627('0x20')],_0x2436ff[_0x44b627('0xa')]=qs[_0x44b627('0x21')](_0x4bdcb3[_0x44b627('0x10')][_0x44b627('0x21')]),_0x2436ff[_0x44b627('0x27')]=qs[_0x44b627('0x3a')](_[_0x44b627('0x25')](_0x4bdcb3[_0x44b627('0x10')],_0x56dc6f[_0x44b627('0x3a')])),_0x4bdcb3[_0x44b627('0x10')][_0x44b627('0x3b')]&&(_0x2436ff[_0x44b627('0x27')]=_[_0x44b627('0x23')](_0x2436ff[_0x44b627('0x27')],{[Op['or']]:_[_0x44b627('0x1c')](_0x2436ff[_0x44b627('0x2f')],function(_0x1cc8cb){const _0x38d03d=_0x44b627,_0x2edac3={};return _0x2edac3[_0x1cc8cb]={[Op[_0x38d03d('0x1')]]:'%'+_0x4bdcb3['query']['filter']+'%'},_0x2edac3;})})),_0x2436ff=_['merge']({},_0x2436ff,_0x4bdcb3['options']),_0xf56960[_0x44b627('0x3e')](_0x2436ff);})[_0x281e21('0x14')](function(_0x589d8f){const _0x1d72b2=_0x281e21;if(_0x589d8f)return _0x1baa5e=_0x589d8f[_0x1d72b2('0x11')],typeof _0x4bdcb3[_0x1d72b2('0x10')]['nolimit']===_0x1d72b2('0x3d')&&(_0x2436ff['limit']=qs[_0x1d72b2('0x1a')](_0x4bdcb3['query']['limit']),_0x2436ff[_0x1d72b2('0xd')]=qs[_0x1d72b2('0xd')](_0x4bdcb3[_0x1d72b2('0x10')][_0x1d72b2('0xd')])),_0xf56960['getMembers'](_0x2436ff);})['then'](function(_0x98d8cc){if(_0x98d8cc)return _0x98d8cc?{'count':_0x1baa5e,'rows':_0x98d8cc}:null;})[_0x281e21('0x14')](respondWithResult(_0x47e642,null))[_0x281e21('0x42')](handleError(_0x47e642,null));},exports[_0x4f48bf('0x18')]=function(_0x2e2bef,_0x38e6bb){const _0x38563c=_0x4f48bf;return db['ChatGroup']['findOne']({'where':{'id':_0x2e2bef['params']['id']}})['then'](handleEntityNotFound(_0x38e6bb,null))[_0x38563c('0x14')](function(_0x14d54b){const _0x4e29c8=_0x38563c;if(_0x14d54b)return _0x14d54b['removeMembers'](_0x2e2bef[_0x4e29c8('0x10')][_0x4e29c8('0x45')]);})[_0x38563c('0x14')](respondWithStatusCode(_0x38e6bb,null))[_0x38563c('0x42')](handleError(_0x38e6bb,null));},exports[_0x4f48bf('0x12')]=function(_0xe35124,_0x421e80){const _0x4031f7=_0x4f48bf;return _0xe35124[_0x4031f7('0x2b')]['id']&&delete _0xe35124[_0x4031f7('0x2b')]['id'],db['ChatGroup'][_0x4031f7('0x30')]({'where':{'id':_0xe35124[_0x4031f7('0x34')]['id']}})[_0x4031f7('0x14')](handleEntityNotFound(_0x421e80,null))[_0x4031f7('0x14')](function(_0x2f2d9b){const _0x49e2ff=_0x4031f7;if(_0x2f2d9b)return _0xe35124[_0x49e2ff('0x2b')]['ChatGroupId']=_0x2f2d9b['id'],db[_0x49e2ff('0x16')][_0x49e2ff('0x2e')](_0xe35124[_0x49e2ff('0x2b')]);})[_0x4031f7('0x14')](respondWithResult(_0x421e80,null))[_0x4031f7('0x42')](handleError(_0x421e80,null));},exports[_0x4f48bf('0x17')]=function(_0x2674d9,_0x3061cd){const _0x5f0d10=_0x4f48bf;let _0x24b28f={};const _0x2db1af={};let _0x10eee2,_0x4dbde8;return db[_0x5f0d10('0x3f')][_0x5f0d10('0x30')]({'where':{'id':_0x2674d9[_0x5f0d10('0x34')]['id']}})[_0x5f0d10('0x14')](handleEntityNotFound(_0x3061cd,null))[_0x5f0d10('0x14')](function(_0x1005c4){const _0x222e76=_0x5f0d10;if(_0x1005c4){_0x10eee2=_0x1005c4,_0x2db1af[_0x222e76('0x20')]=_['keys'](db[_0x222e76('0x16')]['rawAttributes']),_0x2db1af[_0x222e76('0x10')]=_[_0x222e76('0x44')](_0x2674d9[_0x222e76('0x10')]),_0x2db1af[_0x222e76('0x3a')]=_['intersection'](_0x2db1af[_0x222e76('0x20')],_0x2db1af[_0x222e76('0x10')]),_0x24b28f['attributes']=_[_0x222e76('0xe')](_0x2db1af[_0x222e76('0x20')],qs[_0x222e76('0x3')](_0x2674d9[_0x222e76('0x10')]['fields'])),_0x24b28f['attributes']=_0x24b28f['attributes'][_0x222e76('0x11')]?_0x24b28f[_0x222e76('0x2f')]:_0x2db1af['model'],_0x24b28f[_0x222e76('0xa')]=qs[_0x222e76('0x21')](_0x2674d9['query']['sort']),_0x24b28f[_0x222e76('0x27')]=qs[_0x222e76('0x3a')](_[_0x222e76('0x25')](_0x2674d9[_0x222e76('0x10')],_0x2db1af[_0x222e76('0x3a')]));_0x2674d9[_0x222e76('0x10')][_0x222e76('0x3b')]&&(_0x24b28f[_0x222e76('0x27')]=_[_0x222e76('0x23')](_0x24b28f['where'],{[Op['or']]:_[_0x222e76('0x1c')](_0x24b28f[_0x222e76('0x2f')],function(_0x5e1bc2){const _0x317e01=_0x222e76,_0x460efa={};return _0x460efa[_0x5e1bc2]={[Op['like']]:'%'+_0x2674d9[_0x317e01('0x10')][_0x317e01('0x3b')]+'%'},_0x460efa;})}));if(_0x2674d9['query']['$gte']){const _0x3d8ce1=_0x2674d9[_0x222e76('0x10')][_0x222e76('0x7')][_0x222e76('0x15')](','),_0x9a948f={};_0x9a948f[_0x3d8ce1[0x0]]={[Op['gte']]:moment(_0x3d8ce1[0x1])[_0x222e76('0x4')](_0x222e76('0x39'))},_0x24b28f['where']=_[_0x222e76('0x23')](_0x24b28f[_0x222e76('0x27')],_0x9a948f);}return _0x24b28f=_[_0x222e76('0x23')]({},_0x24b28f,_0x2674d9['options']),_0x10eee2[_0x222e76('0x17')](_0x24b28f);}})[_0x5f0d10('0x14')](function(_0x334d25){const _0x1f5416=_0x5f0d10;if(_0x334d25)return _0x4dbde8=_0x334d25['length'],typeof _0x2674d9[_0x1f5416('0x10')]['nolimit']===_0x1f5416('0x3d')&&(_0x24b28f[_0x1f5416('0x1a')]=qs['limit'](_0x2674d9[_0x1f5416('0x10')]['limit']),_0x24b28f[_0x1f5416('0xd')]=qs[_0x1f5416('0xd')](_0x2674d9[_0x1f5416('0x10')]['offset'])),_0x10eee2[_0x1f5416('0x17')](_0x24b28f);})['then'](function(_0x3f4915){if(_0x3f4915)return _0x3f4915?{'count':_0x4dbde8,'rows':_0x3f4915}:null;})[_0x5f0d10('0x14')](respondWithResult(_0x3061cd,null))['catch'](handleError(_0x3061cd,null));};
\ No newline at end of file
+const a59_0x5c6f=['ChatGroup','fields','query','offset','filters','User','includeAll','addMembers','ChatInternalMessage','VIRTUAL','user','show','fieldName','moment','options','update','findOne','nolimit','keys','rawAttributes','name','map','set','pick','order','type','key','filter','getMembers','getMessages','end','../../mysqldb','limit','status','removeMembers','describe','params','then','Content-Range','ids','rows','stack','register','sort','length','where','create','count','intersection','undefined','api','./chatGroup.socket','attributes','destroy','lodash','error','sendStatus','$gte','../../rediscache','body','split','toInteger','sequelize','json','like','include','merge','catch','model'];(function(_0x546c9c,_0x5c6f20){const _0xd0c10f=function(_0x19685c){while(--_0x19685c){_0x546c9c['push'](_0x546c9c['shift']());}};_0xd0c10f(++_0x5c6f20);}(a59_0x5c6f,0xc3));const a59_0xd0c1=function(_0x546c9c,_0x5c6f20){_0x546c9c=_0x546c9c-0x0;let _0xd0c10f=a59_0x5c6f[_0x546c9c];return _0xd0c10f;};const _0x229491=a59_0xd0c1;'use strict';const moment=require(_0x229491('0x19')),_=require(_0x229491('0x42')),{getSocket}=require(_0x229491('0x1')),qs=require('../../components/parsers/qs'),logger=require('../../config/logger')(_0x229491('0x3e')),db=require(_0x229491('0x2b'))['db'],{Op}=require(_0x229491('0x5')),socket=getSocket();require(_0x229491('0x3f'))[_0x229491('0x36')](socket);function respondWithStatusCode(_0x19685c,_0x405e34){return _0x405e34=_0x405e34||0xcc,function(_0x4ca020){const _0x31ccd8=a59_0xd0c1;if(_0x4ca020)return _0x19685c[_0x31ccd8('0x44')](_0x405e34);return _0x19685c[_0x31ccd8('0x2d')](_0x405e34)['end']();};}function respondWithResult(_0x513b10,_0x153a58){return _0x153a58=_0x153a58||0xc8,function(_0x3db4f6){const _0x5b1469=a59_0xd0c1;if(_0x3db4f6)return _0x513b10['status'](_0x153a58)[_0x5b1469('0x6')](_0x3db4f6);};}function respondWithFilteredResult(_0x1bff92,_0x5d8cb2){return function(_0x255c13){const _0x3cedac=a59_0xd0c1;if(_0x255c13){const _0x5c5120=_0x255c13['count'],_0x173640=_0x5d8cb2[_0x3cedac('0xf')];let _0x1ac4af=_0x5d8cb2[_0x3cedac('0xf')]+_0x5d8cb2[_0x3cedac('0x2c')],_0x4cdc8f;return _0x1ac4af>=_0x5c5120?(_0x1ac4af=_0x5c5120,_0x4cdc8f=0xc8):_0x4cdc8f=0xce,_0x1bff92[_0x3cedac('0x2d')](_0x4cdc8f),_0x1bff92[_0x3cedac('0x22')](_0x3cedac('0x32'),_0x173640+'-'+_0x1ac4af+'/'+_0x5c5120)[_0x3cedac('0x6')](_0x255c13);}return null;};}function saveUpdates(_0x170cfe){return function(_0x453c5e){const _0x1021b5=a59_0xd0c1;if(_0x453c5e)return _0x453c5e[_0x1021b5('0x1b')](_0x170cfe)[_0x1021b5('0x31')](function(_0xbf2cf1){return _0xbf2cf1;});return null;};}function removeEntity(_0x88a9d0){return function(_0x1b6ec7){const _0x44a026=a59_0xd0c1;if(_0x1b6ec7)return _0x1b6ec7[_0x44a026('0x41')]()[_0x44a026('0x31')](function(){const _0x1a69e5=_0x44a026;_0x88a9d0[_0x1a69e5('0x2d')](0xcc)[_0x1a69e5('0x2a')]();});};}function handleEntityNotFound(_0x3cff5f){return function(_0x35e3ed){const _0x500f41=a59_0xd0c1;return!_0x35e3ed&&_0x3cff5f[_0x500f41('0x44')](0x194),_0x35e3ed;};}function handleError(_0x4d788a,_0x12c16b){return _0x12c16b=_0x12c16b||0x1f4,function(_0x5ba703){const _0x596ba6=a59_0xd0c1;logger[_0x596ba6('0x43')](_0x5ba703[_0x596ba6('0x35')]),_0x5ba703[_0x596ba6('0x20')]&&delete _0x5ba703[_0x596ba6('0x20')],_0x4d788a['status'](_0x12c16b)['send'](_0x5ba703);};}exports['index']=function(_0x1e0e8c,_0x162fc2){const _0x3ce065=_0x229491;let _0x3eee88={};const _0x51605b={},_0x58a231={'count':0x0,'rows':[]},_0x5a711c=_[_0x3ce065('0x21')](db[_0x3ce065('0xc')][_0x3ce065('0x1f')],function(_0x916c54){const _0x3ac69c=_0x3ce065;return{'name':_0x916c54[_0x3ac69c('0x18')],'type':_0x916c54['type'][_0x3ac69c('0x26')]};});_0x51605b[_0x3ce065('0xb')]=_[_0x3ce065('0x21')](_0x5a711c,_0x3ce065('0x20')),_0x51605b['query']=_[_0x3ce065('0x1e')](_0x1e0e8c[_0x3ce065('0xe')]),_0x51605b[_0x3ce065('0x10')]=_['intersection'](_0x51605b[_0x3ce065('0xb')],_0x51605b[_0x3ce065('0xe')]),_0x3eee88[_0x3ce065('0x40')]=_[_0x3ce065('0x3c')](_0x51605b[_0x3ce065('0xb')],qs[_0x3ce065('0xd')](_0x1e0e8c[_0x3ce065('0xe')][_0x3ce065('0xd')])),_0x3eee88[_0x3ce065('0x40')]=_0x3eee88[_0x3ce065('0x40')]['length']?_0x3eee88[_0x3ce065('0x40')]:_0x51605b[_0x3ce065('0xb')];typeof _0x1e0e8c[_0x3ce065('0xe')][_0x3ce065('0x1d')]===_0x3ce065('0x3d')&&(_0x3eee88[_0x3ce065('0x2c')]=qs[_0x3ce065('0x2c')](_0x1e0e8c[_0x3ce065('0xe')][_0x3ce065('0x2c')]),_0x3eee88[_0x3ce065('0xf')]=qs['offset'](_0x1e0e8c['query']['offset']));_0x3eee88[_0x3ce065('0x24')]=qs[_0x3ce065('0x37')](_0x1e0e8c[_0x3ce065('0xe')][_0x3ce065('0x37')]),_0x3eee88[_0x3ce065('0x39')]=qs[_0x3ce065('0x10')](_[_0x3ce065('0x23')](_0x1e0e8c['query'],_0x51605b[_0x3ce065('0x10')]),_0x5a711c);_0x1e0e8c[_0x3ce065('0xe')]['filter']&&(_0x3eee88[_0x3ce065('0x39')]=_[_0x3ce065('0x9')](_0x3eee88[_0x3ce065('0x39')],{[Op['or']]:_[_0x3ce065('0x21')](_0x5a711c,function(_0xdca06b){const _0x1112ec=_0x3ce065;if(_0xdca06b[_0x1112ec('0x25')]!==_0x1112ec('0x15')){const _0x3f82b0={};return _0x3f82b0[_0xdca06b[_0x1112ec('0x20')]]={[Op[_0x1112ec('0x7')]]:'%'+_0x1e0e8c['query']['filter']+'%'},_0x3f82b0;}})}));_0x3eee88=_['merge']({},_0x3eee88,_0x1e0e8c['options']);const _0x3cafdb={'where':_0x3eee88[_0x3ce065('0x39')]};return db[_0x3ce065('0xc')][_0x3ce065('0x3b')](_0x3cafdb)[_0x3ce065('0x31')](function(_0x47e535){const _0x528e45=_0x3ce065;return _0x58a231[_0x528e45('0x3b')]=_0x47e535,_0x1e0e8c[_0x528e45('0xe')]['includeAll']&&(_0x3eee88[_0x528e45('0x8')]=[{'all':!![]}]),db[_0x528e45('0xc')]['findAll'](_0x3eee88);})[_0x3ce065('0x31')](function(_0x440f19){const _0x22a1f1=_0x3ce065;return _0x58a231[_0x22a1f1('0x34')]=_0x440f19,_0x58a231;})['then'](respondWithFilteredResult(_0x162fc2,_0x3eee88))[_0x3ce065('0xa')](handleError(_0x162fc2,null));},exports[_0x229491('0x17')]=function(_0x35f325,_0x5a010d){const _0x2b2015=_0x229491;let _0x3c3352={'raw':!![],'where':{'id':_0x35f325['params']['id']}};const _0x274a1f={};return _0x274a1f['model']=_[_0x2b2015('0x1e')](db[_0x2b2015('0xc')][_0x2b2015('0x1f')]),_0x274a1f[_0x2b2015('0xe')]=_['keys'](_0x35f325[_0x2b2015('0xe')]),_0x274a1f[_0x2b2015('0x10')]=_[_0x2b2015('0x3c')](_0x274a1f[_0x2b2015('0xb')],_0x274a1f[_0x2b2015('0xe')]),_0x3c3352['attributes']=_[_0x2b2015('0x3c')](_0x274a1f[_0x2b2015('0xb')],qs[_0x2b2015('0xd')](_0x35f325['query'][_0x2b2015('0xd')])),_0x3c3352[_0x2b2015('0x40')]=_0x3c3352[_0x2b2015('0x40')][_0x2b2015('0x38')]?_0x3c3352[_0x2b2015('0x40')]:_0x274a1f[_0x2b2015('0xb')],_0x35f325[_0x2b2015('0xe')][_0x2b2015('0x12')]&&(_0x3c3352[_0x2b2015('0x8')]=[{'all':!![]}]),_0x3c3352=_[_0x2b2015('0x9')]({},_0x3c3352,_0x35f325['options']),db[_0x2b2015('0xc')][_0x2b2015('0x1c')](_0x3c3352)[_0x2b2015('0x31')](handleEntityNotFound(_0x5a010d,null))[_0x2b2015('0x31')](respondWithResult(_0x5a010d,null))[_0x2b2015('0xa')](handleError(_0x5a010d,null));},exports[_0x229491('0x3a')]=function(_0x348cea,_0x652d44){return db['ChatGroup']['create'](_0x348cea['body'],{})['then'](respondWithResult(_0x652d44,0xc9))['catch'](handleError(_0x652d44,null));},exports[_0x229491('0x1b')]=function(_0x1f1cc4,_0x4fff83){const _0x262a2e=_0x229491;return _0x1f1cc4[_0x262a2e('0x2')]['id']&&delete _0x1f1cc4['body']['id'],db[_0x262a2e('0xc')][_0x262a2e('0x1c')]({'where':{'id':_0x1f1cc4[_0x262a2e('0x30')]['id']}})['then'](handleEntityNotFound(_0x4fff83,null))[_0x262a2e('0x31')](saveUpdates(_0x1f1cc4[_0x262a2e('0x2')],null))[_0x262a2e('0x31')](respondWithResult(_0x4fff83,null))[_0x262a2e('0xa')](handleError(_0x4fff83,null));},exports[_0x229491('0x41')]=function(_0x5a5a2a,_0x311bc8){const _0x3ce732=_0x229491;return db[_0x3ce732('0xc')][_0x3ce732('0x1c')]({'where':{'id':_0x5a5a2a[_0x3ce732('0x30')]['id']}})['then'](handleEntityNotFound(_0x311bc8,null))[_0x3ce732('0x31')](removeEntity(_0x311bc8,null))[_0x3ce732('0xa')](handleError(_0x311bc8,null));},exports[_0x229491('0x2f')]=function(_0x81e470,_0x253aa6){const _0x18c452=_0x229491;return db[_0x18c452('0xc')]['describe']()[_0x18c452('0x31')](respondWithResult(_0x253aa6,null))[_0x18c452('0xa')](handleError(_0x253aa6,null));},exports['getUnread']=function(_0x37a9a3,_0x23c2ce){const _0x468966=_0x229491;return db[_0x468966('0x14')]['count']({'where':{'ChatGroupId':_0x37a9a3[_0x468966('0x30')]['id'],'ToId':_0x37a9a3[_0x468966('0x16')]['id'],'read':![]}})[_0x468966('0x31')](function(_0x3fc12e){const _0x515bfd=_0x468966;return{'id':_[_0x515bfd('0x4')](_0x37a9a3[_0x515bfd('0x30')]['id']),'count':_0x3fc12e};})[_0x468966('0x31')](respondWithResult(_0x23c2ce,null))[_0x468966('0xa')](handleError(_0x23c2ce,null));},exports[_0x229491('0x13')]=function(_0x12402b,_0x3c3b1d){const _0x34a4ec=_0x229491;return db[_0x34a4ec('0xc')][_0x34a4ec('0x1c')]({'where':{'id':_0x12402b['params']['id']}})[_0x34a4ec('0x31')](function(_0x2b7aa2){const _0x1b7571=_0x34a4ec;if(_0x2b7aa2)return _0x2b7aa2['addMembers'](_0x12402b[_0x1b7571('0x2')][_0x1b7571('0x33')],{'through':_['omit'](_0x12402b[_0x1b7571('0x2')],['ids','id'])});})[_0x34a4ec('0x31')](respondWithResult(_0x3c3b1d,null))['catch'](handleError(_0x3c3b1d,null));},exports['getMembers']=function(_0x36290b,_0x4be603){const _0x5a2429=_0x229491;let _0x1ccfb6={};const _0x1536b8={};let _0x34f86e,_0x3c16ca;return db['ChatGroup'][_0x5a2429('0x1c')]({'where':{'id':_0x36290b[_0x5a2429('0x30')]['id']}})[_0x5a2429('0x31')](handleEntityNotFound(_0x4be603,null))['then'](function(_0x5892ba){const _0x591cc6=_0x5a2429;if(_0x5892ba)return _0x34f86e=_0x5892ba,_0x1536b8[_0x591cc6('0xb')]=_[_0x591cc6('0x1e')](db[_0x591cc6('0x11')]['rawAttributes']),_0x1536b8[_0x591cc6('0xe')]=_['keys'](_0x36290b[_0x591cc6('0xe')]),_0x1536b8[_0x591cc6('0x10')]=_['intersection'](_0x1536b8[_0x591cc6('0xb')],_0x1536b8[_0x591cc6('0xe')]),_0x1ccfb6[_0x591cc6('0x40')]=_[_0x591cc6('0x3c')](_0x1536b8[_0x591cc6('0xb')],qs[_0x591cc6('0xd')](_0x36290b[_0x591cc6('0xe')]['fields'])),_0x1ccfb6[_0x591cc6('0x40')]=_0x1ccfb6[_0x591cc6('0x40')][_0x591cc6('0x38')]?_0x1ccfb6[_0x591cc6('0x40')]:_0x1536b8['model'],_0x1ccfb6[_0x591cc6('0x24')]=qs[_0x591cc6('0x37')](_0x36290b['query'][_0x591cc6('0x37')]),_0x1ccfb6[_0x591cc6('0x39')]=qs['filters'](_['pick'](_0x36290b['query'],_0x1536b8[_0x591cc6('0x10')])),_0x36290b['query'][_0x591cc6('0x27')]&&(_0x1ccfb6[_0x591cc6('0x39')]=_[_0x591cc6('0x9')](_0x1ccfb6['where'],{[Op['or']]:_[_0x591cc6('0x21')](_0x1ccfb6[_0x591cc6('0x40')],function(_0x5784ab){const _0x102896=_0x591cc6,_0x4b1dff={};return _0x4b1dff[_0x5784ab]={[Op[_0x102896('0x7')]]:'%'+_0x36290b['query']['filter']+'%'},_0x4b1dff;})})),_0x1ccfb6=_[_0x591cc6('0x9')]({},_0x1ccfb6,_0x36290b['options']),_0x34f86e[_0x591cc6('0x28')](_0x1ccfb6);})['then'](function(_0x1b64c8){const _0x8de6b3=_0x5a2429;if(_0x1b64c8)return _0x3c16ca=_0x1b64c8[_0x8de6b3('0x38')],typeof _0x36290b[_0x8de6b3('0xe')][_0x8de6b3('0x1d')]==='undefined'&&(_0x1ccfb6[_0x8de6b3('0x2c')]=qs[_0x8de6b3('0x2c')](_0x36290b[_0x8de6b3('0xe')][_0x8de6b3('0x2c')]),_0x1ccfb6[_0x8de6b3('0xf')]=qs[_0x8de6b3('0xf')](_0x36290b['query']['offset'])),_0x34f86e[_0x8de6b3('0x28')](_0x1ccfb6);})[_0x5a2429('0x31')](function(_0x25328d){if(_0x25328d)return _0x25328d?{'count':_0x3c16ca,'rows':_0x25328d}:null;})[_0x5a2429('0x31')](respondWithResult(_0x4be603,null))['catch'](handleError(_0x4be603,null));},exports[_0x229491('0x2e')]=function(_0x5d2380,_0x43d177){const _0x1ddb4c=_0x229491;return db[_0x1ddb4c('0xc')][_0x1ddb4c('0x1c')]({'where':{'id':_0x5d2380['params']['id']}})[_0x1ddb4c('0x31')](handleEntityNotFound(_0x43d177,null))[_0x1ddb4c('0x31')](function(_0x34b1ae){const _0xd67cc9=_0x1ddb4c;if(_0x34b1ae)return _0x34b1ae[_0xd67cc9('0x2e')](_0x5d2380['query']['ids']);})[_0x1ddb4c('0x31')](respondWithStatusCode(_0x43d177,null))[_0x1ddb4c('0xa')](handleError(_0x43d177,null));},exports['addMessage']=function(_0x2469d9,_0x9f1f9b){const _0x46a426=_0x229491;return _0x2469d9[_0x46a426('0x2')]['id']&&delete _0x2469d9[_0x46a426('0x2')]['id'],db[_0x46a426('0xc')][_0x46a426('0x1c')]({'where':{'id':_0x2469d9[_0x46a426('0x30')]['id']}})['then'](handleEntityNotFound(_0x9f1f9b,null))[_0x46a426('0x31')](function(_0x4a426a){const _0x38172b=_0x46a426;if(_0x4a426a)return _0x2469d9[_0x38172b('0x2')]['ChatGroupId']=_0x4a426a['id'],db[_0x38172b('0x14')]['create'](_0x2469d9[_0x38172b('0x2')]);})[_0x46a426('0x31')](respondWithResult(_0x9f1f9b,null))['catch'](handleError(_0x9f1f9b,null));},exports[_0x229491('0x29')]=function(_0x52ffe9,_0x500313){const _0x421d51=_0x229491;let _0xe5d20d={};const _0xdabd78={};let _0x4cca62,_0x44a2a0;return db['ChatGroup']['findOne']({'where':{'id':_0x52ffe9[_0x421d51('0x30')]['id']}})[_0x421d51('0x31')](handleEntityNotFound(_0x500313,null))[_0x421d51('0x31')](function(_0x584ac1){const _0x1c804d=_0x421d51;if(_0x584ac1){_0x4cca62=_0x584ac1,_0xdabd78['model']=_[_0x1c804d('0x1e')](db[_0x1c804d('0x14')][_0x1c804d('0x1f')]),_0xdabd78['query']=_[_0x1c804d('0x1e')](_0x52ffe9[_0x1c804d('0xe')]),_0xdabd78[_0x1c804d('0x10')]=_['intersection'](_0xdabd78['model'],_0xdabd78['query']),_0xe5d20d['attributes']=_[_0x1c804d('0x3c')](_0xdabd78[_0x1c804d('0xb')],qs[_0x1c804d('0xd')](_0x52ffe9[_0x1c804d('0xe')][_0x1c804d('0xd')])),_0xe5d20d['attributes']=_0xe5d20d[_0x1c804d('0x40')][_0x1c804d('0x38')]?_0xe5d20d[_0x1c804d('0x40')]:_0xdabd78[_0x1c804d('0xb')],_0xe5d20d[_0x1c804d('0x24')]=qs[_0x1c804d('0x37')](_0x52ffe9['query'][_0x1c804d('0x37')]),_0xe5d20d[_0x1c804d('0x39')]=qs['filters'](_[_0x1c804d('0x23')](_0x52ffe9[_0x1c804d('0xe')],_0xdabd78[_0x1c804d('0x10')]));_0x52ffe9[_0x1c804d('0xe')]['filter']&&(_0xe5d20d[_0x1c804d('0x39')]=_[_0x1c804d('0x9')](_0xe5d20d['where'],{[Op['or']]:_[_0x1c804d('0x21')](_0xe5d20d[_0x1c804d('0x40')],function(_0x15a2e8){const _0x42de8a=_0x1c804d,_0xa1c0df={};return _0xa1c0df[_0x15a2e8]={[Op[_0x42de8a('0x7')]]:'%'+_0x52ffe9[_0x42de8a('0xe')][_0x42de8a('0x27')]+'%'},_0xa1c0df;})}));if(_0x52ffe9[_0x1c804d('0xe')][_0x1c804d('0x0')]){const _0x894dbe=_0x52ffe9[_0x1c804d('0xe')][_0x1c804d('0x0')][_0x1c804d('0x3')](','),_0x4fe456={};_0x4fe456[_0x894dbe[0x0]]={[Op['gte']]:moment(_0x894dbe[0x1])['format']('YYYY-MM-DD\x20HH:mm:ss')},_0xe5d20d['where']=_[_0x1c804d('0x9')](_0xe5d20d[_0x1c804d('0x39')],_0x4fe456);}return _0xe5d20d=_['merge']({},_0xe5d20d,_0x52ffe9[_0x1c804d('0x1a')]),_0x4cca62[_0x1c804d('0x29')](_0xe5d20d);}})['then'](function(_0x27cf60){const _0x3338db=_0x421d51;if(_0x27cf60)return _0x44a2a0=_0x27cf60[_0x3338db('0x38')],typeof _0x52ffe9['query'][_0x3338db('0x1d')]==='undefined'&&(_0xe5d20d[_0x3338db('0x2c')]=qs['limit'](_0x52ffe9[_0x3338db('0xe')][_0x3338db('0x2c')]),_0xe5d20d[_0x3338db('0xf')]=qs[_0x3338db('0xf')](_0x52ffe9['query'][_0x3338db('0xf')])),_0x4cca62[_0x3338db('0x29')](_0xe5d20d);})[_0x421d51('0x31')](function(_0x1ea4c5){if(_0x1ea4c5)return _0x1ea4c5?{'count':_0x44a2a0,'rows':_0x1ea4c5}:null;})[_0x421d51('0x31')](respondWithResult(_0x500313,null))[_0x421d51('0xa')](handleError(_0x500313,null));};
\ No newline at end of file