Mise à jour de models
This commit is contained in:
@@ -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 () {
|
||||
|
||||
@@ -1,57 +0,0 @@
|
||||
'use strict';
|
||||
const {
|
||||
Model
|
||||
} = require('sequelize');
|
||||
module.exports = (sequelize, DataTypes) => {
|
||||
class Membre extends Model {
|
||||
/**
|
||||
* Helper method for defining associations.
|
||||
* This method is not a part of Sequelize lifecycle.
|
||||
* The `models/index` file will call this method automatically.
|
||||
*/
|
||||
static associate(models) {
|
||||
/* define association here */
|
||||
}
|
||||
}
|
||||
Membre.init({
|
||||
mbr_id: {type: DataTypes.INTEGER, primaryKey: true, autoIncrement: true, allowNull: false},
|
||||
mbr_pseudo: {type: DataTypes.STRING, allowNull: false},
|
||||
mbr_nom: {type: DataTypes.STRING},
|
||||
mbr_prenom: {type: DataTypes.STRING},
|
||||
mbr_email: {type: DataTypes.STRING},
|
||||
mbr_adresse: {type: DataTypes.STRING},
|
||||
mbr_ville: {type: DataTypes.STRING},
|
||||
mbr_region: {type: DataTypes.STRING},
|
||||
mbr_cp: {type: DataTypes.STRING},
|
||||
mbr_pays: {type: DataTypes.STRING},
|
||||
mbr_tel: {type: DataTypes.STRING},
|
||||
mbr_mobile: {type: DataTypes.STRING},
|
||||
mbr_statut: {type: DataTypes.INTEGER}
|
||||
}, {
|
||||
sequelize,
|
||||
timestamps: false,
|
||||
modelName: 'Membre',
|
||||
tableName: 'membre',
|
||||
createdAt: false,
|
||||
updatedAt: false
|
||||
});
|
||||
|
||||
Membre.prototype.toJSONFor = function () {
|
||||
return {
|
||||
id: this.mbr_id,
|
||||
pseudo: this.mbr_pseudo,
|
||||
nom: this.mbr_nom,
|
||||
prenom: this.mbr_prenom,
|
||||
email: this.mbr_email,
|
||||
adresse: this.mbr_adresse,
|
||||
ville: this.mbr_ville,
|
||||
region: this.mbr_region,
|
||||
cp: this.mbr_cp,
|
||||
pays: this.mbr_pays,
|
||||
tel: this.mbr_tel,
|
||||
mobile: this.mbr_mobile,
|
||||
statut: this.mbr_statut
|
||||
};
|
||||
};
|
||||
return Membre;
|
||||
};
|
||||
@@ -1,6 +1,6 @@
|
||||
'use strict';
|
||||
|
||||
const bcrypt = require('bcrypt');
|
||||
const bcrypt = require("bcryptjs");
|
||||
|
||||
const {
|
||||
Model
|
||||
|
||||
Reference in New Issue
Block a user