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
+34
View File
@@ -0,0 +1,34 @@
const {
Model
} = require('sequelize');
module.exports = (sequelize, DataTypes) => {
class Tag 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 */
}
}
Tag.init({
tag_name: { type: DataTypes.STRING, allowNull: false, primaryKey: true }
}, {
sequelize,
timestamps: false,
modelName: 'Tag',
tableName: 'tag',
createdAt: true,
updatedAt: true
});
Tag.prototype.toJSONFor = function () {
return {
id: this.tag_id,
name: this.tag_name
};
};
return Tag;
};