Suppression des attributs noticeOk et newsletterOk aux différents niveaux MVC + scripts front-end. La réception ou pas d'e-mail sera gérée par l'attribut receiptDays pouvant être vide.
This commit is contained in:
parent
f497a05144
commit
8e0d8fbbb0
@ -20,15 +20,14 @@ const answerCtrl = require("./answer");
|
||||
const questionnaireCtrl = require("./questionnaire");
|
||||
const userCtrl = require("./user");
|
||||
|
||||
// Clic sur lien de désabonnement aux alertes email
|
||||
// Clic sur lien de désabonnement aux email
|
||||
exports.unsubscribeLink = async (req, res, next) =>
|
||||
{
|
||||
try
|
||||
{
|
||||
const db = require("../models/index");
|
||||
const userDatas= await userCtrl.checkTokenUser(req.params.token);
|
||||
await db["User"].update({ newsletterOk: false }, { where: { id : userDatas.User.id }, limit:1 });
|
||||
await db["Subscription"].update({ noticeOk: false }, { where: { UserId : userDatas.User.id }, limit:1 });
|
||||
await db["Subscription"].update({ receiptDays: "" }, { where: { UserId : userDatas.User.id }, limit:1 });
|
||||
userCtrl.creaUserJson(userDatas.User.id);
|
||||
res.status(200).json({ message: txt.unsubscriptionOk });
|
||||
next();
|
||||
@ -183,11 +182,11 @@ exports.notifyExpirationAccount= async(req, res, next) =>
|
||||
exports.addNewQuestionnaireUsers = async(req, res, next) =>
|
||||
{
|
||||
try
|
||||
{
|
||||
{ /// revoir pour ne plus associer et envoyer de mails qu'aux utilisateurs ayant des jours d'envoi choisis
|
||||
const db = require("../models/index");
|
||||
// Utilisateurs dont l'abonnement est toujours actif et souhaitant recevoir un nouveau quiz le jour de l'appel de cette méthode.
|
||||
// Le tout en heure locale et en ignorant ceux qui ont déjà été traités ce jour.
|
||||
const subscriptionsOk = await db.sequelize.query("SELECT `Subscriptions`.`id` as SubscriptionId, `Subscriptions`.`lastProcessingAt`, `UserId`, `name`, `email`, `smtp`, `language`, `noticeOk`, `receiptDays`, ADDDATE(UTC_TIMESTAMP, INTERVAL `timeDifference` MINUTE) AS localDate FROM `Subscriptions` INNER JOIN `Users` ON `Subscriptions`.`UserId`=`Users`.`id` WHERE `status`='user' AND ADDDATE(`Subscriptions`.`createdAt`, `numberOfDays`) > UTC_TIMESTAMP HAVING HOUR(localDate) > "+config.hourGiveNewQuestionnaireBegin+" AND HOUR(localDate) < "+config.hourGiveNewQuestionnaireEnd+" AND LOCATE(DAYOFWEEK(localDate),receiptDays)!=0 AND SubscriptionId NOT IN (SELECT DISTINCT `SubscriptionId` FROM `Pauses` WHERE ADDDATE(`startingAt`, INTERVAL `timeDifference` MINUTE) <= localDate AND ADDDATE(`endingAT`, INTERVAL `timeDifference` MINUTE) > localDate) AND DATEDIFF(NOW(),`Subscriptions`.`lastProcessingAt`) >= 1 LIMIT "+config.numberNewQuestionnaireAtSameTime, { type: QueryTypes.SELECT });
|
||||
const subscriptionsOk = await db.sequelize.query("SELECT `Subscriptions`.`id` as SubscriptionId, `Subscriptions`.`lastProcessingAt`, `UserId`, `name`, `email`, `smtp`, `language`, `receiptDays`, ADDDATE(UTC_TIMESTAMP, INTERVAL `timeDifference` MINUTE) AS localDate FROM `Subscriptions` INNER JOIN `Users` ON `Subscriptions`.`UserId`=`Users`.`id` WHERE `status`='user' AND ADDDATE(`Subscriptions`.`createdAt`, `numberOfDays`) > UTC_TIMESTAMP HAVING HOUR(localDate) > "+config.hourGiveNewQuestionnaireBegin+" AND HOUR(localDate) < "+config.hourGiveNewQuestionnaireEnd+" AND LOCATE(DAYOFWEEK(localDate),receiptDays)!=0 AND SubscriptionId NOT IN (SELECT DISTINCT `SubscriptionId` FROM `Pauses` WHERE ADDDATE(`startingAt`, INTERVAL `timeDifference` MINUTE) <= localDate AND ADDDATE(`endingAT`, INTERVAL `timeDifference` MINUTE) > localDate) AND DATEDIFF(NOW(),`Subscriptions`.`lastProcessingAt`) >= 1 LIMIT "+config.numberNewQuestionnaireAtSameTime, { type: QueryTypes.SELECT });
|
||||
if(subscriptionsOk.length===0)
|
||||
res.status(200).json({ message: txt.allSubscriptionProcessed });
|
||||
else
|
||||
@ -202,59 +201,55 @@ exports.addNewQuestionnaireUsers = async(req, res, next) =>
|
||||
if(access)
|
||||
{
|
||||
answerCtrl.creaUserQuestionnairesWithoutAnswerJson(subscriptionsOk[i].UserId);
|
||||
if(subscriptionsOk[i].noticeOk)
|
||||
token=jwt.sign({ userId: subscriptionsOk[i].UserId }, config.tokenPrivateKey, { expiresIn: config.tokenUnsubscribeLinkTimeInDays });
|
||||
const mapMail =
|
||||
{
|
||||
token=jwt.sign({ userId: subscriptionsOk[i].UserId }, config.tokenPrivateKey, { expiresIn: config.tokenUnsubscribeLinkTimeInDays });
|
||||
const mapMail =
|
||||
{
|
||||
USER_NAME: subscriptionsOk[i].name,
|
||||
QUESTIONNAIRE_URL: config.siteUrl+"/"+configQuestionnaires.dirWebQuestionnaire+"/"+newQuestionnaire[0].slug+".html",
|
||||
UNSUBSCRIBE_URL: config.siteUrl+"/"+configTpl.stopMailPage+token
|
||||
};
|
||||
const mailDatas=
|
||||
{
|
||||
mailSubject: newQuestionnaire[0].title,
|
||||
mailPreheader: newQuestionnaire[0].title,
|
||||
mailTitle: newQuestionnaire[0].title,
|
||||
mailHeaderLinkUrl: config.siteUrl+"/"+configTpl.stopMailPage+token,
|
||||
mailHeaderLinkTxt: txt.mailStopMailLinkTxt,
|
||||
mailMainContent: newQuestionnaire[0].introduction+"<p><b>"+txtQuestionnaire.estimatedTime+"</b> "+txtQuestionnaire.estimatedTimeOption[newQuestionnaire[0].estimatedTime]+".</p>",
|
||||
linksCTA: [{ url:newQuestionnaire[0].url, txt:newQuestionnaire[0].anchor }, { url:config.siteUrl+"/"+configQuestionnaires.dirWebQuestionnaire+"/"+newQuestionnaire[0].slug+".html#questionnaire", txt:txtQuestionnaire.btnShowQuestionnaire }],
|
||||
mailRecipientAddress: subscriptionsOk[i].email
|
||||
}
|
||||
toolMail.sendMail(subscriptionsOk[i].smtp, subscriptionsOk[i].email, newQuestionnaire[0].title, tool.replaceAll(txt.mailNewQuestionnaireBodyTxt, mapMail), "", mailDatas);
|
||||
USER_NAME: subscriptionsOk[i].name,
|
||||
QUESTIONNAIRE_URL: config.siteUrl+"/"+configQuestionnaires.dirWebQuestionnaire+"/"+newQuestionnaire[0].slug+".html",
|
||||
UNSUBSCRIBE_URL: config.siteUrl+"/"+configTpl.stopMailPage+token
|
||||
};
|
||||
const mailDatas=
|
||||
{
|
||||
mailSubject: newQuestionnaire[0].title,
|
||||
mailPreheader: newQuestionnaire[0].title,
|
||||
mailTitle: newQuestionnaire[0].title,
|
||||
mailHeaderLinkUrl: config.siteUrl+"/"+configTpl.stopMailPage+token,
|
||||
mailHeaderLinkTxt: txt.mailStopMailLinkTxt,
|
||||
mailMainContent: newQuestionnaire[0].introduction+"<p><b>"+txtQuestionnaire.estimatedTime+"</b> "+txtQuestionnaire.estimatedTimeOption[newQuestionnaire[0].estimatedTime]+".</p>",
|
||||
linksCTA: [{ url:newQuestionnaire[0].url, txt:newQuestionnaire[0].anchor }, { url:config.siteUrl+"/"+configQuestionnaires.dirWebQuestionnaire+"/"+newQuestionnaire[0].slug+".html#questionnaire", txt:txtQuestionnaire.btnShowQuestionnaire }],
|
||||
mailRecipientAddress: subscriptionsOk[i].email
|
||||
}
|
||||
toolMail.sendMail(subscriptionsOk[i].smtp, subscriptionsOk[i].email, newQuestionnaire[0].title, tool.replaceAll(txt.mailNewQuestionnaireBodyTxt, mapMail), "", mailDatas);
|
||||
|
||||
}
|
||||
db["Subscription"].update({ lastProcessingAt: now }, { where: { id : subscriptionsOk[i].SubscriptionId }, limit:1 });
|
||||
}
|
||||
else
|
||||
{
|
||||
// L'utilisateur a déjà accès à tous les quizs enregistés.
|
||||
// Si il est abonné par email, on en tire un au hasard pour le lui envoyer, sinon on ne fait rien
|
||||
if(subscriptionsOk[i].noticeOk)
|
||||
// Si il est abonné par email, on en tire un au hasard pour le lui envoyer, sinon on ne fait rien
|
||||
getRandomQuestionnaire=await db.sequelize.query("SELECT `Questionnaires`.`id`, `title`, `slug`, `introduction`, `url`, `anchor`, `estimatedTime` FROM `Questionnaires` INNER JOIN `Links` ON `Links`.`QuestionnaireId`=`Questionnaires`.`id` WHERE `isPublished`=1 AND `language`='"+subscriptionsOk[i].language+"' ORDER BY RAND() LIMIT 1", { type: QueryTypes.SELECT });
|
||||
token=jwt.sign({ userId: subscriptionsOk[i].UserId }, config.tokenPrivateKey, { expiresIn: config.tokenUnsubscribeLinkTimeInDays });
|
||||
const mapMail =
|
||||
{
|
||||
getRandomQuestionnaire=await db.sequelize.query("SELECT `Questionnaires`.`id`, `title`, `slug`, `introduction`, `url`, `anchor`, `estimatedTime` FROM `Questionnaires` INNER JOIN `Links` ON `Links`.`QuestionnaireId`=`Questionnaires`.`id` WHERE `isPublished`=1 AND `language`='"+subscriptionsOk[i].language+"' ORDER BY RAND() LIMIT 1", { type: QueryTypes.SELECT });
|
||||
token=jwt.sign({ userId: subscriptionsOk[i].UserId }, config.tokenPrivateKey, { expiresIn: config.tokenUnsubscribeLinkTimeInDays });
|
||||
const mapMail =
|
||||
{
|
||||
USER_NAME: subscriptionsOk[i].name,
|
||||
QUESTIONNAIRE_URL: config.siteUrl+"/"+configQuestionnaires.dirWebQuestionnaire+"/"+getRandomQuestionnaire[0].slug+".html",
|
||||
UNSUBSCRIBE_URL: config.siteUrl+"/"+configTpl.stopMailPage+token
|
||||
};
|
||||
const mailDatas=
|
||||
{
|
||||
mailSubject: getRandomQuestionnaire[0].title,
|
||||
mailPreheader: getRandomQuestionnaire[0].title,
|
||||
mailTitle: getRandomQuestionnaire[0].title,
|
||||
mailHeaderLinkUrl: config.siteUrl+"/"+configTpl.stopMailPage+token,
|
||||
mailHeaderLinkTxt: txt.mailStopMailLinkTxt,
|
||||
mailMainContent: "<h4>"+txtQuestionnaireAccess.questionnaireRetryInfo+"</h4>"+getRandomQuestionnaire[0].introduction+"<p><b>"+txtQuestionnaire.estimatedTime+"</b> "+txtQuestionnaire.estimatedTimeOption[getRandomQuestionnaire[0].estimatedTime]+".</p>",
|
||||
linksCTA: [{ url:getRandomQuestionnaire[0].url, txt:getRandomQuestionnaire[0].anchor }, { url:config.siteUrl+"/"+configQuestionnaires.dirWebQuestionnaire+"/"+getRandomQuestionnaire[0].slug+".html#questionnaire", txt:txtQuestionnaire.btnShowQuestionnaire }],
|
||||
mailRecipientAddress: subscriptionsOk[i].email
|
||||
}
|
||||
toolMail.sendMail(subscriptionsOk[i].smtp, subscriptionsOk[i].email, getRandomQuestionnaire[0].title, tool.replaceAll(txtQuestionnaireAccess.questionnaireRetryInfoTxt, mapMail), "", mailDatas);
|
||||
db["Subscription"].update({ lastProcessingAt: now }, { where: { id : subscriptionsOk[i].SubscriptionId }, limit:1 });
|
||||
USER_NAME: subscriptionsOk[i].name,
|
||||
QUESTIONNAIRE_URL: config.siteUrl+"/"+configQuestionnaires.dirWebQuestionnaire+"/"+getRandomQuestionnaire[0].slug+".html",
|
||||
UNSUBSCRIBE_URL: config.siteUrl+"/"+configTpl.stopMailPage+token
|
||||
};
|
||||
const mailDatas=
|
||||
{
|
||||
mailSubject: getRandomQuestionnaire[0].title,
|
||||
mailPreheader: getRandomQuestionnaire[0].title,
|
||||
mailTitle: getRandomQuestionnaire[0].title,
|
||||
mailHeaderLinkUrl: config.siteUrl+"/"+configTpl.stopMailPage+token,
|
||||
mailHeaderLinkTxt: txt.mailStopMailLinkTxt,
|
||||
mailMainContent: "<h4>"+txtQuestionnaireAccess.questionnaireRetryInfo+"</h4>"+getRandomQuestionnaire[0].introduction+"<p><b>"+txtQuestionnaire.estimatedTime+"</b> "+txtQuestionnaire.estimatedTimeOption[getRandomQuestionnaire[0].estimatedTime]+".</p>",
|
||||
linksCTA: [{ url:getRandomQuestionnaire[0].url, txt:getRandomQuestionnaire[0].anchor }, { url:config.siteUrl+"/"+configQuestionnaires.dirWebQuestionnaire+"/"+getRandomQuestionnaire[0].slug+".html#questionnaire", txt:txtQuestionnaire.btnShowQuestionnaire }],
|
||||
mailRecipientAddress: subscriptionsOk[i].email
|
||||
}
|
||||
toolMail.sendMail(subscriptionsOk[i].smtp, subscriptionsOk[i].email, getRandomQuestionnaire[0].title, tool.replaceAll(txtQuestionnaireAccess.questionnaireRetryInfoTxt, mapMail), "", mailDatas);
|
||||
db["Subscription"].update({ lastProcessingAt: now }, { where: { id : subscriptionsOk[i].SubscriptionId }, limit:1 });
|
||||
|
||||
}
|
||||
}
|
||||
res.status(200).json(subscriptionsOk);
|
||||
|
@ -460,8 +460,8 @@ exports.modify = async (req, res, next) =>
|
||||
if(req.connectedUser.User.status==="user")
|
||||
{
|
||||
await Promise.all([
|
||||
db["User"].update({ ...req.body }, { where: { id : req.connectedUser.User.id } , fields: ["name", "language", "newsletterOk", "timeDifference"], limit:1 }),
|
||||
db["Subscription"].update({ ...req.body }, { where: { UserId : req.connectedUser.User.id }, fields: ["receiptDays", "noticeOk"], limit:1 })
|
||||
db["User"].update({ ...req.body }, { where: { id : req.connectedUser.User.id } , fields: ["name", "language", "timeDifference"], limit:1 }),
|
||||
db["Subscription"].update({ ...req.body }, { where: { UserId : req.connectedUser.User.id }, fields: ["receiptDays"], limit:1 })
|
||||
]);
|
||||
creaUserJson(req.connectedUser.User.id);
|
||||
const messageRetour=[txt.updatedOkMessage];
|
||||
@ -537,8 +537,8 @@ exports.modify = async (req, res, next) =>
|
||||
break;
|
||||
case "manager":
|
||||
await Promise.all([
|
||||
db["User"].update({ ...req.body }, { where: { id : req.params.id }, fields: ["name", "email", "password", "language", "adminComments", "smtp", "newsletterOk", "GodfatherId"], limit:1 }),
|
||||
db["Subscription"].update({ ...req.body }, { where: { UserId : req.params.id }, fields: ["numberOfDays", "receiptDays", "noticeOk"], limit:1 })
|
||||
db["User"].update({ ...req.body }, { where: { id : req.params.id }, fields: ["name", "email", "password", "language", "adminComments", "smtp", "GodfatherId"], limit:1 }),
|
||||
db["Subscription"].update({ ...req.body }, { where: { UserId : req.params.id }, fields: ["numberOfDays", "receiptDays"], limit:1 })
|
||||
]);
|
||||
break;
|
||||
case "creator":
|
||||
@ -623,9 +623,9 @@ exports.create = async (req, res, next) =>
|
||||
await db["Subscription"].create({ ...req.body });
|
||||
break;
|
||||
case "manager":
|
||||
user=await db["User"].create({ ...req.body }, { fields: ["name", "email", "password", "language", "adminComments", "smtp", "newsletterOk", "GodfatherId"] });
|
||||
user=await db["User"].create({ ...req.body }, { fields: ["name", "email", "password", "language", "adminComments", "smtp", "GodfatherId"] });
|
||||
req.body.UserId=user.id;
|
||||
await db["Subscription"].create({ ...req.body }, { fields: ["numberOfDays", "receiptDays", "noticeOk", "UserId"] });
|
||||
await db["Subscription"].create({ ...req.body }, { fields: ["numberOfDays", "receiptDays", "UserId"] });
|
||||
break;
|
||||
case "creator":
|
||||
user=await db["User"].create({ ...req.body }, { fields: ["name", "email", "password", "language", "adminComments"] });
|
||||
@ -1129,4 +1129,4 @@ const getStatsUsers = async () =>
|
||||
else
|
||||
return false;
|
||||
}
|
||||
exports.getStatsUsers = getStatsUsers;
|
||||
exports.getStatsUsers = getStatsUsers;
|
@ -73,12 +73,6 @@
|
||||
<p>Vous recevrez chaque jour sélectionné un des quizs restants parmi ceux qui ne vous ont pas encore été proposés. Ensuite, un au hasard parmi tous les quizs.</p>
|
||||
</div>
|
||||
<ul class="checkbox_li">
|
||||
<li class="checkbox_li">
|
||||
<label for="noticeOk" class="check"><input type="checkbox" id="noticeOk" name="noticeOk" value="true" /><div class="checkbox_override"></div> Je souhaite recevoir les suggestions de quiz par email.</label>
|
||||
</li>
|
||||
<li class="checkbox_li">
|
||||
<label for="newsletterOk" class="check"><input type="checkbox" id="newsletterOk" name="newsletterOk" value="true" /><div class="checkbox_override"></div> J'accepte de recevoir des messages ponctuels de WikiLerni (nouvelles fonctionnalités ...).</label>
|
||||
</li>
|
||||
<li class="checkbox_li">
|
||||
<label for="deleteOk" class="check"><input type="checkbox" id="deleteOk" name="deleteOk" value="true" /><div class="checkbox_override"></div> <span class="error">Je souhaite supprimer mon compte utilisateur.</span></label>
|
||||
|
||||
|
@ -62,13 +62,14 @@
|
||||
<option value="admin">Administrateur</option>
|
||||
</select>
|
||||
</fieldset>
|
||||
<!-- caché tant qu'il n'y en a qu'un...
|
||||
<fieldset>
|
||||
<label for="smtp">SMTP</label>
|
||||
<select id="smtp" name="smtp" class="cardboard">
|
||||
<option value="0">Spirion</option>
|
||||
<option value="1">Mailjet</option>
|
||||
</select>
|
||||
</fieldset>
|
||||
</fieldset>-->
|
||||
<fieldset><label for="timeDifference">Décalage horaire</label><input id="timeDifference" type="number" name="timeDifference" readonly class="cardboard"></fieldset>
|
||||
<fieldset><label for="newPassword">Nouveau mot de passe</label><input id="newPassword" type="password" name="newPassword" class="cardboard">
|
||||
<div id="newPasswordMessage"> <span class="info">Laisser vide sauf si vous souhaitez le changer.</span></div></fieldset>
|
||||
@ -101,12 +102,6 @@
|
||||
</ul>
|
||||
</div>
|
||||
<ul class="checkbox_li">
|
||||
<li class="checkbox_li">
|
||||
<label for="noticeOk" class="check"><input type="checkbox" id="noticeOk" name="noticeOk" value="true" /><div class="checkbox_override"></div> Reçoit les quizs par email.</label>
|
||||
</li>
|
||||
<li class="checkbox_li">
|
||||
<label for="newsletterOk" class="check"><input type="checkbox" id="newsletterOk" name="newsletterOk" value="true" /><div class="checkbox_override"></div> Reçoit les autres actus par email.</label>
|
||||
</li>
|
||||
<li class="checkbox_li">
|
||||
<label for="validationOk" id="validationOkLabel" class="check"><input type="checkbox" id="validationOk" name="validationOk" value="true" /><div class="checkbox_override"></div> Valider le compte.</label>
|
||||
</li>
|
||||
|
@ -91,9 +91,6 @@ const initialise = async () =>
|
||||
formAccount.elements[""+data].checked="checked";
|
||||
}
|
||||
}
|
||||
// infos de l'abonnement
|
||||
if(response.Subscription.noticeOk==true)
|
||||
formAccount.elements["noticeOk"].checked="checked";
|
||||
// jours de réception
|
||||
for(let i in response.Subscription.receiptDays)
|
||||
formAccount.elements["d"+response.Subscription.receiptDays[i]].checked="checked";
|
||||
@ -131,10 +128,6 @@ const initialise = async () =>
|
||||
if(datas["d"+i]!==undefined)
|
||||
datas.receiptDays+=""+i;
|
||||
}
|
||||
if(datas.noticeOk===undefined)
|
||||
datas.noticeOk="false";
|
||||
if(datas.newsletterOk===undefined)
|
||||
datas.newsletterOk="false";
|
||||
datas.timeDifference=getTimeDifference();
|
||||
const xhrUserUpdate = new XMLHttpRequest();
|
||||
if(datas.deleteOk!==undefined)
|
||||
|
@ -127,8 +127,6 @@ const initialise = async () =>
|
||||
{
|
||||
// nombre de jours de l'abonnement
|
||||
formUser.elements["numberOfDays"].value=response.Subscription["numberOfDays"];
|
||||
if(response.Subscription.noticeOk==true)
|
||||
formUser.elements["noticeOk"].checked="checked";
|
||||
// jours de réception
|
||||
for(let i in response.Subscription.receiptDays)
|
||||
formUser.elements["d"+response.Subscription.receiptDays[i]].checked="checked";
|
||||
@ -254,10 +252,6 @@ const initialise = async () =>
|
||||
if(datas["d"+i]!==undefined)
|
||||
datas.receiptDays+=""+i;
|
||||
}
|
||||
if(datas.noticeOk===undefined)
|
||||
datas.noticeOk="false";
|
||||
if(datas.newsletterOk===undefined)
|
||||
datas.newsletterOk="false";
|
||||
const xhrUserDatas = new XMLHttpRequest();
|
||||
if(!isEmpty(datas.id) && (datas.deleteOk!==undefined))
|
||||
xhrUserDatas.open("DELETE", apiUrl+configUsers.userRoutes+"/"+datas.id);
|
||||
@ -267,7 +261,6 @@ const initialise = async () =>
|
||||
xhrUserDatas.open("PUT", apiUrl+configUsers.userRoutes+configUsers.updateUserInfos+datas.id);
|
||||
else
|
||||
{
|
||||
console.log("je suis ici");
|
||||
datas.password=getPassword(configUsers.password.minlength, configUsers.password.minlength+2);// mot de passe temporaire
|
||||
xhrUserDatas.open("POST", apiUrl+configUsers.userRoutes+configUsers.createUserRoute);
|
||||
}
|
||||
|
@ -52,19 +52,6 @@ module.exports = (sequelize, DataTypes) =>
|
||||
}
|
||||
}
|
||||
},
|
||||
noticeOk:
|
||||
{
|
||||
type: DataTypes.BOOLEAN(1), allowNull: false, defaultValue: false,
|
||||
validate:
|
||||
{
|
||||
notNull: { msg: txt.needKnowIfNoticeOk },
|
||||
isIn:
|
||||
{
|
||||
args: [[true, false]],
|
||||
msg: txt.needKnowIfNoticeOk+" "+txtGeneral.notValidFormat
|
||||
}
|
||||
}
|
||||
},
|
||||
lastProcessingAt:
|
||||
{
|
||||
type: DataTypes.DATE, allowNull: false, defaultValue: "1970-01-01",
|
||||
|
@ -113,19 +113,6 @@ module.exports = (sequelize, DataTypes) =>
|
||||
}
|
||||
}
|
||||
},
|
||||
newsletterOk:
|
||||
{
|
||||
type: DataTypes.BOOLEAN(1), allowNull: false, defaultValue: false,
|
||||
validate:
|
||||
{
|
||||
notNull: { msg: txt.needKnowNewsletterOk },
|
||||
isIn:
|
||||
{
|
||||
args: [[true, false]],
|
||||
msg: txt.needKnowNewsletterOk
|
||||
}
|
||||
}
|
||||
},
|
||||
timeDifference: // https://en.wikipedia.org/wiki/Time_zone
|
||||
{
|
||||
type: DataTypes.INTEGER(3), allowNull: false, defaultValue: 0,
|
||||
|
@ -3,9 +3,9 @@
|
||||
-- https://www.phpmyadmin.net/
|
||||
--
|
||||
-- Client : localhost:3306
|
||||
-- Généré le : Mer 07 Octobre 2020 à 18:42
|
||||
-- Généré le : Mer 21 Octobre 2020 à 17:36
|
||||
-- Version du serveur : 5.7.31-0ubuntu0.18.04.1
|
||||
-- Version de PHP : 7.2.24-0ubuntu0.18.04.6
|
||||
-- Version de PHP : 7.2.24-0ubuntu0.18.04.7
|
||||
|
||||
SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
|
||||
SET time_zone = "+00:00";
|
||||
@ -207,7 +207,6 @@ CREATE TABLE `Subscriptions` (
|
||||
`id` int(11) NOT NULL,
|
||||
`numberOfDays` int(6) UNSIGNED NOT NULL DEFAULT '0' COMMENT 'The duration in number of days of the subscription',
|
||||
`receiptDays` varchar(7) DEFAULT '1234567' COMMENT 'Days on which the user has chosen to receive new questionnaires. The same numbers as in Mysql''s DAYOFWEEK function.',
|
||||
`noticeOk` tinyint(1) NOT NULL DEFAULT '0',
|
||||
`createdAt` datetime NOT NULL,
|
||||
`updatedAt` datetime NOT NULL,
|
||||
`lastProcessingAt` date NOT NULL DEFAULT '1970-01-01' COMMENT 'Date of last subscription processing (sending quiz, etc.).',
|
||||
@ -258,7 +257,6 @@ CREATE TABLE `Users` (
|
||||
`adminComments` text COLLATE utf8mb4_unicode_ci COMMENT 'Not published.',
|
||||
`connectedAt` datetime DEFAULT NULL,
|
||||
`smtp` int(1) UNSIGNED NOT NULL DEFAULT '0' COMMENT 'Allows to assign a different SMTP server in case of deliverability issues.',
|
||||
`newsletterOk` tinyint(1) NOT NULL DEFAULT '0',
|
||||
`timeDifference` int(3) NOT NULL DEFAULT '0' COMMENT 'Time difference (in minutes) from UTC.',
|
||||
`createdAt` datetime NOT NULL,
|
||||
`updatedAt` datetime NOT NULL,
|
||||
@ -394,22 +392,22 @@ ALTER TABLE `Answers`
|
||||
-- AUTO_INCREMENT pour la table `Choices`
|
||||
--
|
||||
ALTER TABLE `Choices`
|
||||
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=1016;
|
||||
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=1044;
|
||||
--
|
||||
-- AUTO_INCREMENT pour la table `Groups`
|
||||
--
|
||||
ALTER TABLE `Groups`
|
||||
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT;
|
||||
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=4;
|
||||
--
|
||||
-- AUTO_INCREMENT pour la table `Illustrations`
|
||||
--
|
||||
ALTER TABLE `Illustrations`
|
||||
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=39;
|
||||
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=42;
|
||||
--
|
||||
-- AUTO_INCREMENT pour la table `Links`
|
||||
--
|
||||
ALTER TABLE `Links`
|
||||
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=35;
|
||||
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=38;
|
||||
--
|
||||
-- AUTO_INCREMENT pour la table `Pauses`
|
||||
--
|
||||
@ -424,17 +422,17 @@ ALTER TABLE `Payments`
|
||||
-- AUTO_INCREMENT pour la table `Questionnaires`
|
||||
--
|
||||
ALTER TABLE `Questionnaires`
|
||||
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=51;
|
||||
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=60;
|
||||
--
|
||||
-- AUTO_INCREMENT pour la table `Questions`
|
||||
--
|
||||
ALTER TABLE `Questions`
|
||||
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=327;
|
||||
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=338;
|
||||
--
|
||||
-- AUTO_INCREMENT pour la table `Subscriptions`
|
||||
--
|
||||
ALTER TABLE `Subscriptions`
|
||||
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=19;
|
||||
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=27;
|
||||
--
|
||||
-- AUTO_INCREMENT pour la table `Tags`
|
||||
--
|
||||
@ -449,7 +447,7 @@ ALTER TABLE `UserDeleteds`
|
||||
-- AUTO_INCREMENT pour la table `Users`
|
||||
--
|
||||
ALTER TABLE `Users`
|
||||
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=27;
|
||||
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=30;
|
||||
--
|
||||
-- Contraintes pour les tables exportées
|
||||
--
|
||||
|
Loading…
Reference in New Issue
Block a user