30 lines
1.2 KiB
JavaScript
30 lines
1.2 KiB
JavaScript
|
|
const { DataTypes } = require("sequelize");
|
||
|
|
const sequelize = require("../config/database");
|
||
|
|
|
||
|
|
const Sent = sequelize.define(
|
||
|
|
"Sent",
|
||
|
|
{
|
||
|
|
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: true }, // 보낸 메일은 기본 읽음
|
||
|
|
isDeleted: { type: DataTypes.BOOLEAN, defaultValue: false },
|
||
|
|
// 메일 크기 (bytes) - 검색 필터용
|
||
|
|
size: { type: DataTypes.INTEGER, allowNull: true, defaultValue: 0 },
|
||
|
|
},
|
||
|
|
{
|
||
|
|
tableName: "sent",
|
||
|
|
timestamps: true,
|
||
|
|
}
|
||
|
|
);
|
||
|
|
|
||
|
|
module.exports = Sent;
|