feat: Mise à jour de l'import
This commit is contained in:
parent
8cfaf3452a
commit
02975190a4
|
@ -1,14 +1,15 @@
|
|||
import DirectusToMarkdown from '@resilien/directus-to-markdown'
|
||||
import urlslug from 'url-slug'
|
||||
|
||||
const filter = process.env.DRAFT && process.env.DRAFT == 'true' ? '' : { draft: { _eq: 'false' } }
|
||||
const filterDraft = process.env.DRAFT && process.env.DRAFT == 'true' ? '' : { draft: { _eq: 'false' } }
|
||||
const filterAssociation = process.env.DRAFT && process.env.DRAFT == 'true' ? '' : { display_website: { _eq: 'true' } }
|
||||
|
||||
const config = {
|
||||
collections: {
|
||||
actualites: {
|
||||
readByQueryOption: {
|
||||
fields: ['title', 'date', 'image', 'image_credit', 'description', 'auteur', 'draft', 'content'],
|
||||
filter
|
||||
filterDraft
|
||||
},
|
||||
pathBuilder: (article) => {
|
||||
const [year, month, day] = article.date.split("-")
|
||||
|
@ -28,14 +29,15 @@ const config = {
|
|||
'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) {
|
||||
console.log(association.bureau.length)
|
||||
const bureau = []
|
||||
for (const contact of association.bureau) {
|
||||
const detail = contact.Contact_id
|
||||
|
|
Loading…
Reference in New Issue