Built motion from commit 362b9399b4d0ed5560fbb795af995925d345fc38. Version 3.0.0...
[motion-next.git] / server / api / cdr / cdr.controller.js
index b3164b4..960b9dc 100644 (file)
@@ -1 +1 @@
-const a62_0x3631=['end','body','filters','sort','key','rawAttributes','VIRTUAL','findAll','intersection','keys','Content-Range','like','params','fieldName','name','order','model','type','offset','attributes','query','set','status','../../mysqldb','findOne','then','merge','where','Cdr','update','show','nolimit','limit','describe','pick','../../config/logger','undefined','options','count','include','map','filter','create','length','destroy','fields','stack','api','catch','json','includeAll'];(function(_0x45d8d4,_0x5d724f){const _0x363112=function(_0x31e23f){while(--_0x31e23f){_0x45d8d4['push'](_0x45d8d4['shift']());}};_0x363112(++_0x5d724f);}(a62_0x3631,0x145));const a62_0x31e2=function(_0x45d8d4,_0x5d724f){_0x45d8d4=_0x45d8d4-0x1b8;let _0x363112=a62_0x3631[_0x45d8d4];return _0x363112;};const a62_0x3ba866=a62_0x31e2;'use strict';const _=require('lodash'),qs=require('../../components/parsers/qs'),logger=require(a62_0x3ba866(0x1c8))(a62_0x3ba866(0x1d4)),{db}=require(a62_0x3ba866(0x1bc)),{Op}=require('sequelize');function respondWithResult(_0x37fb80,_0x3a49a4){return _0x3a49a4=_0x3a49a4||0xc8,function(_0x42bc3a){const _0x1c2377=a62_0x31e2;if(_0x42bc3a)return _0x37fb80['status'](_0x3a49a4)[_0x1c2377(0x1d6)](_0x42bc3a);};}function respondWithFilteredResult(_0xe7febb,_0x4fefca){return function(_0x362a90){const _0x10bcd9=a62_0x31e2;if(_0x362a90){const _0x36eb8f=_0x362a90[_0x10bcd9(0x1cb)],_0x31c09c=_0x4fefca[_0x10bcd9(0x1ea)];let _0x42e946=_0x4fefca[_0x10bcd9(0x1ea)]+_0x4fefca[_0x10bcd9(0x1c5)],_0x43f0be;return _0x42e946>=_0x36eb8f?(_0x42e946=_0x36eb8f,_0x43f0be=0xc8):_0x43f0be=0xce,_0xe7febb[_0x10bcd9(0x1bb)](_0x43f0be),_0xe7febb[_0x10bcd9(0x1ba)](_0x10bcd9(0x1e2),_0x31c09c+'-'+_0x42e946+'/'+_0x36eb8f)['json'](_0x362a90);}return null;};}function saveUpdates(_0x282c45){return function(_0x2b209e){const _0x3619de=a62_0x31e2;if(_0x2b209e)return _0x2b209e[_0x3619de(0x1c2)](_0x282c45)[_0x3619de(0x1be)](function(_0x2e32ca){return _0x2e32ca;});return null;};}function removeEntity(_0x12104f){return function(_0x4386ce){const _0x1e07f1=a62_0x31e2;if(_0x4386ce)return _0x4386ce[_0x1e07f1(0x1d1)]()[_0x1e07f1(0x1be)](function(){const _0x318da2=_0x1e07f1;_0x12104f['status'](0xcc)[_0x318da2(0x1d8)]();});};}function handleEntityNotFound(_0x586f90){return function(_0x3d064b){return!_0x3d064b&&_0x586f90['sendStatus'](0x194),_0x3d064b;};}function handleError(_0x100922,_0x348495){return _0x348495=_0x348495||0x1f4,function(_0x3f7d74){const _0x4bc7a6=a62_0x31e2;logger['error'](_0x3f7d74[_0x4bc7a6(0x1d3)]),_0x3f7d74['name']&&delete _0x3f7d74[_0x4bc7a6(0x1e6)],_0x100922[_0x4bc7a6(0x1bb)](_0x348495)['send'](_0x3f7d74);};}exports['index']=function(_0x5880dd,_0x1e01a6){const _0x1b481e=a62_0x3ba866;let _0x414e59={};const _0x10add7={},_0x36cb75={'count':0x0,'rows':[]},_0x11b299=_[_0x1b481e(0x1cd)](db['Cdr'][_0x1b481e(0x1dd)],function(_0x511706){const _0x175555=_0x1b481e;return{'name':_0x511706[_0x175555(0x1e5)],'type':_0x511706['type'][_0x175555(0x1dc)]};});_0x10add7[_0x1b481e(0x1e8)]=_[_0x1b481e(0x1cd)](_0x11b299,_0x1b481e(0x1e6)),_0x10add7[_0x1b481e(0x1b9)]=_['keys'](_0x5880dd[_0x1b481e(0x1b9)]),_0x10add7['filters']=_[_0x1b481e(0x1e0)](_0x10add7[_0x1b481e(0x1e8)],_0x10add7[_0x1b481e(0x1b9)]),_0x414e59[_0x1b481e(0x1b8)]=_['intersection'](_0x10add7[_0x1b481e(0x1e8)],qs[_0x1b481e(0x1d2)](_0x5880dd[_0x1b481e(0x1b9)][_0x1b481e(0x1d2)])),_0x414e59[_0x1b481e(0x1b8)]=_0x414e59['attributes'][_0x1b481e(0x1d0)]?_0x414e59[_0x1b481e(0x1b8)]:_0x10add7[_0x1b481e(0x1e8)];typeof _0x5880dd[_0x1b481e(0x1b9)][_0x1b481e(0x1c4)]===_0x1b481e(0x1c9)&&(_0x414e59[_0x1b481e(0x1c5)]=qs[_0x1b481e(0x1c5)](_0x5880dd[_0x1b481e(0x1b9)][_0x1b481e(0x1c5)]),_0x414e59['offset']=qs[_0x1b481e(0x1ea)](_0x5880dd[_0x1b481e(0x1b9)][_0x1b481e(0x1ea)]));_0x414e59[_0x1b481e(0x1e7)]=qs[_0x1b481e(0x1db)](_0x5880dd[_0x1b481e(0x1b9)]['sort']),_0x414e59[_0x1b481e(0x1c0)]=qs[_0x1b481e(0x1da)](_[_0x1b481e(0x1c7)](_0x5880dd[_0x1b481e(0x1b9)],_0x10add7[_0x1b481e(0x1da)]),_0x11b299);_0x5880dd[_0x1b481e(0x1b9)][_0x1b481e(0x1ce)]&&(_0x414e59[_0x1b481e(0x1c0)]=_[_0x1b481e(0x1bf)](_0x414e59[_0x1b481e(0x1c0)],{[Op['or']]:_['map'](_0x11b299,function(_0xb7ec0c){const _0x3bbdf5=_0x1b481e;if(_0xb7ec0c[_0x3bbdf5(0x1e9)]!==_0x3bbdf5(0x1de)){const _0x483405={};return _0x483405[_0xb7ec0c[_0x3bbdf5(0x1e6)]]={[Op[_0x3bbdf5(0x1e3)]]:'%'+_0x5880dd[_0x3bbdf5(0x1b9)][_0x3bbdf5(0x1ce)]+'%'},_0x483405;}})}));_0x414e59=_['merge']({},_0x414e59,_0x5880dd[_0x1b481e(0x1ca)]);const _0x53f0b4={'where':_0x414e59[_0x1b481e(0x1c0)]};return db[_0x1b481e(0x1c1)]['count'](_0x53f0b4)[_0x1b481e(0x1be)](function(_0x2db98f){const _0x5098e2=_0x1b481e;return _0x36cb75[_0x5098e2(0x1cb)]=_0x2db98f,_0x5880dd['query'][_0x5098e2(0x1d7)]&&(_0x414e59[_0x5098e2(0x1cc)]=[{'all':!![]}]),db[_0x5098e2(0x1c1)][_0x5098e2(0x1df)](_0x414e59);})[_0x1b481e(0x1be)](function(_0x228686){return _0x36cb75['rows']=_0x228686,_0x36cb75;})['then'](respondWithFilteredResult(_0x1e01a6,_0x414e59))[_0x1b481e(0x1d5)](handleError(_0x1e01a6,null));},exports[a62_0x3ba866(0x1c3)]=function(_0x4a8e38,_0x15118a){const _0x56a340=a62_0x3ba866;let _0x485025={'raw':!![],'where':{'id':_0x4a8e38[_0x56a340(0x1e4)]['id']}};const _0x268b5f={};return _0x268b5f[_0x56a340(0x1e8)]=_[_0x56a340(0x1e1)](db[_0x56a340(0x1c1)][_0x56a340(0x1dd)]),_0x268b5f['query']=_[_0x56a340(0x1e1)](_0x4a8e38[_0x56a340(0x1b9)]),_0x268b5f['filters']=_[_0x56a340(0x1e0)](_0x268b5f[_0x56a340(0x1e8)],_0x268b5f[_0x56a340(0x1b9)]),_0x485025[_0x56a340(0x1b8)]=_[_0x56a340(0x1e0)](_0x268b5f[_0x56a340(0x1e8)],qs[_0x56a340(0x1d2)](_0x4a8e38[_0x56a340(0x1b9)][_0x56a340(0x1d2)])),_0x485025[_0x56a340(0x1b8)]=_0x485025['attributes'][_0x56a340(0x1d0)]?_0x485025[_0x56a340(0x1b8)]:_0x268b5f[_0x56a340(0x1e8)],_0x4a8e38[_0x56a340(0x1b9)][_0x56a340(0x1d7)]&&(_0x485025[_0x56a340(0x1cc)]=[{'all':!![]}]),_0x485025=_[_0x56a340(0x1bf)]({},_0x485025,_0x4a8e38['options']),db[_0x56a340(0x1c1)]['findOne'](_0x485025)[_0x56a340(0x1be)](handleEntityNotFound(_0x15118a,null))[_0x56a340(0x1be)](respondWithResult(_0x15118a,null))['catch'](handleError(_0x15118a,null));},exports[a62_0x3ba866(0x1cf)]=function(_0x5479ab,_0x16e760){const _0x4cec17=a62_0x3ba866;return db[_0x4cec17(0x1c1)]['create'](_0x5479ab[_0x4cec17(0x1d9)],{})['then'](respondWithResult(_0x16e760,0xc9))['catch'](handleError(_0x16e760,null));},exports['update']=function(_0x462faf,_0x4d20bc){const _0x266674=a62_0x3ba866;return _0x462faf[_0x266674(0x1d9)]['id']&&delete _0x462faf[_0x266674(0x1d9)]['id'],db['Cdr'][_0x266674(0x1bd)]({'where':{'id':_0x462faf[_0x266674(0x1e4)]['id']}})[_0x266674(0x1be)](handleEntityNotFound(_0x4d20bc,null))[_0x266674(0x1be)](saveUpdates(_0x462faf[_0x266674(0x1d9)],null))['then'](respondWithResult(_0x4d20bc,null))[_0x266674(0x1d5)](handleError(_0x4d20bc,null));},exports[a62_0x3ba866(0x1d1)]=function(_0x27ca51,_0x32dea4){const _0x4f8486=a62_0x3ba866;return db[_0x4f8486(0x1c1)][_0x4f8486(0x1bd)]({'where':{'id':_0x27ca51[_0x4f8486(0x1e4)]['id']}})['then'](handleEntityNotFound(_0x32dea4,null))[_0x4f8486(0x1be)](removeEntity(_0x32dea4,null))['catch'](handleError(_0x32dea4,null));},exports[a62_0x3ba866(0x1c6)]=function(_0x4df822,_0x16049a){const _0x4d59e4=a62_0x3ba866;return db[_0x4d59e4(0x1c1)][_0x4d59e4(0x1c6)]()[_0x4d59e4(0x1be)](respondWithResult(_0x16049a,null))['catch'](handleError(_0x16049a,null));};
\ No newline at end of file
+const a62_0x312f=['order','include','filters','pick','count','send','fieldName','model','../../mysqldb','set','offset','type','where','lodash','params','nolimit','limit','findOne','key','sort','status','map','../../components/parsers/qs','name','error','rawAttributes','body','merge','keys','Cdr','end','then','../../config/logger','query','Content-Range','describe','options','attributes','intersection','sequelize','fields','length','json','update','catch','index','destroy','sendStatus'];(function(_0x52794c,_0x3f689b){const _0x312f1b=function(_0x359c20){while(--_0x359c20){_0x52794c['push'](_0x52794c['shift']());}};_0x312f1b(++_0x3f689b);}(a62_0x312f,0x1a3));const a62_0x359c=function(_0x52794c,_0x3f689b){_0x52794c=_0x52794c-0xf5;let _0x312f1b=a62_0x312f[_0x52794c];return _0x312f1b;};const a62_0x26f2e7=a62_0x359c;'use strict';const _=require(a62_0x26f2e7(0x10f)),qs=require(a62_0x26f2e7(0x118)),logger=require(a62_0x26f2e7(0x122))('api'),{db}=require(a62_0x26f2e7(0x10a)),{Op}=require(a62_0x26f2e7(0xf9));function respondWithResult(_0x27359a,_0x3e36f0){return _0x3e36f0=_0x3e36f0||0xc8,function(_0x480c15){const _0x3a5869=a62_0x359c;if(_0x480c15)return _0x27359a[_0x3a5869(0x116)](_0x3e36f0)[_0x3a5869(0xfc)](_0x480c15);};}function respondWithFilteredResult(_0x4e7d14,_0x401b70){return function(_0x1b756d){const _0x473f23=a62_0x359c;if(_0x1b756d){const _0x179c56=_0x1b756d[_0x473f23(0x106)],_0x21aa72=_0x401b70[_0x473f23(0x10c)];let _0x4672b0=_0x401b70['offset']+_0x401b70[_0x473f23(0x112)],_0xecdb52;return _0x4672b0>=_0x179c56?(_0x4672b0=_0x179c56,_0xecdb52=0xc8):_0xecdb52=0xce,_0x4e7d14[_0x473f23(0x116)](_0xecdb52),_0x4e7d14[_0x473f23(0x10b)](_0x473f23(0x124),_0x21aa72+'-'+_0x4672b0+'/'+_0x179c56)[_0x473f23(0xfc)](_0x1b756d);}return null;};}function saveUpdates(_0x4089bb){return function(_0x2bc621){if(_0x2bc621)return _0x2bc621['update'](_0x4089bb)['then'](function(_0x32df2b){return _0x32df2b;});return null;};}function removeEntity(_0x474b85){return function(_0x16811d){const _0x1a6a5d=a62_0x359c;if(_0x16811d)return _0x16811d[_0x1a6a5d(0x100)]()[_0x1a6a5d(0x121)](function(){const _0x5bb191=_0x1a6a5d;_0x474b85[_0x5bb191(0x116)](0xcc)[_0x5bb191(0x120)]();});};}function handleEntityNotFound(_0x997bfb){return function(_0x1c513a){const _0x368492=a62_0x359c;return!_0x1c513a&&_0x997bfb[_0x368492(0x101)](0x194),_0x1c513a;};}function handleError(_0x1dc1f0,_0x1e321){return _0x1e321=_0x1e321||0x1f4,function(_0x451b43){const _0x368bf0=a62_0x359c;logger[_0x368bf0(0x11a)](_0x451b43['stack']),_0x451b43[_0x368bf0(0x119)]&&delete _0x451b43[_0x368bf0(0x119)],_0x1dc1f0[_0x368bf0(0x116)](_0x1e321)[_0x368bf0(0x107)](_0x451b43);};}exports[a62_0x26f2e7(0xff)]=function(_0x339c0a,_0x4c07b3){const _0x32598b=a62_0x26f2e7;let _0x168824={};const _0x503ce2={},_0x490833={'count':0x0,'rows':[]},_0x3066cb=_[_0x32598b(0x117)](db[_0x32598b(0x11f)][_0x32598b(0x11b)],function(_0x32a458){const _0x578d6c=_0x32598b;return{'name':_0x32a458[_0x578d6c(0x108)],'type':_0x32a458['type'][_0x578d6c(0x114)]};});_0x503ce2[_0x32598b(0x109)]=_[_0x32598b(0x117)](_0x3066cb,_0x32598b(0x119)),_0x503ce2[_0x32598b(0x123)]=_[_0x32598b(0x11e)](_0x339c0a[_0x32598b(0x123)]),_0x503ce2[_0x32598b(0x104)]=_[_0x32598b(0xf8)](_0x503ce2['model'],_0x503ce2['query']),_0x168824['attributes']=_[_0x32598b(0xf8)](_0x503ce2[_0x32598b(0x109)],qs[_0x32598b(0xfa)](_0x339c0a[_0x32598b(0x123)][_0x32598b(0xfa)])),_0x168824[_0x32598b(0xf7)]=_0x168824[_0x32598b(0xf7)][_0x32598b(0xfb)]?_0x168824['attributes']:_0x503ce2[_0x32598b(0x109)];typeof _0x339c0a[_0x32598b(0x123)][_0x32598b(0x111)]==='undefined'&&(_0x168824[_0x32598b(0x112)]=qs[_0x32598b(0x112)](_0x339c0a['query'][_0x32598b(0x112)]),_0x168824[_0x32598b(0x10c)]=qs[_0x32598b(0x10c)](_0x339c0a[_0x32598b(0x123)][_0x32598b(0x10c)]));_0x168824[_0x32598b(0x102)]=qs[_0x32598b(0x115)](_0x339c0a[_0x32598b(0x123)]['sort']),_0x168824[_0x32598b(0x10e)]=qs['filters'](_[_0x32598b(0x105)](_0x339c0a['query'],_0x503ce2['filters']),_0x3066cb);_0x339c0a[_0x32598b(0x123)]['filter']&&(_0x168824[_0x32598b(0x10e)]=_['merge'](_0x168824['where'],{[Op['or']]:_[_0x32598b(0x117)](_0x3066cb,function(_0x31066e){const _0x2b2e6d=_0x32598b;if(_0x31066e[_0x2b2e6d(0x10d)]!=='VIRTUAL'){const _0x52c87c={};return _0x52c87c[_0x31066e[_0x2b2e6d(0x119)]]={[Op['like']]:'%'+_0x339c0a[_0x2b2e6d(0x123)]['filter']+'%'},_0x52c87c;}})}));_0x168824=_[_0x32598b(0x11d)]({},_0x168824,_0x339c0a[_0x32598b(0xf6)]);const _0x3b1156={'where':_0x168824[_0x32598b(0x10e)]};return db['Cdr'][_0x32598b(0x106)](_0x3b1156)['then'](function(_0x54486b){const _0x34ae37=_0x32598b;return _0x490833[_0x34ae37(0x106)]=_0x54486b,_0x339c0a[_0x34ae37(0x123)]['includeAll']&&(_0x168824['include']=[{'all':!![]}]),db['Cdr']['findAll'](_0x168824);})['then'](function(_0x4bb5be){return _0x490833['rows']=_0x4bb5be,_0x490833;})['then'](respondWithFilteredResult(_0x4c07b3,_0x168824))[_0x32598b(0xfe)](handleError(_0x4c07b3,null));},exports['show']=function(_0x19fa6d,_0x46e848){const _0x552982=a62_0x26f2e7;let _0xeb2ff9={'raw':!![],'where':{'id':_0x19fa6d['params']['id']}};const _0x5b945c={};return _0x5b945c['model']=_[_0x552982(0x11e)](db['Cdr'][_0x552982(0x11b)]),_0x5b945c[_0x552982(0x123)]=_['keys'](_0x19fa6d[_0x552982(0x123)]),_0x5b945c[_0x552982(0x104)]=_['intersection'](_0x5b945c[_0x552982(0x109)],_0x5b945c['query']),_0xeb2ff9[_0x552982(0xf7)]=_[_0x552982(0xf8)](_0x5b945c['model'],qs[_0x552982(0xfa)](_0x19fa6d[_0x552982(0x123)][_0x552982(0xfa)])),_0xeb2ff9[_0x552982(0xf7)]=_0xeb2ff9[_0x552982(0xf7)][_0x552982(0xfb)]?_0xeb2ff9[_0x552982(0xf7)]:_0x5b945c['model'],_0x19fa6d[_0x552982(0x123)]['includeAll']&&(_0xeb2ff9[_0x552982(0x103)]=[{'all':!![]}]),_0xeb2ff9=_[_0x552982(0x11d)]({},_0xeb2ff9,_0x19fa6d[_0x552982(0xf6)]),db[_0x552982(0x11f)][_0x552982(0x113)](_0xeb2ff9)[_0x552982(0x121)](handleEntityNotFound(_0x46e848,null))[_0x552982(0x121)](respondWithResult(_0x46e848,null))['catch'](handleError(_0x46e848,null));},exports['create']=function(_0x5c33d6,_0x6facf5){const _0x2152c4=a62_0x26f2e7;return db[_0x2152c4(0x11f)]['create'](_0x5c33d6['body'],{})[_0x2152c4(0x121)](respondWithResult(_0x6facf5,0xc9))[_0x2152c4(0xfe)](handleError(_0x6facf5,null));},exports[a62_0x26f2e7(0xfd)]=function(_0x5c6abb,_0x40d9c6){const _0x1418ce=a62_0x26f2e7;return _0x5c6abb[_0x1418ce(0x11c)]['id']&&delete _0x5c6abb[_0x1418ce(0x11c)]['id'],db['Cdr'][_0x1418ce(0x113)]({'where':{'id':_0x5c6abb[_0x1418ce(0x110)]['id']}})[_0x1418ce(0x121)](handleEntityNotFound(_0x40d9c6,null))['then'](saveUpdates(_0x5c6abb[_0x1418ce(0x11c)],null))[_0x1418ce(0x121)](respondWithResult(_0x40d9c6,null))[_0x1418ce(0xfe)](handleError(_0x40d9c6,null));},exports[a62_0x26f2e7(0x100)]=function(_0xce4b17,_0x3e5ef9){const _0x3ab4b6=a62_0x26f2e7;return db[_0x3ab4b6(0x11f)][_0x3ab4b6(0x113)]({'where':{'id':_0xce4b17[_0x3ab4b6(0x110)]['id']}})[_0x3ab4b6(0x121)](handleEntityNotFound(_0x3e5ef9,null))['then'](removeEntity(_0x3e5ef9,null))[_0x3ab4b6(0xfe)](handleError(_0x3e5ef9,null));},exports['describe']=function(_0x39899e,_0x5baad4){const _0x31d207=a62_0x26f2e7;return db['Cdr'][_0x31d207(0xf5)]()[_0x31d207(0x121)](respondWithResult(_0x5baad4,null))[_0x31d207(0xfe)](handleError(_0x5baad4,null));};
\ No newline at end of file