modif notification to register email phone
This commit is contained in:
@@ -44,41 +44,77 @@ router.get("/:alias/:tribeId", (req, res) => {
|
||||
res.status(getalias.status).send(getalias);
|
||||
});
|
||||
|
||||
router.post("/registeranonymous", checkHeaders, (req, res) => {
|
||||
|
||||
['uuid','srckey','mlist'].forEach(k=>{
|
||||
if (!req.body[k]){}
|
||||
});
|
||||
res.status().json({status:410, ref:"", msg:""})
|
||||
let result;
|
||||
if (req.body.email) {
|
||||
result= Notifications.registertolist(
|
||||
req.body.email,
|
||||
"email",
|
||||
req.session.header.xtribe,
|
||||
req.body.mlist,
|
||||
req.body.srckey,
|
||||
req.body.uuid);
|
||||
}
|
||||
res(200).json({status:200})
|
||||
})
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* @api {POST} /actions/contactanonymous -Contact anonymous
|
||||
* @api {GET} /notifications/registeranonymous/:tribe/:mlist/:typekey/:data -Contact anonymous
|
||||
* @apiName register
|
||||
* @apiGroup Notifications
|
||||
* @apiDescription Register an email into a mailinglist mlist
|
||||
* @apiParams {string} tribe an existing tribe
|
||||
* @apiParams {string} mlist a mailing list name
|
||||
* @apiParams {string} key email or phone
|
||||
* @apiParams {string} srckey must exist in tribes/schema/lg/enumtrk_xx.json
|
||||
* @apiParams {string} data the email or phone
|
||||
* @apiSuccess {object} update mailinglist/{mlist}.json successfull
|
||||
* @apiSuccessExample {json} successfullmessage
|
||||
* HTTP/1.1 200 OK
|
||||
* {"status":200, "ref":"Notifications", "msg":"registersuccess", "data":{data, typekey, tribe, mlist, srckey, uuid}}}
|
||||
*
|
||||
*/
|
||||
|
||||
router.get("/registeranonymous/:tribe/:mlist/:typekey/:srckey/:key", checkHeaders, (req, res) => {
|
||||
console.log("pass ici")
|
||||
//Notifications.registertolist = (typekey, tribe, mlist, srckey, uuid)
|
||||
result= Notifications.registertolist(
|
||||
req.params.key,
|
||||
req.params.typekey,
|
||||
req.params.tribe,
|
||||
req.params.mlist,
|
||||
req.params.srckey,
|
||||
req.session.header.xuuid);
|
||||
res.status(result.status).json(result)
|
||||
})
|
||||
|
||||
/**
|
||||
* @api {GET} /notifications/unregister/:tribe/:mlist/:typekey/:data/:validation -Contact anonymous
|
||||
* @apiName contactanonymous
|
||||
* @apiGroup Notifications
|
||||
* @apiDescription Run action store in body.order and update mailinglist or create contact message
|
||||
*
|
||||
* @apiBody {string} order name of function for action in Actions.js example:registercontact ,
|
||||
* @apiBody {string} srckey: where it come from and eventualy email template name to use to send email ,
|
||||
* @apiBody {string} email to use
|
||||
* @apiBody {string} route /actions/contactanonymous
|
||||
* @apiBody {string} [mlist] filename to store email registration /contacts/mlist.json if not => filename is quest_/contacts/email.json with {email:{dt_create,dt_update, src:[list of source]}} or add message in /contacts/quest_{email}.json {timestamp:{message,name,email,dt_create,emailcontact}}
|
||||
* @apiBody {string} others any other usefull key:value relevant for order action
|
||||
* @apiDescription Register an email into a mailinglist mlist
|
||||
* @apiParams {string} tribe an existing tribe
|
||||
* @apiParams {string} mlist a mailing list name
|
||||
* @apiParams {string} key email or phone
|
||||
* @apiParams {string} srckey must exist in tribes/schema/lg/enumtrk_xx.json
|
||||
* @apiParams {string} data the email or phone
|
||||
* @apiParams {string} validation a key store in /tmp waiting to be approved, if "request" then send an email for confirmation, else if exist then remove email from list.
|
||||
* @apiSuccess {object} update mailinglist/{mlist}.json successfull
|
||||
* @apiSuccessExample {json} successfullmessage
|
||||
* HTTP/1.1 200 OK
|
||||
* {"status":200, "ref":"Notifications", "msg":"registersuccess", "data":{data, typekey, tribe, mlist, srckey, uuid}}}
|
||||
*
|
||||
* @apiSuccess {object} update/contacts/{mlist}.json successfull
|
||||
*/
|
||||
|
||||
router.get("/unregisteranonymous/:tribe/:mlist/:typekey/:srckey/:data/:validation", checkHeaders, (req, res) => {
|
||||
Notifications.registertolist = (typekey, tribe, mlist, srckey, uuid)
|
||||
result= Notifications.registertolist(
|
||||
req.params.typekey,
|
||||
req.params.tribe,
|
||||
req.params.mlist,
|
||||
req.params.srckey,
|
||||
req.session.header.xuuid);
|
||||
res.status(result.status).json(result)
|
||||
})
|
||||
|
||||
/**
|
||||
* @api {POST} /notifications/contactanonymous/:tribe -Contact anonymous
|
||||
* @apiName contactanonymous
|
||||
* @apiGroup Notifications
|
||||
* @apiDescription Register a contact in tribe and send a mail to admin of tribe
|
||||
* @apiParams {string} tribe an existing tribe
|
||||
* @apiBody {string} srckey: where it come from and eventualy email template name to use to send email ,
|
||||
* @apiBody {string} email to recontact
|
||||
* @apiBody {string} others any other usefull key:value
|
||||
*
|
||||
* @apiSuccess {object} create/update tribe/contacts/{}.json successfull
|
||||
* @apiSuccessExample {json} successfullmessage
|
||||
* HTTP/1.1 200 OK
|
||||
* {"status":200, "ref":"Contact", "msg":"success", "data":{"indexlist":[]}}
|
||||
@@ -94,7 +130,7 @@ router.post("/contactanonymous", checkHeaders, async (req, res) => {
|
||||
/**
|
||||
* Same as /copntactanonymous but for authenticated user => data are updated in persons/itm/alias.json
|
||||
*/
|
||||
router.post("/contact", checkHeaders, isAuthenticated, (req, res) => {
|
||||
router.post("/contact/:tribe/:alias", checkHeaders, isAuthenticated, (req, res) => {
|
||||
const done = Actions[req.body.order]
|
||||
? Actions[req.body.order](req.body, req.session.header)
|
||||
: { status: 406, ref: "Actions", msg: "bodyerror", data: req.body };
|
||||
|
Reference in New Issue
Block a user