Files
adastra_api/models/Comment.js
T
2025-08-10 09:15:18 +02:00

26 lines
688 B
JavaScript

const { DataTypes, Model } = require("sequelize");
const sequelize = require("../util/database");
const Comment = sequelize.define("Comment", {
id: { type: DataTypes.INTEGER, primaryKey: true, autoIncrement: true, allowNull: false },
body: { type: DataTypes.TEXT, allowNull: false },
createdAt: { type: DataTypes.DATE, allowNull: true },
updatedAt: { type: DataTypes.DATE, allowNull: true }
}, {
sequelize,
timestamps: false,
modelName: 'Comment',
tableName: 'comment',
createdAt: true,
updatedAt: true
});
Comment.prototype.toJSONFor = function () {
return {
id: this.id,
body: this.body
};
};
module.exports = Comment;