homepage.js/models/article.js

66 lines
1.3 KiB
JavaScript
Raw Normal View History

const { Model, DataTypes } = require('sequelize');
2023-02-22 14:54:35 +01:00
class Article extends Model {
2023-02-22 14:54:35 +01:00
}
Article.structure = {
id: {
type: DataTypes.BIGINT(11),
primaryKey: true,
autoIncrement: true,
allowNull: false
},
title: {
type: DataTypes.TEXT,
allowNull: false
},
shortText: {
type: DataTypes.TEXT,
allowNull: false
},
body: {
type: DataTypes.TEXT,
allowNull: false
},
submitted: {
type: DataTypes.BIGINT,
allowNull: false
},
edited: {
type: DataTypes.BIGINT,
allowNull: false
},
submitter: {
type: DataTypes.BIGINT,
allowNull: false
},
gpgsign: {
type: DataTypes.TEXT,
allowNull: true
2023-02-27 14:26:24 +01:00
},
hidden: {
type: DataTypes.BOOLEAN,
allowNull: false,
defaultValue: false
}
};
/**
* @param {import('sequelize').Sequelize} sequelize
* @param {import('sequelize').DataTypes} DataTypes
* @returns Article
*/
2023-02-22 14:54:35 +01:00
let init = (sequelize, DataTypes) => {
let article = Article.init(Article.structure, {
2023-02-22 14:54:35 +01:00
sequelize,
modelName: 'Article',
tableName: 'articles'
})
article.class = Article;
return article;
}
init.class = Article;
module.exports = init;