tududi/backend/models/inbox_item.js
2025-07-11 20:34:48 +03:00

65 lines
1.7 KiB
JavaScript

const { DataTypes } = require('sequelize');
module.exports = (sequelize) => {
const InboxItem = sequelize.define(
'InboxItem',
{
id: {
type: DataTypes.INTEGER,
primaryKey: true,
autoIncrement: true,
},
content: {
type: DataTypes.STRING,
allowNull: false,
},
status: {
type: DataTypes.STRING,
allowNull: false,
defaultValue: 'added',
},
source: {
type: DataTypes.STRING,
allowNull: false,
},
user_id: {
type: DataTypes.INTEGER,
allowNull: false,
references: {
model: 'users',
key: 'id',
},
},
suggested_type: {
type: DataTypes.STRING,
allowNull: true,
},
suggested_reason: {
type: DataTypes.STRING,
allowNull: true,
},
parsed_tags: {
type: DataTypes.JSON,
allowNull: true,
},
parsed_projects: {
type: DataTypes.JSON,
allowNull: true,
},
cleaned_content: {
type: DataTypes.STRING,
allowNull: true,
},
},
{
tableName: 'inbox_items',
indexes: [
{
fields: ['user_id'],
},
],
}
);
return InboxItem;
};