feat: Resynchronisation automatique des associations
continuous-integration/drone/push Build is passing Details
continuous-integration/drone Build is passing Details

This commit is contained in:
Simon 2024-02-29 11:44:24 +01:00
parent a33dfc9322
commit dc26afe2cb
1 changed files with 50 additions and 50 deletions

View File

@ -52,57 +52,57 @@ const config = {
},
deleteFields: [],
},
// Association: {
// readByQueryOption: {
// fields: [
// 'denomination',
// 'title',
// 'description',
// 'mail',
// 'telephone',
// 'site',
// 'facebook',
// 'bureau.sort',
// 'bureau.Contact_id.*',
// 'content',
// ],
// filterAssociation
// },
// pathBuilder: (association) => {
// if (!association.title) {
// association.title = association.denomination
// }
// console.log("Import de l'association « " + association.title + " »")
// if (association.bureau && association.bureau.length > 0) {
// const bureau = []
// for (const contact of association.bureau) {
// const detail = contact.Contact_id
// if (detail) {
// let c = {
// denomination: detail.denomination,
// prenom: detail.prenom,
// nom: detail.nom,
// }
// if (detail.mail && detail.display_mail) {
// c.mail = detail.mail
// }
// if (detail.telephone && detail.display_telephone) {
// c.telephone = detail.telephone
// }
// bureau.push(c)
// } else {
// console.log("problème sur un contact")
// }
// }
// association.bureau = bureau
// } else {
// delete association.bureau
// }
Association: {
readByQueryOption: {
fields: [
'denomination',
'title',
'description',
'mail',
'telephone',
'site',
'facebook',
'bureau.sort',
'bureau.Contact_id.*',
'content',
],
filterAssociation
},
pathBuilder: (association) => {
if (!association.title) {
association.title = association.denomination
}
console.log("Import de l'association « " + association.title + " »")
if (association.bureau && association.bureau.length > 0) {
const bureau = []
for (const contact of association.bureau) {
const detail = contact.Contact_id
if (detail) {
let c = {
denomination: detail.denomination,
prenom: detail.prenom,
nom: detail.nom,
}
if (detail.mail && detail.display_mail) {
c.mail = detail.mail
}
if (detail.telephone && detail.display_telephone) {
c.telephone = detail.telephone
}
bureau.push(c)
} else {
console.log("problème sur un contact")
}
}
association.bureau = bureau
} else {
delete association.bureau
}
// return `./content/associations/${urlslug(association.denomination)}`;
// },
// deleteFields: [],
// },
return `./content/associations/${urlslug(association.denomination)}`;
},
deleteFields: [],
},
}
}