Built motion from commit f861bcb808219e66da88ba48b61bddb35224a65e. Version 3.0.0...
[motion-next.git] / server / api / cdr / cdr.controller.js
index fd6317c..e844e01 100644 (file)
@@ -1 +1 @@
-'use strict';const a62_0x4f50=['2369411mecYvr','262hpRFXa','Cdr','query','create','nolimit','name','keys','send','1308595CXLShQ','merge','offset','@components/parsers/qs','json','body','model','@utils/filter-attributes','then','439771ZKXWTu','findOne','map','catch','983804BkZFOk','show','limit','sendStatus','intersection','type','destroy','set','includeAll','options','stack','attributes','include','findAll','end','1vtMZxW','Content-Range','length','order','fields','status','1763480mywBsH','pick','update','6514HdXMKJ','index','where','fieldName','key','rawAttributes','count','sort','lodash','undefined','params','filters','describe','295555RiUIXN'];const a62_0x2ce1=function(_0x5c5688,_0xd613ab){_0x5c5688=_0x5c5688-0x18e;let _0x4f5010=a62_0x4f50[_0x5c5688];return _0x4f5010;};const a62_0x52b275=a62_0x2ce1;(function(_0x20ef97,_0x49ef31){const _0x1d6f15=a62_0x2ce1;while(!![]){try{const _0x4fb870=-parseInt(_0x1d6f15(0x1c9))*-parseInt(_0x1d6f15(0x19c))+parseInt(_0x1d6f15(0x1b4))*parseInt(_0x1d6f15(0x1a5))+-parseInt(_0x1d6f15(0x1bc))+parseInt(_0x1d6f15(0x1c5))+-parseInt(_0x1d6f15(0x1b2))+parseInt(_0x1d6f15(0x1a2))+-parseInt(_0x1d6f15(0x1b3));if(_0x4fb870===_0x49ef31)break;else _0x20ef97['push'](_0x20ef97['shift']());}catch(_0x100d51){_0x20ef97['push'](_0x20ef97['shift']());}}}(a62_0x4f50,0xe0a62));const _=require(a62_0x52b275(0x1ad)),qs=require(a62_0x52b275(0x1bf)),logger=require('@config/logger')('api'),{db}=require('@mysqldb'),{filterAttributes}=require(a62_0x52b275(0x1c3));function respondWithResult(_0x5f1db1,_0xbd33b3){return _0xbd33b3=_0xbd33b3||0xc8,function(_0x56a750){const _0x16443=a62_0x2ce1;if(_0x56a750)return _0x5f1db1[_0x16443(0x1a1)](_0xbd33b3)[_0x16443(0x1c0)](_0x56a750);};}function respondWithFilteredResult(_0x3c39cd,_0x57437b){return function(_0x525c54){const _0x169ca9=a62_0x2ce1;if(_0x525c54){const _0x143e2d=_0x525c54[_0x169ca9(0x1ab)],_0x30d14a=_0x57437b[_0x169ca9(0x1be)];let _0x2c9244=_0x57437b[_0x169ca9(0x1be)]+_0x57437b[_0x169ca9(0x18f)],_0xefe350;return _0x2c9244>=_0x143e2d?(_0x2c9244=_0x143e2d,_0xefe350=0xc8):_0xefe350=0xce,_0x3c39cd[_0x169ca9(0x1a1)](_0xefe350),_0x3c39cd[_0x169ca9(0x194)](_0x169ca9(0x19d),_0x30d14a+'-'+_0x2c9244+'/'+_0x143e2d)['json'](_0x525c54);}return null;};}function saveUpdates(_0x40882b){return function(_0x13a0bf){const _0x21644f=a62_0x2ce1;if(_0x13a0bf)return _0x13a0bf['update'](_0x40882b)[_0x21644f(0x1c4)](function(_0x16b915){return _0x16b915;});return null;};}function removeEntity(_0x596f91){return function(_0x31afcc){const _0x206147=a62_0x2ce1;if(_0x31afcc)return _0x31afcc['destroy']()[_0x206147(0x1c4)](function(){const _0x52de3c=_0x206147;_0x596f91[_0x52de3c(0x1a1)](0xcc)[_0x52de3c(0x19b)]();});};}function handleEntityNotFound(_0x314703){return function(_0x2a8189){const _0x2d3a63=a62_0x2ce1;return!_0x2a8189&&_0x314703[_0x2d3a63(0x190)](0x194),_0x2a8189;};}function handleError(_0x4edfca,_0x120ee3){return _0x120ee3=_0x120ee3||0x1f4,function(_0x13763b){const _0x512c1c=a62_0x2ce1;logger['error'](_0x13763b[_0x512c1c(0x197)]),_0x13763b[_0x512c1c(0x1b9)]&&delete _0x13763b['name'],_0x4edfca[_0x512c1c(0x1a1)](_0x120ee3)[_0x512c1c(0x1bb)](_0x13763b);};}exports[a62_0x52b275(0x1a6)]=function(_0x1b7460,_0x36a335){const _0x280a33=a62_0x52b275;let _0x431fc={};const _0x405956={},_0x5e594e={'count':0x0,'rows':[]},_0x57b805=_[_0x280a33(0x1c7)](db[_0x280a33(0x1b5)][_0x280a33(0x1aa)],function(_0x4e4cef){const _0x4b1816=_0x280a33;return{'name':_0x4e4cef[_0x4b1816(0x1a8)],'type':_0x4e4cef[_0x4b1816(0x192)][_0x4b1816(0x1a9)]};});_0x405956['model']=_[_0x280a33(0x1c7)](_0x57b805,_0x280a33(0x1b9)),_0x405956[_0x280a33(0x1b6)]=_['keys'](_0x1b7460[_0x280a33(0x1b6)]),_0x405956[_0x280a33(0x1b0)]=_[_0x280a33(0x191)](_0x405956[_0x280a33(0x1c2)],_0x405956['query']),_0x431fc[_0x280a33(0x198)]=_[_0x280a33(0x191)](_0x405956[_0x280a33(0x1c2)],qs[_0x280a33(0x1a0)](_0x1b7460[_0x280a33(0x1b6)][_0x280a33(0x1a0)])),_0x431fc[_0x280a33(0x198)]=_0x431fc[_0x280a33(0x198)][_0x280a33(0x19e)]?_0x431fc[_0x280a33(0x198)]:_0x405956[_0x280a33(0x1c2)];typeof _0x1b7460['query'][_0x280a33(0x1b8)]===_0x280a33(0x1ae)&&(_0x431fc[_0x280a33(0x18f)]=qs['limit'](_0x1b7460[_0x280a33(0x1b6)][_0x280a33(0x18f)]),_0x431fc[_0x280a33(0x1be)]=qs[_0x280a33(0x1be)](_0x1b7460[_0x280a33(0x1b6)][_0x280a33(0x1be)]));_0x431fc[_0x280a33(0x19f)]=qs[_0x280a33(0x1ac)](_0x1b7460[_0x280a33(0x1b6)][_0x280a33(0x1ac)]),_0x431fc[_0x280a33(0x1a7)]=qs[_0x280a33(0x1b0)](_[_0x280a33(0x1a3)](_0x1b7460['query'],_0x405956[_0x280a33(0x1b0)]),_0x57b805),_0x431fc=filterAttributes(_0x431fc,_0x1b7460['query']['filter'],_0x57b805,_0x1b7460['options']);const _0x54e4a7={'where':_0x431fc[_0x280a33(0x1a7)]};return db[_0x280a33(0x1b5)][_0x280a33(0x1ab)](_0x54e4a7)[_0x280a33(0x1c4)](function(_0x261b5e){const _0x496a2b=_0x280a33;return _0x5e594e[_0x496a2b(0x1ab)]=_0x261b5e,_0x1b7460['query'][_0x496a2b(0x195)]&&(_0x431fc[_0x496a2b(0x199)]=[{'all':!![]}]),db[_0x496a2b(0x1b5)][_0x496a2b(0x19a)](_0x431fc);})[_0x280a33(0x1c4)](function(_0xdacf74){return _0x5e594e['rows']=_0xdacf74,_0x5e594e;})[_0x280a33(0x1c4)](respondWithFilteredResult(_0x36a335,_0x431fc))[_0x280a33(0x1c8)](handleError(_0x36a335,null));},exports[a62_0x52b275(0x18e)]=function(_0x2d88b1,_0x1fe064){const _0x2261f3=a62_0x52b275;let _0xe80b01={'raw':!![],'where':{'id':_0x2d88b1[_0x2261f3(0x1af)]['id']}};const _0x40b150={};return _0x40b150[_0x2261f3(0x1c2)]=_[_0x2261f3(0x1ba)](db['Cdr'][_0x2261f3(0x1aa)]),_0x40b150[_0x2261f3(0x1b6)]=_[_0x2261f3(0x1ba)](_0x2d88b1[_0x2261f3(0x1b6)]),_0x40b150[_0x2261f3(0x1b0)]=_[_0x2261f3(0x191)](_0x40b150['model'],_0x40b150['query']),_0xe80b01['attributes']=_[_0x2261f3(0x191)](_0x40b150['model'],qs[_0x2261f3(0x1a0)](_0x2d88b1[_0x2261f3(0x1b6)][_0x2261f3(0x1a0)])),_0xe80b01['attributes']=_0xe80b01[_0x2261f3(0x198)][_0x2261f3(0x19e)]?_0xe80b01[_0x2261f3(0x198)]:_0x40b150[_0x2261f3(0x1c2)],_0x2d88b1[_0x2261f3(0x1b6)]['includeAll']&&(_0xe80b01['include']=[{'all':!![]}]),_0xe80b01=_[_0x2261f3(0x1bd)]({},_0xe80b01,_0x2d88b1[_0x2261f3(0x196)]),db['Cdr'][_0x2261f3(0x1c6)](_0xe80b01)[_0x2261f3(0x1c4)](handleEntityNotFound(_0x1fe064,null))[_0x2261f3(0x1c4)](respondWithResult(_0x1fe064,null))[_0x2261f3(0x1c8)](handleError(_0x1fe064,null));},exports[a62_0x52b275(0x1b7)]=function(_0x157a08,_0xc21471){const _0x7f3e9b=a62_0x52b275;return db['Cdr'][_0x7f3e9b(0x1b7)](_0x157a08[_0x7f3e9b(0x1c1)],{})[_0x7f3e9b(0x1c4)](respondWithResult(_0xc21471,0xc9))[_0x7f3e9b(0x1c8)](handleError(_0xc21471,null));},exports[a62_0x52b275(0x1a4)]=function(_0x25c153,_0x2aac17){const _0x40d811=a62_0x52b275;return _0x25c153['body']['id']&&delete _0x25c153[_0x40d811(0x1c1)]['id'],db[_0x40d811(0x1b5)][_0x40d811(0x1c6)]({'where':{'id':_0x25c153['params']['id']}})[_0x40d811(0x1c4)](handleEntityNotFound(_0x2aac17,null))[_0x40d811(0x1c4)](saveUpdates(_0x25c153[_0x40d811(0x1c1)],null))[_0x40d811(0x1c4)](respondWithResult(_0x2aac17,null))[_0x40d811(0x1c8)](handleError(_0x2aac17,null));},exports[a62_0x52b275(0x193)]=function(_0x4591b7,_0xb34caf){const _0xddc6b6=a62_0x52b275;return db[_0xddc6b6(0x1b5)][_0xddc6b6(0x1c6)]({'where':{'id':_0x4591b7[_0xddc6b6(0x1af)]['id']}})[_0xddc6b6(0x1c4)](handleEntityNotFound(_0xb34caf,null))[_0xddc6b6(0x1c4)](removeEntity(_0xb34caf,null))[_0xddc6b6(0x1c8)](handleError(_0xb34caf,null));},exports[a62_0x52b275(0x1b1)]=function(_0x36b3f9,_0x56d841){const _0x4d3ae9=a62_0x52b275;return db[_0x4d3ae9(0x1b5)][_0x4d3ae9(0x1b1)]()[_0x4d3ae9(0x1c4)](respondWithResult(_0x56d841,null))[_0x4d3ae9(0x1c8)](handleError(_0x56d841,null));};
\ No newline at end of file
+'use strict';const a62_0xd139=['params','limit','@config/logger','attributes','catch','1857389ebahrI','end','error','count','keys','length','type','60028NDGcQc','index','Content-Range','sendStatus','update','stack','pick','name','fields','offset','151FtPzQL','43crlsZB','rawAttributes','lodash','then','include','create','filters','11675RkTaia','model','intersection','8221IOwzdP','undefined','findOne','includeAll','Cdr','fieldName','body','1354308WXErot','status','merge','destroy','send','79247IktStu','describe','show','map','1130947EpnKMM','40DTipQN','json','query','where','filter','order'];const a62_0x520d=function(_0x56b479,_0x1b9f75){_0x56b479=_0x56b479-0x1cd;let _0xd13901=a62_0xd139[_0x56b479];return _0xd13901;};const a62_0x57805d=a62_0x520d;(function(_0x30bfad,_0x3a0fde){const _0x1e9411=a62_0x520d;while(!![]){try{const _0x1213c2=-parseInt(_0x1e9411(0x1fa))*-parseInt(_0x1e9411(0x201))+parseInt(_0x1e9411(0x1f9))*-parseInt(_0x1e9411(0x204))+-parseInt(_0x1e9411(0x1d8))+-parseInt(_0x1e9411(0x1dc))+-parseInt(_0x1e9411(0x1d3))+parseInt(_0x1e9411(0x1e8))+parseInt(_0x1e9411(0x1dd))*parseInt(_0x1e9411(0x1ef));if(_0x1213c2===_0x3a0fde)break;else _0x30bfad['push'](_0x30bfad['shift']());}catch(_0x30cebd){_0x30bfad['push'](_0x30bfad['shift']());}}}(a62_0xd139,0xe9125));const _=require(a62_0x57805d(0x1fc)),qs=require('@components/parsers/qs'),logger=require(a62_0x57805d(0x1e5))('api'),{db}=require('@mysqldb'),{filterAttributes}=require('@utils/filter-attributes');function respondWithResult(_0xa9bf0d,_0x2f7428){return _0x2f7428=_0x2f7428||0xc8,function(_0x1b1f8d){const _0x207f8c=a62_0x520d;if(_0x1b1f8d)return _0xa9bf0d['status'](_0x2f7428)[_0x207f8c(0x1de)](_0x1b1f8d);};}function respondWithFilteredResult(_0x780f87,_0x25fba7){return function(_0x5b9b31){const _0x9e5633=a62_0x520d;if(_0x5b9b31){const _0x471ac1=_0x5b9b31[_0x9e5633(0x1eb)],_0x54882d=_0x25fba7[_0x9e5633(0x1f8)];let _0x23fa0d=_0x25fba7[_0x9e5633(0x1f8)]+_0x25fba7[_0x9e5633(0x1e4)],_0x56da80;return _0x23fa0d>=_0x471ac1?(_0x23fa0d=_0x471ac1,_0x56da80=0xc8):_0x56da80=0xce,_0x780f87[_0x9e5633(0x1d4)](_0x56da80),_0x780f87['set'](_0x9e5633(0x1f1),_0x54882d+'-'+_0x23fa0d+'/'+_0x471ac1)['json'](_0x5b9b31);}return null;};}function saveUpdates(_0x10d314){return function(_0xe5c48c){const _0x162fb3=a62_0x520d;if(_0xe5c48c)return _0xe5c48c[_0x162fb3(0x1f3)](_0x10d314)[_0x162fb3(0x1fd)](function(_0x1e01e9){return _0x1e01e9;});return null;};}function removeEntity(_0x5e9ef9){return function(_0x35526b){const _0x51d4b1=a62_0x520d;if(_0x35526b)return _0x35526b[_0x51d4b1(0x1d6)]()[_0x51d4b1(0x1fd)](function(){const _0x150674=_0x51d4b1;_0x5e9ef9['status'](0xcc)[_0x150674(0x1e9)]();});};}function handleEntityNotFound(_0xeedf2f){return function(_0x24ca1c){const _0x1ee704=a62_0x520d;return!_0x24ca1c&&_0xeedf2f[_0x1ee704(0x1f2)](0x194),_0x24ca1c;};}function handleError(_0x38e0ac,_0x58e158){return _0x58e158=_0x58e158||0x1f4,function(_0x2c324c){const _0x494830=a62_0x520d;logger[_0x494830(0x1ea)](_0x2c324c[_0x494830(0x1f4)]),_0x2c324c[_0x494830(0x1f6)]&&delete _0x2c324c['name'],_0x38e0ac['status'](_0x58e158)[_0x494830(0x1d7)](_0x2c324c);};}exports[a62_0x57805d(0x1f0)]=function(_0x2a5bc3,_0x457a8a){const _0x4271aa=a62_0x57805d;let _0x1cbc0b={};const _0xe7ae22={},_0x455477={'count':0x0,'rows':[]},_0x2465d2=_['map'](db[_0x4271aa(0x1d0)][_0x4271aa(0x1fb)],function(_0xec97c7){const _0x53dc5a=_0x4271aa;return{'name':_0xec97c7[_0x53dc5a(0x1d1)],'type':_0xec97c7[_0x53dc5a(0x1ee)]['key']};});_0xe7ae22[_0x4271aa(0x202)]=_[_0x4271aa(0x1db)](_0x2465d2,_0x4271aa(0x1f6)),_0xe7ae22['query']=_[_0x4271aa(0x1ec)](_0x2a5bc3[_0x4271aa(0x1df)]),_0xe7ae22[_0x4271aa(0x200)]=_[_0x4271aa(0x203)](_0xe7ae22[_0x4271aa(0x202)],_0xe7ae22[_0x4271aa(0x1df)]),_0x1cbc0b[_0x4271aa(0x1e6)]=_['intersection'](_0xe7ae22[_0x4271aa(0x202)],qs[_0x4271aa(0x1f7)](_0x2a5bc3[_0x4271aa(0x1df)][_0x4271aa(0x1f7)])),_0x1cbc0b['attributes']=_0x1cbc0b[_0x4271aa(0x1e6)][_0x4271aa(0x1ed)]?_0x1cbc0b[_0x4271aa(0x1e6)]:_0xe7ae22[_0x4271aa(0x202)];typeof _0x2a5bc3[_0x4271aa(0x1df)]['nolimit']===_0x4271aa(0x1cd)&&(_0x1cbc0b['limit']=qs['limit'](_0x2a5bc3[_0x4271aa(0x1df)][_0x4271aa(0x1e4)]),_0x1cbc0b[_0x4271aa(0x1f8)]=qs['offset'](_0x2a5bc3[_0x4271aa(0x1df)][_0x4271aa(0x1f8)]));_0x1cbc0b[_0x4271aa(0x1e2)]=qs['sort'](_0x2a5bc3['query']['sort']),_0x1cbc0b[_0x4271aa(0x1e0)]=qs[_0x4271aa(0x200)](_[_0x4271aa(0x1f5)](_0x2a5bc3[_0x4271aa(0x1df)],_0xe7ae22['filters']),_0x2465d2),_0x1cbc0b=filterAttributes(_0x1cbc0b,_0x2a5bc3[_0x4271aa(0x1df)][_0x4271aa(0x1e1)],_0x2465d2,_0x2a5bc3['options']);const _0x55ec32={'where':_0x1cbc0b[_0x4271aa(0x1e0)]};return db['Cdr'][_0x4271aa(0x1eb)](_0x55ec32)[_0x4271aa(0x1fd)](function(_0x25a9c1){const _0x2b43be=_0x4271aa;return _0x455477[_0x2b43be(0x1eb)]=_0x25a9c1,_0x2a5bc3[_0x2b43be(0x1df)][_0x2b43be(0x1cf)]&&(_0x1cbc0b['include']=[{'all':!![]}]),db[_0x2b43be(0x1d0)]['findAll'](_0x1cbc0b);})[_0x4271aa(0x1fd)](function(_0x2129e9){return _0x455477['rows']=_0x2129e9,_0x455477;})[_0x4271aa(0x1fd)](respondWithFilteredResult(_0x457a8a,_0x1cbc0b))['catch'](handleError(_0x457a8a,null));},exports[a62_0x57805d(0x1da)]=function(_0x5e9f99,_0x573d60){const _0x6412d4=a62_0x57805d;let _0x39c287={'raw':!![],'where':{'id':_0x5e9f99[_0x6412d4(0x1e3)]['id']}};const _0x37cac3={};return _0x37cac3['model']=_[_0x6412d4(0x1ec)](db[_0x6412d4(0x1d0)][_0x6412d4(0x1fb)]),_0x37cac3['query']=_[_0x6412d4(0x1ec)](_0x5e9f99[_0x6412d4(0x1df)]),_0x37cac3[_0x6412d4(0x200)]=_[_0x6412d4(0x203)](_0x37cac3[_0x6412d4(0x202)],_0x37cac3['query']),_0x39c287[_0x6412d4(0x1e6)]=_[_0x6412d4(0x203)](_0x37cac3['model'],qs[_0x6412d4(0x1f7)](_0x5e9f99[_0x6412d4(0x1df)][_0x6412d4(0x1f7)])),_0x39c287['attributes']=_0x39c287[_0x6412d4(0x1e6)][_0x6412d4(0x1ed)]?_0x39c287[_0x6412d4(0x1e6)]:_0x37cac3[_0x6412d4(0x202)],_0x5e9f99['query'][_0x6412d4(0x1cf)]&&(_0x39c287[_0x6412d4(0x1fe)]=[{'all':!![]}]),_0x39c287=_[_0x6412d4(0x1d5)]({},_0x39c287,_0x5e9f99['options']),db['Cdr']['findOne'](_0x39c287)[_0x6412d4(0x1fd)](handleEntityNotFound(_0x573d60,null))['then'](respondWithResult(_0x573d60,null))[_0x6412d4(0x1e7)](handleError(_0x573d60,null));},exports[a62_0x57805d(0x1ff)]=function(_0x5d2936,_0x1b64b5){const _0xcc754e=a62_0x57805d;return db['Cdr']['create'](_0x5d2936[_0xcc754e(0x1d2)],{})['then'](respondWithResult(_0x1b64b5,0xc9))[_0xcc754e(0x1e7)](handleError(_0x1b64b5,null));},exports['update']=function(_0x2e7454,_0x192732){const _0x314deb=a62_0x57805d;return _0x2e7454['body']['id']&&delete _0x2e7454[_0x314deb(0x1d2)]['id'],db[_0x314deb(0x1d0)][_0x314deb(0x1ce)]({'where':{'id':_0x2e7454[_0x314deb(0x1e3)]['id']}})[_0x314deb(0x1fd)](handleEntityNotFound(_0x192732,null))[_0x314deb(0x1fd)](saveUpdates(_0x2e7454[_0x314deb(0x1d2)],null))[_0x314deb(0x1fd)](respondWithResult(_0x192732,null))[_0x314deb(0x1e7)](handleError(_0x192732,null));},exports[a62_0x57805d(0x1d6)]=function(_0x4295d0,_0x2f6fcc){const _0x410bcc=a62_0x57805d;return db[_0x410bcc(0x1d0)]['findOne']({'where':{'id':_0x4295d0[_0x410bcc(0x1e3)]['id']}})['then'](handleEntityNotFound(_0x2f6fcc,null))[_0x410bcc(0x1fd)](removeEntity(_0x2f6fcc,null))[_0x410bcc(0x1e7)](handleError(_0x2f6fcc,null));},exports[a62_0x57805d(0x1d9)]=function(_0x5a2cad,_0x56a287){const _0xa775bb=a62_0x57805d;return db[_0xa775bb(0x1d0)]['describe']()[_0xa775bb(0x1fd)](respondWithResult(_0x56a287,null))[_0xa775bb(0x1e7)](handleError(_0x56a287,null));};
\ No newline at end of file