1
0
forked from apxtri/apxtri

mise à jour addprofils et removeprofis

This commit is contained in:
philc 2024-06-10 16:28:19 +02:00
parent 441483bcc8
commit aad0a4371d

View File

@ -346,11 +346,11 @@ router.put("/person/:tribe", checkHeaders, isAuthenticated, (req, res) => {
if (
action == "U" &&
((req.body.addprofils &&
["seekers", "recruiters", "interviewers"].includes(
["seekers", "recruiters", "adminrecruiters"].includes(
req.body.addprofils
)) ||
(req.body.removeprofils &&
["seekers", "recruiters", "interviewers"].includes(
["seekers", "recruiters", "adminrecruiters"].includes(
req.body.removeprofils
)))
) {
@ -359,8 +359,22 @@ router.put("/person/:tribe", checkHeaders, isAuthenticated, (req, res) => {
if (req.body.addprofils) {
person.profils.push(req.body.addprofils);
}
if (req.body.removeprofils) {
//@todo
if (
req.body.removeprofils &&
person.profils.includes(req.body.removeprofils)
) {
person.profils = person.profils.filter(
(e) => e !== req.body.removeprofils
);
Odmdb.cud(
`../../${req.params.tribe}/objects/${req.body.removeprofils}`,
"D",
{ alias: req.body.alias },
{
xprofils: req.session.header.xprofils,
xalias: req.session.header.xalias,
}
);
}
}
person.dt_update = dayjs().toISOString();