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
+35
View File
@@ -0,0 +1,35 @@
const {
Model
} = require('sequelize');
module.exports = (sequelize, DataTypes) => {
class Comment 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 */
}
}
Comment.init({
comment_id: { type: DataTypes.INTEGER, primaryKey: true, autoIncrement: true, allowNull: false },
comment_body: { type: DataTypes.TEXT, allowNull: false }
}, {
sequelize,
timestamps: false,
modelName: 'Comment',
tableName: 'comment',
createdAt: true,
updatedAt: true
});
Comment.prototype.toJSONFor = function () {
return {
id: this.comment_id,
body: this.comment_body
};
};
return Comment;
};