/** * 이메일 번역 캐시 테이블 * 번역된 이메일 내용 저장 */ const { DataTypes } = require("sequelize"); const sequelize = require("../config/database"); const EmailTranslation = sequelize.define( "EmailTranslation", { id: { type: DataTypes.INTEGER, primaryKey: true, autoIncrement: true, }, emailId: { type: DataTypes.INTEGER, allowNull: false, field: "email_id", comment: "원본 이메일 ID", }, mailbox: { type: DataTypes.STRING(20), allowNull: false, comment: "메일함 (inbox, sent, trash 등)", }, targetLang: { type: DataTypes.STRING(10), allowNull: false, field: "target_lang", comment: "번역 대상 언어", }, translatedContent: { type: DataTypes.TEXT("long"), allowNull: false, field: "translated_content", comment: "번역된 내용", }, modelUsed: { type: DataTypes.STRING(50), allowNull: true, field: "model_used", comment: "사용된 AI 모델", }, }, { tableName: "email_translations", timestamps: true, createdAt: "created_at", updatedAt: "updated_at", indexes: [ { unique: true, fields: ["email_id", "mailbox", "target_lang"], }, ], } ); module.exports = EmailTranslation;