mailbox/backend/models/Inbox.js

33 lines
1.3 KiB
JavaScript
Raw Normal View History

2025-12-16 08:18:15 +09:00
const { DataTypes } = require("sequelize");
const sequelize = require("../config/database");
const Inbox = sequelize.define(
"Inbox",
{
id: { type: DataTypes.INTEGER, primaryKey: true, autoIncrement: true },
messageId: { type: DataTypes.STRING, unique: false, allowNull: true },
from: { type: DataTypes.STRING, allowNull: false },
fromName: { type: DataTypes.STRING, allowNull: true },
to: { type: DataTypes.TEXT, allowNull: false },
subject: { type: DataTypes.STRING, defaultValue: "(No Subject)" },
text: { type: DataTypes.TEXT("long"), allowNull: true },
html: { type: DataTypes.TEXT("long"), allowNull: true },
attachments: { type: DataTypes.JSON, defaultValue: [] },
date: { type: DataTypes.DATE, defaultValue: DataTypes.NOW },
flags: { type: DataTypes.JSON, defaultValue: [] },
isRead: { type: DataTypes.BOOLEAN, defaultValue: false },
isDeleted: { type: DataTypes.BOOLEAN, defaultValue: false },
// 메일 크기 (bytes) - 검색 필터용
size: { type: DataTypes.INTEGER, allowNull: true, defaultValue: 0 },
// rspamd 스팸 필터 관련 필드
spamScore: { type: DataTypes.FLOAT, allowNull: true },
rawEmail: { type: DataTypes.TEXT("long"), allowNull: true },
},
{
tableName: "inbox",
timestamps: true,
}
);
module.exports = Inbox;