homepage.js/models/guestbook.js

55 lines
988 B
JavaScript
Raw Normal View History

const { Model, DataTypes } = require('sequelize');
2023-02-22 14:54:35 +01:00
class Guestbook extends Model {
2023-02-22 14:54:35 +01:00
}
Guestbook.structure = {
id: {
type: DataTypes.BIGINT(11),
primaryKey: true,
autoIncrement: true,
allowNull: false
},
name: {
type: DataTypes.TEXT,
allowNull: false
},
email: DataTypes.TEXT,
text: {
type: DataTypes.TEXT,
allowNull: false
},
hidemail: {
type: DataTypes.BOOLEAN,
allowNull: false
},
ip: {
type: DataTypes.TEXT,
allowNull: false
},
hidden: {
type: DataTypes.BOOLEAN,
allowNull: false
},
time: {
type: DataTypes.BIGINT
}
};
/**
* @param {import('sequelize').Sequelize} sequelize
* @param {import('sequelize').DataTypes} DataTypes
* @returns Guestbook
*/
2023-02-22 14:54:35 +01:00
const init = (sequelize, DataTypes) => {
let model = Guestbook.init(Guestbook.structure, {
2023-02-19 10:54:30 +01:00
sequelize,
2023-02-20 03:43:53 +01:00
modelName: 'Guestbook',
tableName: 'guestbook'
2023-02-19 10:54:30 +01:00
});
2023-02-22 14:54:35 +01:00
return model;
};
init.class = Guestbook;
module.exports = init;