essential forum code
This commit is contained in:
49
backend/models/ForumPost.js
Normal file
49
backend/models/ForumPost.js
Normal file
@@ -0,0 +1,49 @@
|
||||
const { DataTypes } = require('sequelize');
|
||||
const sequelize = require('../config/database');
|
||||
|
||||
const ForumPost = sequelize.define('ForumPost', {
|
||||
id: {
|
||||
type: DataTypes.UUID,
|
||||
defaultValue: DataTypes.UUIDV4,
|
||||
primaryKey: true
|
||||
},
|
||||
title: {
|
||||
type: DataTypes.STRING,
|
||||
allowNull: false
|
||||
},
|
||||
content: {
|
||||
type: DataTypes.TEXT,
|
||||
allowNull: false
|
||||
},
|
||||
authorId: {
|
||||
type: DataTypes.UUID,
|
||||
allowNull: false,
|
||||
references: {
|
||||
model: 'Users',
|
||||
key: 'id'
|
||||
}
|
||||
},
|
||||
category: {
|
||||
type: DataTypes.ENUM('item_request', 'technical_support', 'community_resources', 'general_discussion'),
|
||||
allowNull: false,
|
||||
defaultValue: 'general_discussion'
|
||||
},
|
||||
status: {
|
||||
type: DataTypes.ENUM('open', 'solved', 'closed'),
|
||||
defaultValue: 'open'
|
||||
},
|
||||
viewCount: {
|
||||
type: DataTypes.INTEGER,
|
||||
defaultValue: 0
|
||||
},
|
||||
commentCount: {
|
||||
type: DataTypes.INTEGER,
|
||||
defaultValue: 0
|
||||
},
|
||||
isPinned: {
|
||||
type: DataTypes.BOOLEAN,
|
||||
defaultValue: false
|
||||
}
|
||||
});
|
||||
|
||||
module.exports = ForumPost;
|
||||
Reference in New Issue
Block a user