{"size": 1960, "ext": "js", "max_stars_repo_path": "myModules/notificationsFacebook.js", "max_stars_repo_name": "Szarp/substitutions", "max_stars_repo_stars_event_min_datetime": "2016-11-28T17:57:58.000Z", "max_stars_repo_stars_event_max_datetime": "2020-11-14T02:17:24.000Z", "max_issues_repo_path": "myModules/notificationsFacebook.js", "max_issues_repo_name": "Szarp/substitutions", "max_issues_repo_issues_event_min_datetime": "2021-03-08T22:08:06.000Z", "max_issues_repo_issues_event_max_datetime": "2021-03-11T09:27:56.000Z", "max_forks_repo_path": "myModules/notificationsFacebook.js", "max_forks_repo_name": "Szarp/substitutions", "max_forks_repo_forks_event_min_datetime": "2020-04-21T12:44:24.000Z", "max_forks_repo_forks_event_max_datetime": "2020-04-21T12:44:24.000Z"}
{"max_stars_count": 4, "max_issues_count": 1, "max_forks_count": 1, "avg_line_length": 27.2222222222, "max_line_length": 148, "alphanum_fraction": 0.5433673469}
var facebook = require ('./facebookComunication.js'),
    setTime = require ('./setTime.js'),
    //link = require('./fbLinks.js'),
    MongoClient = require('mongodb').MongoClient,
    assert = require('assert'),
    mongo = require('./mongoFunctions.js');

/* module to send notifications */
var time = new setTime();

function sendToId (id,callback){
    console.log('notification');
    var message = 'Welcome to my app';
    var redirect = 'https://192.166.218.253:8088/';
        facebook.createNotification(id,message,redirect, function(res){
         console.log('noti message for: ',id,res);
            
        });    
    setImmediate(function() {
            callback();
    });
}
function whoGetSubstitution(){
    
    
}


//notificationList(function(a){console.log(a);})
 function notificationList(callback){
     var name='person';
        //[collection,{data}]
        //var collectionName = collection;
        //var data = paramsToModify;
     
        var url = 'mongodb://localhost:27017/test2';
        mongo.findByParam({"personal.settings.notification":'yes',"system.connected":true},{"personal.id":1,"personal.settings":1},name,function(a){
            console.log(a);
            var list=[];
            var arr={};
            for(var i=0;i<a.length;i++){
                arr['id']=a[i].personal['id'];
                arr['class']=a[i].personal.settings['setClass'];
                list[i]=arr;
                arr={};
            }
            
            setImmediate(function(){
					callback(list);
            }); 
            
        })
      
        
        //db.close();
 }
//notification(['2ga'],function(){
//    console.log('a');
//});

    
function classListFromDate(date,callback){
    //var classList=[];
     mongo.findById(date,'substitutions',function(e,doc){
         //console.log('doc',doc.substitution);

        setImmediate(function(){
            callback(doc.userList);
        });   
    })
}
    