58 lines
1.8 KiB
JavaScript
58 lines
1.8 KiB
JavaScript
'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;
|
|
};
|