modif notification to register email phone
This commit is contained in:
@@ -2,9 +2,13 @@ const glob = require("glob");
|
||||
const path = require("path");
|
||||
const fs = require("fs-extra");
|
||||
const axios = require("axios");
|
||||
const dayjs = require("dayjs");
|
||||
const Checkjson = require(`./Checkjson.js`);
|
||||
//const smtp = require("smtp-client");
|
||||
const nodemailer = require("nodemailer");
|
||||
const conf = require(`../../conf/townconf.json`);
|
||||
const currentmod = "Notifications";
|
||||
const log = conf.api.activelog.includes(currentmod);
|
||||
/**
|
||||
* To manage any communication between Pagan
|
||||
* mayor druid emailing/sms/paper from tribe register smtp, simcard, mail api to Person(s) / Pagan(s)
|
||||
@@ -35,11 +39,13 @@ Notifications.registertolist = (key, typekey, tribe, mlist, srckey, uuid) => {
|
||||
return {
|
||||
status: 400,
|
||||
ref: "Notifications",
|
||||
msg: "formaterreur",
|
||||
msg: "formaterror",
|
||||
data: { fielderr: typekey, format: typekey },
|
||||
};
|
||||
const destin = `../../../nationchains/tribes/${tribe}/contacts/${typecontact}_${mlist}.json`;
|
||||
const destin = `../nationchains/tribes/${tribe}/objects/maillinglists/${typekey}_${mlist}.json`;
|
||||
console.log(destin)
|
||||
const filestorage = fs.existsSync(destin) ? fs.readJsonSync(destin) : {};
|
||||
//if (log) console.log(currentmod,`filestorage`,filestorage, key, (filestorage[key]));
|
||||
if (filestorage[key]) {
|
||||
filestorage[key].dt_update = dayjs().toISOString();
|
||||
if (!filestorage[key].srckeys.includes(srckey))
|
||||
@@ -47,12 +53,13 @@ Notifications.registertolist = (key, typekey, tribe, mlist, srckey, uuid) => {
|
||||
if (!filestorage[key].uuids.includes(uuid))
|
||||
filestorage[key].uuids.push(uuid);
|
||||
}else{
|
||||
filestorage[key]={}
|
||||
filestorage[key].dt_create=dayjs().toISOString();
|
||||
filestorage[key].srckeys=[srckey];
|
||||
filestorage[key].uuids=[uuid]
|
||||
}
|
||||
fs.outputJSONSync(destin, filestorage);
|
||||
return {status:200,ref:"Notifications",msg:"register",data:{key, typekey, tribe, mlist, srckey, uuid}}
|
||||
return {status:200,ref:"Notifications",msg:"registersuccess",data:{key, typekey, tribe, mlist, srckey, uuid}}
|
||||
}
|
||||
/**
|
||||
* Unsubscribe an eamil or phone from a mailinglist for a tribe
|
||||
|
Reference in New Issue
Block a user