Add forceSlug to teks
This commit is contained in:
@@ -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"
|
||||
|
||||
@@ -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})
|
||||
}
|
||||
|
||||
@@ -68,6 +68,9 @@
|
||||
"komante": {
|
||||
"via": "teks",
|
||||
"collection": "komante"
|
||||
},
|
||||
"forceSlug": {
|
||||
"type": "boolean"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user