Built motion from commit 459747fdfe53bbf13fbede61eeaffea1f1438f86. Version 3.0.0...
[motion-next.git] / server / api / chatQueueReport / chatQueueReport.controller.js
1 const a102_0x2d06=['index','fieldName','pick','where','show','filter','../../components/parsers/qs','body','describe','rows','lodash','sequelize','../../config/logger','create','catch','key','fields','map','limit','then','params','status','options','keys','rawAttributes','type','query','model','filters','api','findOne','Content-Range','merge','sendStatus','includeAll','ChatQueueReport','end','length','offset','sort','intersection','order','destroy','name','VIRTUAL','include','attributes','json','count','update','send'];(function(_0x340f8a,_0x2d061b){const _0x4babca=function(_0x3cb2ef){while(--_0x3cb2ef){_0x340f8a['push'](_0x340f8a['shift']());}};_0x4babca(++_0x2d061b);}(a102_0x2d06,0x75));const a102_0x4bab=function(_0x340f8a,_0x2d061b){_0x340f8a=_0x340f8a-0x0;let _0x4babca=a102_0x2d06[_0x340f8a];return _0x4babca;};const _0x28268c=a102_0x4bab;'use strict';const _=require(_0x28268c('0x2e')),qs=require(_0x28268c('0x2a')),logger=require(_0x28268c('0x30'))(_0x28268c('0xe')),db=require('../../mysqldb')['db'],{Op}=require(_0x28268c('0x2f'));function respondWithResult(_0x3cb2ef,_0x573a6b){return _0x573a6b=_0x573a6b||0xc8,function(_0x37c910){const _0x53a844=a102_0x4bab;if(_0x37c910)return _0x3cb2ef[_0x53a844('0x6')](_0x573a6b)[_0x53a844('0x20')](_0x37c910);};}function respondWithFilteredResult(_0x2fab27,_0x49a8c9){return function(_0xa0ad88){const _0x4bd70f=a102_0x4bab;if(_0xa0ad88){const _0x31e819=_0xa0ad88[_0x4bd70f('0x21')],_0x20b673=_0x49a8c9['offset'];let _0x4e5f1f=_0x49a8c9[_0x4bd70f('0x17')]+_0x49a8c9[_0x4bd70f('0x3')],_0x2df783;return _0x4e5f1f>=_0x31e819?(_0x4e5f1f=_0x31e819,_0x2df783=0xc8):_0x2df783=0xce,_0x2fab27['status'](_0x2df783),_0x2fab27['set'](_0x4bd70f('0x10'),_0x20b673+'-'+_0x4e5f1f+'/'+_0x31e819)['json'](_0xa0ad88);}return null;};}function saveUpdates(_0x37f8b2){return function(_0x1e8576){const _0x2c51d6=a102_0x4bab;if(_0x1e8576)return _0x1e8576[_0x2c51d6('0x22')](_0x37f8b2)[_0x2c51d6('0x4')](function(_0x301e4e){return _0x301e4e;});return null;};}function removeEntity(_0x2a1ffa){return function(_0x2c8e42){const _0x12955d=a102_0x4bab;if(_0x2c8e42)return _0x2c8e42[_0x12955d('0x1b')]()[_0x12955d('0x4')](function(){const _0x8c160c=_0x12955d;_0x2a1ffa[_0x8c160c('0x6')](0xcc)[_0x8c160c('0x15')]();});};}function handleEntityNotFound(_0x11885f){return function(_0x551aaf){const _0x1a25f9=a102_0x4bab;return!_0x551aaf&&_0x11885f[_0x1a25f9('0x12')](0x194),_0x551aaf;};}function handleError(_0x4e3697,_0x4846bd){return _0x4846bd=_0x4846bd||0x1f4,function(_0x244732){const _0xce1121=a102_0x4bab;logger['error'](_0x244732['stack']),_0x244732[_0xce1121('0x1c')]&&delete _0x244732[_0xce1121('0x1c')],_0x4e3697[_0xce1121('0x6')](_0x4846bd)[_0xce1121('0x23')](_0x244732);};}exports[_0x28268c('0x24')]=function(_0x13b8c9,_0x50024f){const _0x584f1c=_0x28268c;let _0x3b5a75={};const _0x4a3c32={},_0x2d1580={'count':0x0,'rows':[]},_0x332101=_['map'](db[_0x584f1c('0x14')][_0x584f1c('0x9')],function(_0x4b6fed){const _0x35f913=_0x584f1c;return{'name':_0x4b6fed[_0x35f913('0x25')],'type':_0x4b6fed['type'][_0x35f913('0x0')]};});_0x4a3c32[_0x584f1c('0xc')]=_[_0x584f1c('0x2')](_0x332101,_0x584f1c('0x1c')),_0x4a3c32[_0x584f1c('0xb')]=_['keys'](_0x13b8c9[_0x584f1c('0xb')]),_0x4a3c32['filters']=_[_0x584f1c('0x19')](_0x4a3c32['model'],_0x4a3c32[_0x584f1c('0xb')]),_0x3b5a75['attributes']=_[_0x584f1c('0x19')](_0x4a3c32[_0x584f1c('0xc')],qs[_0x584f1c('0x1')](_0x13b8c9[_0x584f1c('0xb')]['fields'])),_0x3b5a75[_0x584f1c('0x1f')]=_0x3b5a75[_0x584f1c('0x1f')][_0x584f1c('0x16')]?_0x3b5a75[_0x584f1c('0x1f')]:_0x4a3c32[_0x584f1c('0xc')];typeof _0x13b8c9[_0x584f1c('0xb')]['nolimit']==='undefined'&&(_0x3b5a75[_0x584f1c('0x3')]=qs[_0x584f1c('0x3')](_0x13b8c9[_0x584f1c('0xb')][_0x584f1c('0x3')]),_0x3b5a75[_0x584f1c('0x17')]=qs[_0x584f1c('0x17')](_0x13b8c9[_0x584f1c('0xb')][_0x584f1c('0x17')]));_0x3b5a75[_0x584f1c('0x1a')]=qs['sort'](_0x13b8c9[_0x584f1c('0xb')][_0x584f1c('0x18')]),_0x3b5a75[_0x584f1c('0x27')]=qs[_0x584f1c('0xd')](_[_0x584f1c('0x26')](_0x13b8c9[_0x584f1c('0xb')],_0x4a3c32['filters']),_0x332101);_0x13b8c9[_0x584f1c('0xb')][_0x584f1c('0x29')]&&(_0x3b5a75[_0x584f1c('0x27')]=_['merge'](_0x3b5a75[_0x584f1c('0x27')],{[Op['or']]:_[_0x584f1c('0x2')](_0x332101,function(_0x17d0cb){const _0x11a10f=_0x584f1c;if(_0x17d0cb[_0x11a10f('0xa')]!==_0x11a10f('0x1d')){const _0x45d5d8={};return _0x45d5d8[_0x17d0cb['name']]={[Op['like']]:'%'+_0x13b8c9[_0x11a10f('0xb')]['filter']+'%'},_0x45d5d8;}})}));_0x3b5a75=_[_0x584f1c('0x11')]({},_0x3b5a75,_0x13b8c9[_0x584f1c('0x7')]);const _0x3358a6={'where':_0x3b5a75[_0x584f1c('0x27')]};return db[_0x584f1c('0x14')]['count'](_0x3358a6)[_0x584f1c('0x4')](function(_0x550f69){const _0xe14b34=_0x584f1c;return _0x2d1580[_0xe14b34('0x21')]=_0x550f69,_0x13b8c9[_0xe14b34('0xb')]['includeAll']&&(_0x3b5a75[_0xe14b34('0x1e')]=[{'all':!![]}]),db[_0xe14b34('0x14')]['findAll'](_0x3b5a75);})[_0x584f1c('0x4')](function(_0x26e70c){const _0x414fd2=_0x584f1c;return _0x2d1580[_0x414fd2('0x2d')]=_0x26e70c,_0x2d1580;})[_0x584f1c('0x4')](respondWithFilteredResult(_0x50024f,_0x3b5a75))[_0x584f1c('0x32')](handleError(_0x50024f,null));},exports[_0x28268c('0x28')]=function(_0x28ba8d,_0x203399){const _0x567f9f=_0x28268c;let _0xa77358={'raw':!![],'where':{'id':_0x28ba8d[_0x567f9f('0x5')]['id']}};const _0x58cf89={};return _0x58cf89['model']=_[_0x567f9f('0x8')](db[_0x567f9f('0x14')][_0x567f9f('0x9')]),_0x58cf89[_0x567f9f('0xb')]=_['keys'](_0x28ba8d[_0x567f9f('0xb')]),_0x58cf89[_0x567f9f('0xd')]=_['intersection'](_0x58cf89[_0x567f9f('0xc')],_0x58cf89[_0x567f9f('0xb')]),_0xa77358['attributes']=_[_0x567f9f('0x19')](_0x58cf89[_0x567f9f('0xc')],qs[_0x567f9f('0x1')](_0x28ba8d['query']['fields'])),_0xa77358[_0x567f9f('0x1f')]=_0xa77358[_0x567f9f('0x1f')][_0x567f9f('0x16')]?_0xa77358[_0x567f9f('0x1f')]:_0x58cf89[_0x567f9f('0xc')],_0x28ba8d[_0x567f9f('0xb')][_0x567f9f('0x13')]&&(_0xa77358[_0x567f9f('0x1e')]=[{'all':!![]}]),_0xa77358=_[_0x567f9f('0x11')]({},_0xa77358,_0x28ba8d['options']),db[_0x567f9f('0x14')][_0x567f9f('0xf')](_0xa77358)[_0x567f9f('0x4')](handleEntityNotFound(_0x203399,null))['then'](respondWithResult(_0x203399,null))['catch'](handleError(_0x203399,null));},exports['create']=function(_0x317d23,_0x2f2ef7){const _0x573df1=_0x28268c;return db[_0x573df1('0x14')][_0x573df1('0x31')](_0x317d23[_0x573df1('0x2b')],{})[_0x573df1('0x4')](respondWithResult(_0x2f2ef7,0xc9))[_0x573df1('0x32')](handleError(_0x2f2ef7,null));},exports['update']=function(_0x2a3422,_0x10b399){const _0x174eb6=_0x28268c;return _0x2a3422[_0x174eb6('0x2b')]['id']&&delete _0x2a3422[_0x174eb6('0x2b')]['id'],db[_0x174eb6('0x14')][_0x174eb6('0xf')]({'where':{'id':_0x2a3422[_0x174eb6('0x5')]['id']}})[_0x174eb6('0x4')](handleEntityNotFound(_0x10b399,null))[_0x174eb6('0x4')](saveUpdates(_0x2a3422[_0x174eb6('0x2b')],null))[_0x174eb6('0x4')](respondWithResult(_0x10b399,null))[_0x174eb6('0x32')](handleError(_0x10b399,null));},exports[_0x28268c('0x1b')]=function(_0x40d116,_0x422f4e){const _0x61a739=_0x28268c;return db[_0x61a739('0x14')]['findOne']({'where':{'id':_0x40d116[_0x61a739('0x5')]['id']}})[_0x61a739('0x4')](handleEntityNotFound(_0x422f4e,null))['then'](removeEntity(_0x422f4e,null))[_0x61a739('0x32')](handleError(_0x422f4e,null));},exports['describe']=function(_0x630a46,_0x2bcfa4){const _0x57041f=_0x28268c;return db[_0x57041f('0x14')][_0x57041f('0x2c')]()[_0x57041f('0x4')](respondWithResult(_0x2bcfa4,null))[_0x57041f('0x32')](handleError(_0x2bcfa4,null));};