Built motion from commit f738f9592c388b9f9eb3948f400a5c9d717a3561. Version 3.0.0...
[motion-next.git] / server / api / voiceQueuesLog / voiceQueuesLog.controller.js
1 const a919_0x12a7=['merge','like','rawAttributes','keys','where','findAll','Content-Range','../../components/parsers/qs','pick','fieldName','VIRTUAL','include','query','../../mysqldb','offset','stack','order','show','undefined','VoiceQueuesLog','count','then','status','name','json','catch','nolimit','error','body','sendStatus','model','destroy','key','findOne','limit','options','type','lodash','filter','sort','end','map','intersection','api','update','length','fields','attributes','params','sequelize','includeAll','filters','create'];(function(_0x5163d8,_0x3afe93){const _0x12a735=function(_0x2eb7f4){while(--_0x2eb7f4){_0x5163d8['push'](_0x5163d8['shift']());}};_0x12a735(++_0x3afe93);}(a919_0x12a7,0x164));const a919_0x2eb7=function(_0x5163d8,_0x3afe93){_0x5163d8=_0x5163d8-0x92;let _0x12a735=a919_0x12a7[_0x5163d8];return _0x12a735;};const a919_0x249056=a919_0x2eb7;'use strict';const _=require(a919_0x249056(0xc6)),qs=require(a919_0x249056(0xa8)),logger=require('../../config/logger')(a919_0x249056(0x97)),{db}=require(a919_0x249056(0xae)),{Op}=require(a919_0x249056(0x9d));function respondWithResult(_0x4f0121,_0x406716){return _0x406716=_0x406716||0xc8,function(_0x16df45){const _0x4156b0=a919_0x2eb7;if(_0x16df45)return _0x4f0121[_0x4156b0(0xb7)](_0x406716)[_0x4156b0(0xb9)](_0x16df45);};}function respondWithFilteredResult(_0x12b985,_0x2da670){return function(_0x3c3eae){const _0x333914=a919_0x2eb7;if(_0x3c3eae){const _0x36b5a5=_0x3c3eae[_0x333914(0xb5)],_0x5cd79e=_0x2da670[_0x333914(0xaf)];let _0x2e80ea=_0x2da670[_0x333914(0xaf)]+_0x2da670[_0x333914(0xc3)],_0xf8835c;return _0x2e80ea>=_0x36b5a5?(_0x2e80ea=_0x36b5a5,_0xf8835c=0xc8):_0xf8835c=0xce,_0x12b985['status'](_0xf8835c),_0x12b985['set'](_0x333914(0xa7),_0x5cd79e+'-'+_0x2e80ea+'/'+_0x36b5a5)['json'](_0x3c3eae);}return null;};}function saveUpdates(_0x3edc5c){return function(_0x322d62){const _0x58ae7f=a919_0x2eb7;if(_0x322d62)return _0x322d62[_0x58ae7f(0x98)](_0x3edc5c)['then'](function(_0x5427f9){return _0x5427f9;});return null;};}function removeEntity(_0x4b0f9d){return function(_0x40a5bc){const _0x792a3b=a919_0x2eb7;if(_0x40a5bc)return _0x40a5bc[_0x792a3b(0xc0)]()[_0x792a3b(0xb6)](function(){const _0x1bc901=_0x792a3b;_0x4b0f9d[_0x1bc901(0xb7)](0xcc)[_0x1bc901(0x94)]();});};}function handleEntityNotFound(_0x33122b){return function(_0xbae7be){const _0xa1b767=a919_0x2eb7;return!_0xbae7be&&_0x33122b[_0xa1b767(0xbe)](0x194),_0xbae7be;};}function handleError(_0x6eefc2,_0xb61c56){return _0xb61c56=_0xb61c56||0x1f4,function(_0x173fd2){const _0x341622=a919_0x2eb7;logger[_0x341622(0xbc)](_0x173fd2[_0x341622(0xb0)]),_0x173fd2[_0x341622(0xb8)]&&delete _0x173fd2['name'],_0x6eefc2[_0x341622(0xb7)](_0xb61c56)['send'](_0x173fd2);};}exports['index']=function(_0x1b656e,_0x317a61){const _0x527210=a919_0x249056;let _0x9ff19e={};const _0x37d6c7={},_0x3f143c={'count':0x0,'rows':[]},_0x2c6af2=_['map'](db[_0x527210(0xb4)][_0x527210(0xa3)],function(_0x4869aa){const _0xb351c9=_0x527210;return{'name':_0x4869aa[_0xb351c9(0xaa)],'type':_0x4869aa[_0xb351c9(0xc5)][_0xb351c9(0xc1)]};});_0x37d6c7[_0x527210(0xbf)]=_[_0x527210(0x95)](_0x2c6af2,_0x527210(0xb8)),_0x37d6c7['query']=_[_0x527210(0xa4)](_0x1b656e[_0x527210(0xad)]),_0x37d6c7[_0x527210(0x9f)]=_[_0x527210(0x96)](_0x37d6c7[_0x527210(0xbf)],_0x37d6c7[_0x527210(0xad)]),_0x9ff19e['attributes']=_[_0x527210(0x96)](_0x37d6c7[_0x527210(0xbf)],qs[_0x527210(0x9a)](_0x1b656e[_0x527210(0xad)][_0x527210(0x9a)])),_0x9ff19e[_0x527210(0x9b)]=_0x9ff19e[_0x527210(0x9b)][_0x527210(0x99)]?_0x9ff19e[_0x527210(0x9b)]:_0x37d6c7[_0x527210(0xbf)];typeof _0x1b656e[_0x527210(0xad)][_0x527210(0xbb)]===_0x527210(0xb3)&&(_0x9ff19e[_0x527210(0xc3)]=qs[_0x527210(0xc3)](_0x1b656e[_0x527210(0xad)][_0x527210(0xc3)]),_0x9ff19e['offset']=qs[_0x527210(0xaf)](_0x1b656e['query']['offset']));_0x9ff19e[_0x527210(0xb1)]=qs['sort'](_0x1b656e[_0x527210(0xad)][_0x527210(0x93)]),_0x9ff19e[_0x527210(0xa5)]=qs[_0x527210(0x9f)](_[_0x527210(0xa9)](_0x1b656e['query'],_0x37d6c7[_0x527210(0x9f)]),_0x2c6af2);_0x1b656e[_0x527210(0xad)][_0x527210(0x92)]&&(_0x9ff19e[_0x527210(0xa5)]=_[_0x527210(0xa1)](_0x9ff19e[_0x527210(0xa5)],{[Op['or']]:_['map'](_0x2c6af2,function(_0x3945fc){const _0x39ee1c=_0x527210;if(_0x3945fc[_0x39ee1c(0xc5)]!==_0x39ee1c(0xab)){const _0x2640d3={};return _0x2640d3[_0x3945fc[_0x39ee1c(0xb8)]]={[Op[_0x39ee1c(0xa2)]]:'%'+_0x1b656e[_0x39ee1c(0xad)][_0x39ee1c(0x92)]+'%'},_0x2640d3;}})}));_0x9ff19e=_[_0x527210(0xa1)]({},_0x9ff19e,_0x1b656e[_0x527210(0xc4)]);const _0x21b2bc={'where':_0x9ff19e[_0x527210(0xa5)]};return db['VoiceQueuesLog'][_0x527210(0xb5)](_0x21b2bc)[_0x527210(0xb6)](function(_0x4dbd52){const _0x332863=_0x527210;return _0x3f143c['count']=_0x4dbd52,_0x1b656e[_0x332863(0xad)][_0x332863(0x9e)]&&(_0x9ff19e[_0x332863(0xac)]=[{'all':!![]}]),db[_0x332863(0xb4)][_0x332863(0xa6)](_0x9ff19e);})['then'](function(_0x2cb80c){return _0x3f143c['rows']=_0x2cb80c,_0x3f143c;})[_0x527210(0xb6)](respondWithFilteredResult(_0x317a61,_0x9ff19e))[_0x527210(0xba)](handleError(_0x317a61,null));},exports[a919_0x249056(0xb2)]=function(_0x42d816,_0x48137f){const _0x2574f6=a919_0x249056;let _0x3e66a3={'raw':!![],'where':{'id':_0x42d816[_0x2574f6(0x9c)]['id']}};const _0x4105fb={};return _0x4105fb[_0x2574f6(0xbf)]=_[_0x2574f6(0xa4)](db['VoiceQueuesLog']['rawAttributes']),_0x4105fb[_0x2574f6(0xad)]=_['keys'](_0x42d816[_0x2574f6(0xad)]),_0x4105fb['filters']=_['intersection'](_0x4105fb[_0x2574f6(0xbf)],_0x4105fb[_0x2574f6(0xad)]),_0x3e66a3[_0x2574f6(0x9b)]=_[_0x2574f6(0x96)](_0x4105fb['model'],qs[_0x2574f6(0x9a)](_0x42d816[_0x2574f6(0xad)][_0x2574f6(0x9a)])),_0x3e66a3[_0x2574f6(0x9b)]=_0x3e66a3[_0x2574f6(0x9b)][_0x2574f6(0x99)]?_0x3e66a3['attributes']:_0x4105fb[_0x2574f6(0xbf)],_0x42d816['query'][_0x2574f6(0x9e)]&&(_0x3e66a3['include']=[{'all':!![]}]),_0x3e66a3=_['merge']({},_0x3e66a3,_0x42d816['options']),db['VoiceQueuesLog'][_0x2574f6(0xc2)](_0x3e66a3)[_0x2574f6(0xb6)](handleEntityNotFound(_0x48137f,null))[_0x2574f6(0xb6)](respondWithResult(_0x48137f,null))[_0x2574f6(0xba)](handleError(_0x48137f,null));},exports['create']=function(_0x376c3f,_0x4c0531){const _0x5ecc0d=a919_0x249056;return db[_0x5ecc0d(0xb4)][_0x5ecc0d(0xa0)](_0x376c3f[_0x5ecc0d(0xbd)],{})['then'](respondWithResult(_0x4c0531,0xc9))[_0x5ecc0d(0xba)](handleError(_0x4c0531,null));},exports[a919_0x249056(0x98)]=function(_0x165e14,_0x34dc83){const _0x4597e6=a919_0x249056;return _0x165e14[_0x4597e6(0xbd)]['id']&&delete _0x165e14[_0x4597e6(0xbd)]['id'],db[_0x4597e6(0xb4)][_0x4597e6(0xc2)]({'where':{'id':_0x165e14[_0x4597e6(0x9c)]['id']}})[_0x4597e6(0xb6)](handleEntityNotFound(_0x34dc83,null))['then'](saveUpdates(_0x165e14[_0x4597e6(0xbd)],null))[_0x4597e6(0xb6)](respondWithResult(_0x34dc83,null))['catch'](handleError(_0x34dc83,null));},exports[a919_0x249056(0xc0)]=function(_0x9a8338,_0x4d6bb3){const _0x11112e=a919_0x249056;return db[_0x11112e(0xb4)][_0x11112e(0xc2)]({'where':{'id':_0x9a8338[_0x11112e(0x9c)]['id']}})[_0x11112e(0xb6)](handleEntityNotFound(_0x4d6bb3,null))[_0x11112e(0xb6)](removeEntity(_0x4d6bb3,null))[_0x11112e(0xba)](handleError(_0x4d6bb3,null));};