Add slug to awtis
This commit is contained in:
@@ -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)
|
||||
|
||||
@@ -45,6 +45,9 @@
|
||||
"user": {
|
||||
"plugin": "users-permissions",
|
||||
"model": "user"
|
||||
},
|
||||
"slug": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user