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
+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})
}