Add slug to awtis

This commit is contained in:
Cédric FAMIBELLE-PRONZOLA
2022-05-10 22:01:40 +04:00
parent 75f8ab7d3d
commit 89ab55ec6d
6 changed files with 31 additions and 2 deletions
+6
View File
@@ -735,6 +735,9 @@
}
}
},
"slug": {
"type": "string"
},
"published_at": {
"type": "string",
"format": "date-time"
@@ -771,6 +774,9 @@
"user": {
"type": "string"
},
"slug": {
"type": "string"
},
"published_at": {
"type": "string",
"format": "date-time"
+8
View File
@@ -19,6 +19,14 @@ const jwennAwtisEpiId = async id => {
module.exports = {
lifecycles: {
beforeUpdate: async (params, data) => {
if (!data.slug) {
data.slug = slugify(data.alias, {lower: true, remove: /[*#+~.()'"!:@]/g})
}
},
beforeCreate: async data => {
data.slug = slugify(data.alias, {lower: true, remove: /[*#+~.()'"!:@]/g})
},
afterUpdate: async (params, data) => {
const {id} = data
const awtis = await jwennAwtisEpiId(id)
+3
View File
@@ -45,6 +45,9 @@
"user": {
"plugin": "users-permissions",
"model": "user"
},
"slug": {
"type": "string"
}
}
}
+3
View File
@@ -631,6 +631,9 @@
"user": {
"type": "string"
},
"slug": {
"type": "string"
},
"published_at": {
"type": "string"
},
+1 -1
View File
@@ -33,8 +33,8 @@
"component": "url.liens"
},
"awtis": {
"collection": "awtis",
"via": "teks",
"collection": "awtis",
"dominant": true
},
"kouteyAchtey": {
@@ -11,7 +11,7 @@
"url": "https://o-k-i.net"
},
"license": null,
"x-generation-date": "05/08/2022 3:50:47 AM"
"x-generation-date": "05/10/2022 9:18:59 PM"
},
"x-strapi-config": {
"path": "/dokiman",
@@ -1580,6 +1580,9 @@
}
}
},
"slug": {
"type": "string"
},
"published_at": {
"type": "string",
"format": "date-time"
@@ -1616,6 +1619,9 @@
"user": {
"type": "string"
},
"slug": {
"type": "string"
},
"published_at": {
"type": "string",
"format": "date-time"
@@ -1922,6 +1928,9 @@
"user": {
"type": "string"
},
"slug": {
"type": "string"
},
"published_at": {
"type": "string"
},