Mise à jour de models

This commit is contained in:
Rampeur
2025-08-08 20:18:39 +02:00
parent e83b2e831f
commit 61fdac2434
9 changed files with 208 additions and 71 deletions
+2 -2
View File
@@ -1,5 +1,5 @@
const slug = require("slug");
const slugify = require("slugify");
const {
Model
@@ -31,7 +31,7 @@ module.exports = (sequelize, DataTypes) => {
});
Article.beforeValidate((article) => {
article.slug = slug(article.title) + '-' + (Math.random() * Math.pow(36, 6) | 0).toString(36);
article.slug = slugify(article.title, { lower: true });
});
Article.prototype.toJSONFor = function () {