Files
yourpart3/backend/models/community/blog_post.js
Torsten Schulz (local) 1ab9407e79
All checks were successful
Deploy to production / deploy (push) Successful in 2m56s
Refactor code structure for improved readability and maintainability; optimize performance across multiple modules.
2026-07-21 09:08:15 +02:00

42 lines
823 B
JavaScript
Executable File

import { Model, DataTypes } from 'sequelize';
import { sequelize } from '../../utils/sequelize.js';
class BlogPost extends Model {}
BlogPost.init({
blogId: {
type: DataTypes.INTEGER,
allowNull: false,
field: 'blog_id'
},
userId: {
type: DataTypes.INTEGER,
allowNull: false,
field: 'user_id'
},
title: {
type: DataTypes.STRING(255),
allowNull: false},
content: {
type: DataTypes.TEXT,
allowNull: false},
createdAt: {
type: DataTypes.DATE,
defaultValue: DataTypes.NOW,
field: 'created_at'
},
updatedAt: {
type: DataTypes.DATE,
defaultValue: DataTypes.NOW,
field: 'updated_at'
}
}, {
sequelize,
modelName: 'BlogPost',
tableName: 'blog_post',
schema: 'community',
timestamps: true,
underscored: true});
export default BlogPost;