30 lines
1.3 KiB
JavaScript
30 lines
1.3 KiB
JavaScript
const { DataTypes } = require("sequelize");
|
|
const sequelize = require("../config/database");
|
|
|
|
const Important = sequelize.define(
|
|
"Important",
|
|
{
|
|
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 },
|
|
originalMailbox: { type: DataTypes.STRING, allowNull: true }, // 중요 편지함은 참조 개념일 수도 있으나 우선 독립 테이블로 구성
|
|
// 메일 크기 (bytes) - 검색 필터용
|
|
size: { type: DataTypes.INTEGER, allowNull: true, defaultValue: 0 },
|
|
},
|
|
{
|
|
tableName: "important",
|
|
timestamps: true,
|
|
}
|
|
);
|
|
|
|
module.exports = Important;
|