Add forceSlug to teks

This commit is contained in:
Cédric FAMIBELLE-PRONZOLA
2022-03-23 09:08:25 +04:00
parent c543542567
commit c9242d7e20
6 changed files with 30 additions and 3 deletions
+6
View File
@@ -832,6 +832,9 @@
}
}
},
"forceSlug": {
"type": "boolean"
},
"published_at": {
"type": "string",
"format": "date-time"
@@ -966,6 +969,9 @@
"type": "string"
}
},
"forceSlug": {
"type": "boolean"
},
"published_at": {
"type": "string",
"format": "date-time"
+2 -2
View File
@@ -16,13 +16,13 @@ const jwennAwtisEpiId = async data => {
module.exports = {
lifecycles: {
beforeCreate: async data => {
if (data.tit) {
if (data.tit && !data.forceSlug) {
const awtis = await jwennAwtisEpiId(data.awtis)
data.slug = slugify(`${awtis}-${data.tit}`, {lower: true, remove: /[*#+~.()'"!:@]/g})
}
},
beforeUpdate: async (params, data) => {
if (data.tit) {
if (data.tit && !data.forceSlug) {
const awtis = await jwennAwtisEpiId(data.awtis)
data.slug = slugify(`${awtis}-${data.tit}`, {lower: true, remove: /[*#+~.()'"!:@]/g})
}
+3
View File
@@ -68,6 +68,9 @@
"komante": {
"via": "teks",
"collection": "komante"
},
"forceSlug": {
"type": "boolean"
}
}
}