test

an anonymous user · June 30, 2020 · NodeJS
 function getParams(medio,key){
        var r = [];
        var params = {
            TableName : 'data',
            Key: {
                table: '',
                key:key
            }
        };
        console.log('getParams');
        console.log(medio);
        switch (medio) {
            case 'T': 
            case 'R': 
                params.TableName = 'noticieros_bdtr';
                params.Key.table = medio;
                r.push(params);
            break;
            case 'TW':
                params.Key.table = 't_twitter_src' ;
                r.push(params);
                var params2 = Object.assign({},params);
                params2.Key.table = 't_twitter_src_user' ;
                r.push(params2);
            break;
            case 'FB': 
                params.Key.table = 't_facebook_src' ;
                r.push(params);
                var params2 = Object.assign({},params);
                params2.Key.table = 't_facebook_src_user' ;
                r.push(params2);
            break;
            case 'Y': 
                params.Key.table = 't_youtube_src' ;
             
                console.log(params);
                //arreglamos primer obj 
                r.push(params);
                var params2 = Object.assign({},params);
                params2.Key.table = 't_youtube_src_user' ;
                //arreglamos segundo obj 
                console.log(params2)
                 
                r.push(params2);
            break;
            case 'I': 
                params.Key.table = 't_instagram_src' ;
                r.push(params);
                var params2 = Object.assign({},params);
                params2.Key.table = 't_instagram_src_user' ;
                r.push(params2);
            break;
            case 'PD': 
                params.Key.table = 't_rss_src' ;
                r.push(params);
            break;
            default:
            break;
        }
        console.log(r);
        return r;
    };
    
    var arr = getParams('Y','ucckbtkevnc_job_q0oo9dgg');
    console.log(arr);

Comments

Please sign up or log in to contribute to the discussion.