maj apxtri and notification registrations
This commit is contained in:
@@ -46,14 +46,14 @@ router.get("/:alias/:tribeId", (req, res) => {
|
||||
|
||||
|
||||
/**
|
||||
* @api {GET} /notifications/registeranonymous/:tribe/:mlist/:typekey/:data -Contact anonymous
|
||||
* @api {POST} /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
|
||||
* @apiBody {string} tribe an existing tribe
|
||||
* @apiBody {string} mlist a mailing list name
|
||||
* @apiBody {string} key email or phone
|
||||
* @apiBod {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
|
||||
@@ -61,20 +61,21 @@ router.get("/:alias/:tribeId", (req, res) => {
|
||||
* {"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)
|
||||
router.post("/registeranonymous",checkHeaders,(req,res)=>{
|
||||
//console.log("list registration ",req.body)
|
||||
if (!req.body.typekey || !['email','telephone'].includes(req.body.typekey) ){
|
||||
return res.status(406).json({status:406,ref:"Notifications",msg:"typekeyunknown",data:{typekey:req.body.typekey}})
|
||||
}
|
||||
result= Notifications.registertolist(
|
||||
req.params.key,
|
||||
req.params.typekey,
|
||||
req.params.tribe,
|
||||
req.params.mlist,
|
||||
req.params.srckey,
|
||||
req.body[req.body.typekey],
|
||||
req.body.typekey,
|
||||
req.body.tribe,
|
||||
req.body.mlist,
|
||||
req.body.srckey,
|
||||
req.session.header.xuuid);
|
||||
res.status(result.status).json(result)
|
||||
|
||||
res.status(result.status).json(result)
|
||||
})
|
||||
|
||||
/**
|
||||
* @api {GET} /notifications/unregister/:tribe/:mlist/:typekey/:data/:validation -Contact anonymous
|
||||
* @apiName contactanonymous
|
||||
|
@@ -10,6 +10,8 @@ const checkHeaders = require("../middlewares/checkHeaders.js");
|
||||
const isAuthenticated = require("../middlewares/isAuthenticated.js");
|
||||
|
||||
const conf = require(`../../conf/townconf.json`);
|
||||
const currentmod = "pagans";
|
||||
const log = conf.api.activelog.includes(currentmod);
|
||||
|
||||
const router = express.Router();
|
||||
/**
|
||||
@@ -54,7 +56,7 @@ router.get("/alias/:alias", (req, res) => {
|
||||
*
|
||||
*/
|
||||
router.get("/logout", checkHeaders, isAuthenticated, (req, res) => {
|
||||
console.log(req.session.header);
|
||||
if (log) console.log(currentmod,"Logout:",req.session.header);
|
||||
const logout = Pagans.logout(
|
||||
req.session.header.xalias,
|
||||
req.session.header.xtribe,
|
||||
@@ -123,7 +125,7 @@ router.get("/isauth", checkHeaders, isAuthenticated, (req, res) => {
|
||||
*
|
||||
*/
|
||||
router.post("/", checkHeaders, isAuthenticated, async (req, res) => {
|
||||
console.log('dev',`passici ${req.body}`);
|
||||
if (log) console.log(currentmod,"post with", req.body);
|
||||
const role = {
|
||||
xalias: req.session.header.xalias,
|
||||
xprofils: req.session.header.xprofils,
|
||||
@@ -153,7 +155,7 @@ router.post("/", checkHeaders, isAuthenticated, async (req, res) => {
|
||||
createprocess.data.email=req.body.email
|
||||
createprocess.data.tribe=req.session.header.xtribe;
|
||||
if (emailsent.status!=200) {
|
||||
console.log("err emailsent: ",emailsent)
|
||||
console.log("pagans err to send email emailsent: ",emailsent)
|
||||
createprocess.data.emailerror = emailsent.data.err;
|
||||
}
|
||||
}
|
||||
@@ -170,14 +172,14 @@ router.post("/", checkHeaders, isAuthenticated, async (req, res) => {
|
||||
},
|
||||
};
|
||||
const personup = Odmdb.cud(`../nationchains/tribes/${req.body.trustedtribe}/objects/persons`, "C", persondata, {xprofils:["pagan"],xalias:req.body.alias});
|
||||
console.log('personup',personup)
|
||||
if (log) console.log(currentmod,'person create',personup)
|
||||
if (personup.status==200){
|
||||
createprocess.data.createperson=true;
|
||||
}else{
|
||||
createprocess.data.createperson=false;
|
||||
createprocess.data.errorperson=true;
|
||||
createprocess.data.errpersonup=personup.data;
|
||||
console.log("Warning pagan created but person not created and no recovery registration", personup);
|
||||
if (log) console.log(currentmod,"Warning pagan created but person not created and no recovery registration", personup);
|
||||
}
|
||||
res.status(createprocess.status).json(createprocess);
|
||||
}else{
|
||||
|
Reference in New Issue
Block a user