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
+3
View File
@@ -666,6 +666,9 @@
"type": "string" "type": "string"
} }
}, },
"forceSlug": {
"type": "boolean"
},
"published_at": { "published_at": {
"type": "string" "type": "string"
}, },
@@ -627,6 +627,9 @@
"type": "string" "type": "string"
} }
}, },
"forceSlug": {
"type": "boolean"
},
"published_at": { "published_at": {
"type": "string" "type": "string"
}, },
+6
View File
@@ -832,6 +832,9 @@
} }
} }
}, },
"forceSlug": {
"type": "boolean"
},
"published_at": { "published_at": {
"type": "string", "type": "string",
"format": "date-time" "format": "date-time"
@@ -966,6 +969,9 @@
"type": "string" "type": "string"
} }
}, },
"forceSlug": {
"type": "boolean"
},
"published_at": { "published_at": {
"type": "string", "type": "string",
"format": "date-time" "format": "date-time"
+2 -2
View File
@@ -16,13 +16,13 @@ const jwennAwtisEpiId = async data => {
module.exports = { module.exports = {
lifecycles: { lifecycles: {
beforeCreate: async data => { beforeCreate: async data => {
if (data.tit) { if (data.tit && !data.forceSlug) {
const awtis = await jwennAwtisEpiId(data.awtis) const awtis = await jwennAwtisEpiId(data.awtis)
data.slug = slugify(`${awtis}-${data.tit}`, {lower: true, remove: /[*#+~.()'"!:@]/g}) data.slug = slugify(`${awtis}-${data.tit}`, {lower: true, remove: /[*#+~.()'"!:@]/g})
} }
}, },
beforeUpdate: async (params, data) => { beforeUpdate: async (params, data) => {
if (data.tit) { if (data.tit && !data.forceSlug) {
const awtis = await jwennAwtisEpiId(data.awtis) const awtis = await jwennAwtisEpiId(data.awtis)
data.slug = slugify(`${awtis}-${data.tit}`, {lower: true, remove: /[*#+~.()'"!:@]/g}) data.slug = slugify(`${awtis}-${data.tit}`, {lower: true, remove: /[*#+~.()'"!:@]/g})
} }
+3
View File
@@ -68,6 +68,9 @@
"komante": { "komante": {
"via": "teks", "via": "teks",
"collection": "komante" "collection": "komante"
},
"forceSlug": {
"type": "boolean"
} }
} }
} }
@@ -11,7 +11,7 @@
"url": "https://o-k-i.net" "url": "https://o-k-i.net"
}, },
"license": null, "license": null,
"x-generation-date": "03/22/2022 6:55:51 AM" "x-generation-date": "03/23/2022 8:55:05 AM"
}, },
"x-strapi-config": { "x-strapi-config": {
"path": "/dokiman", "path": "/dokiman",
@@ -1511,6 +1511,9 @@
"type": "string" "type": "string"
} }
}, },
"forceSlug": {
"type": "boolean"
},
"published_at": { "published_at": {
"type": "string" "type": "string"
}, },
@@ -1729,6 +1732,9 @@
"type": "string" "type": "string"
} }
}, },
"forceSlug": {
"type": "boolean"
},
"published_at": { "published_at": {
"type": "string" "type": "string"
}, },
@@ -2099,6 +2105,9 @@
} }
} }
}, },
"forceSlug": {
"type": "boolean"
},
"published_at": { "published_at": {
"type": "string", "type": "string",
"format": "date-time" "format": "date-time"
@@ -2233,6 +2242,9 @@
"type": "string" "type": "string"
} }
}, },
"forceSlug": {
"type": "boolean"
},
"published_at": { "published_at": {
"type": "string", "type": "string",
"format": "date-time" "format": "date-time"