forked from apxtri/apxtri
statistique register
This commit is contained in:
parent
f30595ebec
commit
487c1435b4
@ -27,7 +27,28 @@ Notifications.get = (alias, tribeId) => {
|
|||||||
data: { notif: [{ tribeId, msg }] },
|
data: { notif: [{ tribeId, msg }] },
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
/**
|
||||||
|
* Get statistic of registering email phone
|
||||||
|
*/
|
||||||
|
Notifications.statmaillist=(tribe)=>{
|
||||||
|
const statinfo={}
|
||||||
|
const src=`../../${tribe}/objects/maillinglists/*.json`
|
||||||
|
console.log(path.resolve(src))
|
||||||
|
glob.sync(src).forEach(f=>{
|
||||||
|
const name=path.basename(f,".json");
|
||||||
|
const mlst=fs.readJSONSync(f)
|
||||||
|
Object.keys(mlst).forEach(c=>{
|
||||||
|
mlst[c].srckeys.forEach(s=>{
|
||||||
|
if (!statinfo[s]) statinfo[s]={}
|
||||||
|
if (!statinfo[s][name]) statinfo[s][name]=0
|
||||||
|
statinfo[s][name]++
|
||||||
|
})
|
||||||
|
//console.log(c) recupere les contact tel ou email
|
||||||
|
})
|
||||||
|
})
|
||||||
|
|
||||||
|
return {status:200,ref:"Notifications",msg:"statistics",data:statinfo}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Register an typekey(email) or (phone) key into mailinglist for a tribe
|
* Register an typekey(email) or (phone) key into mailinglist for a tribe
|
||||||
|
@ -106,6 +106,47 @@ router.get("/unregister/:tribe/:mlist/:typekey/:srckey/:data/:validation", check
|
|||||||
res.status(result.status).json(result)
|
res.status(result.status).json(result)
|
||||||
})
|
})
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @api {GET} adminapi/notifications/stat/maillinglst/:tribe --Statistic maillinglst
|
||||||
|
* @apiName statmaillinglst
|
||||||
|
* @apiGroup Notifications
|
||||||
|
* @apiDescription Mailling list statistique
|
||||||
|
* @apiParams {string} tribe an existing tribe
|
||||||
|
*
|
||||||
|
* @apiSuccess {object} with data results
|
||||||
|
* @apiSuccessExample {json} successfullmessage
|
||||||
|
* HTTP/1.1 200 OK
|
||||||
|
* {
|
||||||
|
* "status": 200,
|
||||||
|
* "ref": "Notifications",
|
||||||
|
* "msg": "statistics",
|
||||||
|
* "data": {
|
||||||
|
* "teasingwebpage": {
|
||||||
|
* "email_stayinformboth": 1,
|
||||||
|
* "email_stayinformseeker": 6
|
||||||
|
* },
|
||||||
|
* "gorillamkt": {
|
||||||
|
* "email_trouvemonjobrecruiter": 7,
|
||||||
|
* "email_trouvemonjobseeker": 142,
|
||||||
|
* "telephonefr_trouvemonjobrecruiter": 4,
|
||||||
|
* "telephonefr_trouvemonjobseeker": 103
|
||||||
|
* },
|
||||||
|
* "forumantony": {
|
||||||
|
* "email_trouvemonjobseeker": 18,
|
||||||
|
* "telephonefr_trouvemonjobseeker": 151
|
||||||
|
* }
|
||||||
|
* }
|
||||||
|
*}
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
router.get("/stat/maillinglst/:tribe", checkHeaders, async (req, res) => {
|
||||||
|
console.log('passe là');
|
||||||
|
const resstat=Notifications.statmaillist(req.params.tribe)
|
||||||
|
res.status(resstat.status).json(resstat);
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @api {POST} adminapi/notifications/contactanonymous/:tribe -Contact anonymous
|
* @api {POST} adminapi/notifications/contactanonymous/:tribe -Contact anonymous
|
||||||
* @apiName contactanonymous
|
* @apiName contactanonymous
|
||||||
|
Loading…
x
Reference in New Issue
Block a user